Keep your systems in step

Your CRM, mailing list, accounts or data warehouse, kept up to date with every order, refund and check-in as it happens.

The plan

  1. Webhooks tell you the moment something changes, with the whole object.
  2. You save each object over the one you had, so repeats and the odd late delivery do no harm.
  3. Once a day, the API fills any gap, in case your server was down for longer than the retries.

1. Subscribe

Use a key from the Read only starting point with Manage webhook endpoints added, and subscribe to the events you keep.

Request
curl -X POST "https://eos.aveoevents.com/api/v1/webhook-endpoints" \
  -H "Authorization: Bearer $EOS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"url":"https://example.com/hooks/eos","description":"Orders into our CRM","events":["order.paid","order.refunded"]}'

2. Save what arrives

Check each delivery’s signature as on Webhooks, answer 200 quickly, then save. Order objects use the reference buyers see (O-7KQ2M4X) as their id, so it matches what customers quote to you, and say where each came from in channel: shop, api, issued or promoter. Changes your team makes in EOS (events, codes, guests) arrive as webhooks too, so your copy never drifts.

Node.js
// one handler for every event type, after the signature check (see Webhooks)
async function handle(event) {
  const o = event.data.object;
  switch (event.type) {
    case "order.created":
    case "order.paid":
    case "order.cancelled":
    case "order.refunded":
      // the whole order each time: save it over what you had, keyed by its reference
      await db.orders.upsert({ id: o.id, status: o.status, payment: o.payment_status, total: o.total, buyer: o.buyer.email, event: o.event_id });
      if (event.type === "order.paid") await crm.addContact(o.buyer); // ask before adding to a mailing list
      break;
    case "attendee.checked_in":
      await db.attendance.insert({ ticket: o.attendee_id, event: o.event_id, at: o.created_at, gate: o.gate });
      break;
    case "attendee.updated":
      await db.tickets.update(o.id, { name: `${o.first_name} ${o.last_name}`, email: o.email });
      break;
  }
}

3. Fill any gaps

Once a day, page through recent orders and save them the same way. It costs a few requests and means nothing is ever missed. The sales report gives daily totals to check your figures against.

// nightly: every order of an event, saved over what you have
let cursor = null;
do {
  const q = new URLSearchParams({ event_id: "41", limit: "100", ...(cursor ? { cursor } : {}) });
  const res = await fetch(`https://eos.aveoevents.com/api/v1/orders?${q}`, {
    headers: { Authorization: `Bearer ${process.env.EOS_API_KEY}` },
  });
  const page = await res.json();
  for (const o of page.data) await db.orders.upsert({ id: o.id, status: o.status, payment: o.payment_status, total: o.total });
  cursor = page.next_cursor;
} while (cursor);

Your contact form, into EOS

Going the other way, send an enquiry from your own website’s contact form. It opens a customer case in EOS with a reference, emails that reference to the customer and alerts your team, just like your EOS shop’s contact form.

Personal data

Orders and guests carry names and email addresses. Keep only what you need, protect it as you would your own customer records, and add people to a mailing list only when they agreed. A buyer who ticked to hear about future events shows in EOS; ask the same question on your own forms.