Skip to content

Create Webhook Subscription

Request

Security
Bearer
Bodyapplication/jsonrequired
subscriberIdstring, (uuid)required

UUID of the company that owns this webhook subscription.

eventSourceobject(EventSource)

Defines the scope of source companies whose events this subscription will receive. If not provided, defaults to a COMPANY scope targeting the subscriberId.

namestring

Optional human-readable display name for the subscription. If not provided, a default name will be assigned.

eventTypesArray of strings, non-emptyrequired

List of event types this subscription should receive. At least one is required.

urlstring, (uri)required

HTTPS endpoint that Spotnana will POST event payloads to. Must use the https scheme and accept POST requests.

isActiveboolean

Whether the subscription is active. When false, the subscription is preserved but incoming events will not be matched against it and no deliveries will be made.

Default:true
customHeadersobject

Additional HTTP headers to include on every webhook request sent to url. Provided as a map of header name to header value. Reserved headers managed by Spotnana (such as Authorization and Content-Type) will override any values supplied here.

Example:
{ "X-Custom-Header": "my-value", "Authorization-Extra": "token123" }
curl -i -X POST \
  https://api-ext-sboxmeta.partners.spotnana.com/v3/webhooks/subscriptions \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "subscriberId": "96d0a1b8-7f77-4d5c-847e-2afd90ed23b3",
    "eventSource": {
      "scopes": [
        {
          "predicates": [
            {
              "type": "COMPANY",
              "values": [
                "497f6eca-6276-4993-bfeb-53cbbbba6f08"
              ],
              "comparator": "IN"
            }
          ]
        }
      ]
    },
    "name": "string",
    "eventTypes": [
      "TRAVELER_V2"
    ],
    "url": "http://example.com",
    "isActive": true,
    "customHeaders": {
      "X-Custom-Header": "my-value",
      "Authorization-Extra": "token123"
    }
  }'

Responses

Successful Webhook Subscription Response

Bodyapplication/json
idstring, (uuid)required

UUID of the newly created webhook subscription.

hmacSigningSecretstring

Secret used to verify the HMAC-SHA256 signature on incoming webhook requests. Returned only once, at subscription creation, and cannot be retrieved later. Store it securely.

createdAtobject(Date)required

Timestamp at which the subscription was created.

Response
{ "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "hmacSigningSecret": "string", "createdAt": { "iso8601": "2017-07-21" } }