Webhook

The following JSON represents a typical Webhook. It is referred to throughout this document as Webhook:

{
    "id": "layer:///apps/082d4684-0992-11e5-a6c0-1697f925ec7b/webhooks/f5ef2b54-0991-11e5-a6c0-1697f925ec7b",
    "url": "https://api.layer.com/apps/082d4684-0992-11e5-a6c0-1697f925ec7b/webhooks/f5ef2b54-0991-11e5-a6c0-1697f925ec7b",
    "version": "3.0",
    "target_url": "https://server.example.com/layeruser/foo",
    "events": [
        "Conversation.created",
        "Message.created"
    ],
    "status": "active",
    "created_at": "2015-03-14T13:37:27Z",
    "config": {
        "key1": "value1",
        "key2": "value2"
    }
}
Name Type Description
id string Layer ID to identify the Webhook
url string URL for accessing the Webhook via the REST API
version string What version of the API are your webhooks configured for
target_url string URL to POST new events
events string[] Array of event names your webhook is listening for such as “Message.created”, “Conversation.created”
status string Is your webhook “active”, “inactive”, or “unverified”
created_at string Date that the Webhook was created, eg 2014-09-09T04:44:47+00:00
config object Custom data you’ve configured to be sent with each webhook event

The id property

An ID consists of a prefix of layer:///webhooks/ followed by a UUID. This ID format is common across all of the Layer Platform.

The url property

The url property specifies how to retrieve, update or delete the Webhook via the REST API.

The version property

Different versions of the Webhook API may use different formats for sending events to your server. Knowing what version your webhook is using tells you what format to expect.

The events property

A webhook can be configured to be notified of any selection of event types that your server is interested in. Specify the set as an array of strings.

The status property

The status is the state of your webhook, one of:

  • “active”
  • “inactive”
  • “unverified”

The created_at property

An ISO 8601 formatted date/time string indicating when the Webhook was created on the server, such as 2014-09-09T04:44:47+00:00

The config property

You may want to pass a config object with each webhook event to identify this Webhook, the app that generated it, or other types of information you want to track about your webhook. The config can be set when creating the Webhook, and each event will send this object along with the event data.