Delivery API

Webhooks

Receive every change of a delivery at your URL.

Markdown

Set options.webhook_url when you create a delivery, and REMI calls it at every step. Without a URL there are no webhooks.

The call

  • POST with Content-Type: application/json.
  • The body is the Delivery, as GET /delivery/{id} returns it, not wrapped in data.
  • event_type names the event that sent it. bot.control says who drives the bot (webhooks only).
  • Every header in options.webhook_headers is sent too. Calls are not signed: put your own secret in a header and check it.
JSON
{ "id": "ES-5867", "state": "at_pickup", "event_type": "node_arrived", "paused": false, "bot": { "id": "4T001" } }

Events

event_typeWhen
job_createdThe delivery was created.
job_bot_assignedA bot was assigned.
bot_takenThe bot started serving it.
job_startedIt started.
job_state_changedAny change of state.
node_startedThe bot left for the pickup or the dropoff.
node_arrivingThe bot is close.
node_arrivedThe bot arrived.
node_eta_changedAn arrival time moved. Only with options.eta_updates.
job_completedDelivered or returned.
job_canceledCanceled.
job_failedIt could not be completed.

Pickup-only orders also send node_phase_completed (ready for pickup), node_completed (picked up) and, per station, action_completed.

Decide what to do from state, not from event_type.

Order and retries

  • Calls for one delivery come one at a time, in order. Different deliveries are independent.
  • A 5xx, a connection error or no answer within 30 seconds is retried with backoff, up to 5 attempts. Later calls for that delivery wait.
  • After 5 failed attempts the call is dropped and the next one goes out. Treat webhooks as at least once, with possible gaps, and read GET /delivery/{id} to reconcile.
  • A retry rebuilds the body: live fields such as state and the bot's position are current, and event_type stays the original event.

Answer 2xx quickly and do the work afterwards: a slow endpoint delays every later call for that order.

Arrival time updates

With options.eta_updates: true, node_eta_changed also arrives while the bot drives to a stop: when the arrival time moved 90 seconds or more, or after 5 minutes without one, at most once a minute. The new time is in estimates.pickup.arrival_at or estimates.dropoff.arrival_at.