Connect API

Getting started with the Spoke Connect Webhook API

Prepare your endpoint, then enable webhooks and select events in Connect, and send a test event.

Preparing to receive a Webhook Notification

Before enabling Spoke to send you webhook notifications, make sure you are prepared to receive them:

  1. You will need to implement an HTTPS endpoint to receive POST requests. See Implementing the Endpoint.
  2. For each request received from Spoke, your endpoint needs to answer with a 2xx status code.
  3. Spoke will not send any data on unsafe connections. Make sure your endpoint is public and serves HTTPS with a certificate from a public certificate authority. Spoke rejects self-signed certificates.

Enabling the Webhook Notifications

Only retailer owners and admins can set up webhooks. Shippers do not see the Webhooks settings.

Go to the settings page

Open Settings > Integrations in Connect and find the Webhooks section.

Integrations settings page

Fill your endpoint URL

Enter your endpoint's HTTPS URL in Endpoint URL, then turn on Enable webhook. The toggle stays off until a URL is set.

Webhook endpoint URL and toggle

Select the events

Under Select the events to receive, check the events you want. The checkboxes stay off until webhooks are enabled. Spoke only sends the events you select. See Webhook Events for what each one means.

Webhook events

Connect saves the URL, the toggle and the events as you change them.

Test your webhook

Select Test webhook in the same section. Connect asks Spoke to send a signed event to your saved URL and shows the status code your endpoint returned. The button is disabled until a URL is set.

Test webhook

If Spoke cannot reach your endpoint, Connect says why instead of a status code: the URL is not valid or does not use HTTPS, it points to a private or reserved IP address, its host cannot be found, the connection failed, or your endpoint did not answer in time.

The test is a test.send_event event with a sample order as data: an order a courier has put on a route that has not started yet, with an ETA and a tracking link. The sample order has the id orders/W3kJpzQm9q4LV2BdH7sNuT, which does not belong to your retailer. Use it to check that your endpoint receives the request, verifies the signature, and parses the body. See Webhook Events for the event.

A test event goes out once, and is not retried if your endpoint fails.

What now?

Was this page helpful?