Webhooks

Overview

Webhooks are HTTPS calls sent from Audata, to an external endpoint, when a certain action is taken or a record is changed. For example, when a Listener record is updated, you can trigger a request to your app, instead of polling Audata for changes periodically.

Example Webhook Call

Audata Webhooks are HTTPS GET or POST requests. For GET requests, the data is passed as URL parameters, and for POST requests, the data is passed as JSON in the body of the request.

The below is an example of a common POST webhook (in this case, when a Listener is updated).

{
    "event": "Listener.updated",
    "sentAt": "2020-03-18T17:41:56.555+11:00",
    "station": “developerfm",
    "sender_id": 1788495,
    "sender": {
        "id": 1788495,
        "first_name": "John",
        "last_name": "Smith",
        "email": "[email protected]",
        "dob": “1990-07-29",
        "station_id": 10405,
        "gender": "male",
        "address1": "58 Stead St",
        "address2": "",
        "suburb": "South Melbourne",
        "postcode": "3205",
        "created_at": "2020-02-26T09:50:31.759+11:00",
        "updated_at": "2020-03-17T23:02:25.624+11:00",
        "uuid": "34c16742-b5a3-444f-954e-cc245564f86b",
        "phone_number": "0412123123",
        "full_address": “123 Stead St South Melbourne VIC 3205",
        "country": "AU",
        "state": "VIC"
    },
    "webhookCallId": "2ae54ecb-930f-4a7a-974d-d84788d9dd12"
}

The request body contains the following components:

ValueTypeDescription
eventstringA key describing what action has triggered the webhook.

The format for event keys is RecordName.action - for example, Listener.updated or Prize.created.

The supported actions are “created”, “updated”, and “deleted”.
sentAtstringThe time the webhook call was sent as a ISO 8601 string.
stationstringThe unique subdomain of the station that sent the webhook.
sender_idintegerThe ID of the object / record that sent the webhook.
senderdictionaryA JSON dictionary containing the data of the object / record that sent the webhook.
webhookCallIdstringA unique UUID for this webhook call which can be referenced in the webhook logs.

Creating a Webhook

Webhooks can be defined in the Audata application without code.

  1. Open the Administration panel.
  2. Click Webhooks in the admin menu.
  3. Click New Webhook.
  4. Select the Event that will trigger the webhook to be called (for example “Listener.updated” or “Prize.created”).
  5. Enter the Endpoint where you would like the webhook to be sent.
  6. Select whether the webhook should be a HTTPS GET or POST request.
  7. Click Save Webhook.

🚧

NOTE

Webhooks must be sent over HTTPS and the specified endpoint must begin with “https://“. Plain HTTP endpoints will be rejected.