# Getting started with the Spoke Connect Webhook API (/docs/webhooks/enabling)

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](/docs/webhooks/getting-started/consuming-the-webhook-notifications).
1. For each request received from Spoke, your endpoint needs to answer with a
   `2xx` status code.
1. 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.

### 1. Go to the settings page

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

![Integrations settings page](/img/settings/integrations.png)

### 2. 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](/img/settings/webhook_endpoint.png)

### 3. 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](/docs/webhooks/webhook-events) for what each one
means.

![Webhook events](/img/settings/events.png)

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

### 4. 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](/img/settings/test.png)

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](/docs/webhooks/webhook-events) for the event.

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

### What now?

- [Implementing the Endpoint](/docs/webhooks/getting-started/consuming-the-webhook-notifications)
  shows a minimal handler.
- [Securing the Endpoint](/docs/webhooks/getting-started/securing-the-endpoint)
  shows where to find your webhook secret and how to verify that each request
  came from Spoke.
- Read [Best Practices](/docs/webhooks/getting-started/best-practices) before
  you turn webhooks on for real orders.