Webhook Payload

A Webhook payload has the following possible attributes:

  • id: 774ae370-02cc-11e7-ac41-c38ce8763025 (string) - The unique ID of the Webhook.
  • event: message.create.contact.form (string) - Event that triggered the webhook.
  • timestamp: 2017-03-07T00:24:45.607Z (string) - ISO8601 date and time of when the webhook post was sent.
  • organization: 5c138790ec944f05ff5f6d77 (string) - Organization owning the resource object.
  • activity: (object) - Activity Stream object.
  • data: (object) - Webhook payload.
  • timestamp: 2018-12-20T01:46:56.003Z (string) - Timestamp of the event.

The data property contains one or more resources related to the event. Additionally, the data.links object containing API URLs to primary resources (organization, conversation, message, contact and user) if relevant to the event.

Payload Example: Chat Message (with activity expanded)

An example of a webhook payload for a chat message in a contact conversation looks like this:

        {
            "id": "774ae370-02cc-11e7-ac41-c38ce8763025",
            "timestamp": "2018-12-19T19:09:01Z",
            "event": "message.create.contact.chat",
            "organization": "5c138790ec944f05ff5f6d77",
            "activity": {
                "@context": "https://www.w3.org/ns/activitystreams",
                "type": "Create",
                "actor": {
                    "id": "https://api.web1on1.chat/v2/users/5c1a99e410419f5fb88cb5f2",
                    "type": "Person"
                },
                "object": {
                    "id": "https://api.web1on1.chat/v2/messages/5c1a974dabcdb128d0e90e93",
                    "type": "Object"
                },
                "published": "2018-12-19T19:09:01Z",
                "summary": "User Jenny Jones created a chat message"
            },
            "data": {
                "conversation": { ...conversation object...},
                "message": { ...message object... },
                "links": { ...links to resources ... }
            }
        }

Payload Example: Results Message (with message expanded)

Whenever an agent or a bot submits a form, a results type message gets created in the conversation. An example of a payload (with less relevant properties left out for readability) could looks like this:

        {
            "id": "774ae370-02cc-11e7-ac41-c38ce8763025",
            "timestamp": "2018-12-19T19:09:01Z",
            "event": "message.create.contact.chat",
            "organization": "5c138790ec944f05ff5f6d77",
            "activity": { ...activity object...},
            "data": {
                "conversation": {
                    "results": [
                        {
                            "name": "Afgehandeld",
                            "form": "5da1fa1065dec0702de53a1d",
                            "labels": [],
                            "category": "Used Car",
                            "categoryIndex": 0,
                            "message": "60d0e4516d629018e4b80e7d"
                        }
                    ],
                    ...rest of conversation object...
                },
                "message": {
                    "type": "results",
                    "text": "Results",
                    "results": [
                        {
                            "form": "5e55c41062b4710705e1afd0",
                            "name": "Custom Data Attributes",
                            "labels": [],
                            "state": "completed",
                            "type": "static",
                            "categoryIndices": [],
                            "values": {
                                "location": "5f39b8eaedcd6164a4705a84"
                            },
                            "displayValues": {
                                "location": "Amstelhoek, Amstelkade"
                            }
                        },
                        {
                            "name": "Afgehandeld",
                            "form": "5da1fa1065dec0702de53a1d",
                            "labels": [],
                            "state": "completed",
                            "type": "topic",
                            "values": {
                                "afgehandeld": "ok"
                            },
                            "displayValues": {
                                "afgehandeld": "ok"
                            },
                            "category": "Used Car",
                            "categoryIndex": 0,
                            "meta": {
                                "invoiced": "yes",
                                "islead": "no",
                                "leadconnector": "no_follow_up",
                                "points": "10"
                            }
                        }
                    ],
                    "points": 10,
                    ...rest of message...
                },
                "links": { ...links to resources ... }
            }
        }