Webhook Data Format

When a webhook is triggered, the data received is in the following format:

Method: POST
Headers: "Content-Type: application/json", "Contentstack-Signature:9876543210"
Body: {
  "event": "string",
  "module": "string",
  "api_key": "string",
  "data": "object"
}

Details of the POST call's 'Body' keys:

event

One of these [create, update, delete, publish, publish.start, publish.success, publish.fail, unpublish, unpublish.start, unpublish.success, unpublish.fail]

module

One of these [content types, entry, asset, release]

api_key

The API key of the stack

data

Response object

    Examples

    Here’s an example of a response object attached to the POST body when trying to update an existing entry in a content type.

    {
      "module": "entry",
      "api_key": "blt22222e2222222222",
      "data": {
        "entry": {
          "title": "Webhook Entry",
          "url": "/webhook-entry",
          "locale": "en-us",
          "uid": "bltfe99999fa999b9a9",
          "created_by": "bltcb333333df3d3333",
          "updated_by": "bltcb333333df3d3333",
          "created_at": "2019-03-08T08:57:47.737Z",
          "updated_at": "2019-03-08T08:58:07.560Z",
          "ACL": {},
          "_version": 2,
          "tags": []
        },
        "content_type": {
          "created_at": "2019-03-08T08:57:38.993Z",
          "created_by": "bltcb333333df3d3333",
          "updated_at": "2019-03-08T08:57:38.993Z",
          "updated_by": "bltcb333333df3d3333",
          "title": "Webhook created",
          "uid": "webhookcreated",
          "description": "",
          "schema": [
            {
              "display_name": "Title",
              "uid": "title",
              "data_type": "text",
              "field_metadata": {
                "_default": true
              },
              "unique": true,
              "mandatory": true,
              "multiple": false
            },
            {
              "display_name": "Webhook created",
              "uid": "url",
              "data_type": "text",
              "field_metadata": {
                "_default": true
              },
              "unique": false,
              "mandatory": false,
              "multiple": false
            }
          ],
          "options": {
            "title": "title",
            "singleton": false,
            "publishable": true,
            "is_page": true,
            "sub_title": [],
            "url_pattern": "/:title",
            "url_prefix": "/"
          }
        }
      },
      "event": "update",
      "triggered_at": "2019-03-08T08:58:07.725Z"
    }
    

    Here’s an example of a response object attached to the POST body when an asset is published successfully on an environment.

    {
      "module": "asset",
      "api_key": "blt22222e2222222222",
      "data": {
        "asset": {
          "uid": "blt1c1eb111111a1d11",
          "created_at": "2019-03-08T09:04:25.377Z",
          "updated_at": "2019-03-08T09:04:25.377Z",
          "created_by": "bltcb222222df2d2222",
          "updated_by": "bltcb222222df2d2222",
          "content_type": "image/png",
          "file_size": "560",
          "tags": [],
          "filename": "image.png",
          "url": "your_asset_URL",
          "ACL": {},
          "is_dir": false,
          "parent_uid": null,
          "_version": 1,
          "title": "image.png",
          "description": "",
          "publish_details": [
            {
              "environment": "blt3c3b333ae3333333",
              "locale": "en-us",
              "time": "2019-03-08T09:04:43.921Z",
              "user": "bltcb222222df2d2222",
              "version": 1
            }
          ]
        },
        "environment": {
          "name": "blank",
          "servers": [],
          "urls": [],
          "deploy_content": false,
          "uid": "blt5c5b555ae5555555",
          "created_by": "bltcb222222df2d2222",
          "updated_by": "bltcb222222df2d2222",
          "created_at": "2019-03-08T08:53:46.157Z",
          "updated_at": "2019-03-08T08:53:46.157Z",
          "ACL": [],
          "_version": 1
        },
        "action": "publish",
        "status": "success",
        "locale": "en-us"
      },
      "event": "publish",
      "triggered_at": "2019-03-08T09:04:53.444Z"
    }
    

    Here's an example of a response object attached to the POST body when an entry is published successfully on an environment

    {
        "event": "publish",
        "source": {
            "type": "release"
            "title": "Release01",
            "uid": "blt2f22e2222222e111"
        },
        "data": {
            "entry": {
                ...
            }
        },
        "api_key": "blt3333d3ad333beedc",
        "module": "entry",
        "triggered_at": "2019-03-06T05:34:44.876Z"
    }

    Here's an example of a response object attached to the POST body when an asset is published successfully on an environment

    {
        "event": "publish",
        "source": {
            "type": "release"
            "title": "Release02",
            "uid": "blt2f22e2222222e111"
        },
        "data": {
            "asset": {
                ...
            }
        },
        "api_key": "blt3333d3ad333beedc",
        "module": "asset",
        "triggered_at": "2019-03-06T05:34:44.876Z"
    }

    Lastly, here's an example of a response object attached to the POST body when a release has been deployed successfully.

    {
      "module": "release",
      "api_key": "blt111c11e111111b11",
      "data": {
        "release": {
          "name": "Webhook-Release",
          "description": "Release 08-03-2019",
          "locked": true,
          "items": [
            {
              "uid": "bltf0df0ea0a0000001",
              "version": 1,
              "action": "publish",
              "content_type_uid": "content_type",
              "locale": "en-us",
              "title": "Entry1"
            },
            {
              "uid": "bltf0df0ea0a0000002",
              "version": 1,
              "action": "publish",
              "content_type_uid": "content_type",
              "locale": "en-us",
              "title": "Entry2"
            },
            {
              "uid": "bltf0df0ea0a0000333",
              "version": 1,
              "action": "publish",
              "content_type_uid": "built_io_upload",
              "locale": "en-us",
              "title": "Image1.png"
            },
            {
              "uid": "bltf0df0ea0a0000444",
              "version": 1,
              "action": "publish",
              "content_type_uid": "built_io_upload",
              "locale": "en-us",
              "title": "Image2.png"
            }
          ],
          "uid": "blt2f22e2222222e111",
          "created_by": "blt123cdeced1231e23",
          "updated_by": "blt123cdeced1231e23",
          "created_at": "2019-03-08T09:25:24.165Z",
          "updated_at": "2019-03-08T09:25:32.278Z",
          "status": [
            {
              "environment": "blt3c333333c33d3a33",
              "time": "2019-03-08T09:25:32.235Z",
              "status": "success",
              "user": "blt123cdeced1231e23"
            }
          ]
        },
        "environment": {
          "deploy_content": false,
          "servers": [],
          "urls": [
            {
              "url": "",
              "locale": "en-us"
            }
          ],
          "name": "production",
          "uid": "blt3c333333c33d3a33",
          "created_by": "blt123cdeced1231e23",
          "updated_by": "blt123cdeced1231e23",
          "created_at": "2019-03-08T09:22:35.779Z",
          "updated_at": "2019-03-08T09:22:35.779Z",
          "ACL": [],
          "_version": 1
        },
        "action": "deploy",
        "status": "success"
      },
      "event": "deploy",
      "triggered_at": "2019-03-08T09:25:32.518Z"
    }

    Was this article helpful?

    Thanks for your feedbackSmile-icon

    On This Page

    top-arrow