🤜🤛 Expand and Enrich Your Partner Network with a Partner Discovery Platform
Docs Second
  1. Docs
  2. Integrate
  3. Webhooks
How-to guide IntegratorOperator

Receive events by webhook

A Second webhook automatically sends a message to your application's address when an event happens on the marketplace, for example a paid booking. This page lists the available events and explains how to set them up in the back office, the message format and how to receive messages properly.

Last updated

Before you start

  • A receiving address. Your application exposes an HTTPS address that accepts JSON POST requests.
  • Super administrator access to the back office. The back office is the marketplace's administration tool. Only the super administrator creates webhooks. An integrator gives their address and the list of events they want to the operator.
  • API access, to read the data again after each message. See Introduction to the Second API.

How does a webhook work?

How a webhook travelsOPERATORSECONDYOUR APPLICATION1Create the webhookURL and chosen events2An event happensFor example, a booking is paid3Send the messageJSON POST, one attempt only4Acknowledge receiptFast 2xx responseFailure: error shown in the history5Read the data againThrough the API, with an OAuth2 token6Check the historyKept for 7 days by defaultHow a webhook travels1OPERATORCreate the webhookURL and chosen events2SECONDAn event happensFor example, a booking is paid3SECONDSend the messageJSON POST, one attempt only4YOUR APPLICATIONAcknowledge receiptFast 2xx responseFailure: error shown in the history5YOUR APPLICATIONRead the data againThrough the API, with an OAuth2 token6OPERATORCheck the historyKept for 7 days by default
DiagramFrom creating the webhook in the back office to your application reading the data again. Each message is sent once, with no retry.
Text description
  1. Operator: Create the webhook (uRL and chosen events).
  2. Second: An event happens (for example, a booking is paid).
  3. Second: Send the message (jSON POST, one attempt only).
  4. Your application: Acknowledge receipt (fast 2xx response). Failure: error shown in the history.
  5. Your application: Read the data again (through the API, with an OAuth2 token).
  6. Operator: Check the history (kept for 7 days by default).

Which events are available?

Event When it is sent Data included
user:created An account is created. user
user:deleted An account is deleted. user
listing:created A listing is created. listing
listing:category:updated Listing categories change. none
request:for:proposal:created A request for proposal is published. rfp
booking:created A booking is requested. booking
booking:paid A booking is paid. booking
bid:created A bid answers a request for proposal. bid
bid:paid An accepted bid is paid. bid
menu:updated A site menu is created, edited or deleted. menuId
platform:config:update A marketplace setting changes. name
platform:toggle:update A feature is turned on or off. name
translation:updated An interface text is edited. locale, domain, key, value

The data for a booking, a listing or a user contains the fields the API returns for that resource.

Create a webhook

  1. Open the list of webhooks. In the back office, click Configuration › Webhooks, then Add.
  2. Name the webhook. The Title only helps you recognise it in the list.
  3. Enter the address. In Url, enter the full receiving address.
  4. Choose the events. Under Triggers, tick one or more events from the table above.
  5. Enable and save. Set the Status to Enabled, then click Save.

A Disabled webhook sends nothing and stays in the list. Deleting it, with Delete, is permanent. Webhooks cannot be managed through the API.

What does a message look like?

Second sends a POST request with a JSON body. The event key gives the time of the event (a Unix timestamp, in seconds) and its type. The included data follows, at the same level.

{
  "event": {
    "time": "1764759600",
    "type": "booking:paid"
  },
  "booking": {
    "id": "…",
    "status": "…",
    "start": "…",
    "end": "…"
  }
}

Messages are sent in the background, just after the event. They do not slow the marketplace down.

How do I receive messages properly?

For a reliable integration:

  • Respond quickly. Return a 2xx status as soon as the message arrives, then process it in the background.
  • Read the data again through the API. Treat the message as a signal. Before acting, read the up-to-date resource through the API, with your OAuth2 token.
  • Catch up on gaps. Since nothing is resent, plan a regular synchronisation through the API, for example every night, to recover a lost message.
  • Handle duplicates and disorder. Make processing have no effect if it is replayed, and rely on event.time rather than the order of arrival.
  • Keep the address private. Use an HTTPS address that is hard to guess and ignore messages whose type does not concern you.

Where can I see what was sent?

A webhook's page lists its recent deliveries. For each one: the date sent, the HTTP status returned by your application, the Payload sent, the Response headers and, on failure, the Exception message.

The statuses contained in the data are described in Statuses. Other services connected to the marketplace are covered in Connect third-party services.