This section explains how the Chat software supports using webhooks with the device. A basic understanding of webhooks and programming skills is required.
Important: The device must be connected to Wi-Fi to use webhooks.
Terms Used in This Section
Term | Meaning |
|---|---|
webhook | A webhook is an event that triggers an action. |
webhook service/ provider | A webhook service is a web application for retrieving and storing data from a certain event. |
webhook event | A webhook event is a web request via a URL that can contain additional information needed by the webhook service/provider. There are two parts to a webhook event: (1) the URL and (2) the payload in JSON format. The event is the piece that the Chat software sends. Event example: Create a document |
URL | A URL is a website address. For webhooks, a URL is the address sent to trigger an event. Webhooks use the http protocol to communicate with the webhook service/provider. |
payload | Additional instructions can be sent with the URL to perform the event. These additional instructions are referred to as a payload. Note: Not all events need a payload. Payload examples: Add content to your document (see “webhook event” above); format the content The webhook service/provider defines the payload. Here's what a small portion of a payload looks like when it's delivered to a webhook service: { "event_id": "LtWXD3crgy", "event_type": "form_response", "form_response": { "form_id": "lT4Z3j", "token": "a3a12ec67a1365927098a606107fac15", "submitted_at": "2018-01-18T18:17:02Z", |
JSON | Webhooks must deliver responses (payloads) in JSON format, a language used by programmers. The Chat software provides an interface for these responses. The example under “payload” above is in JSON format. |
placeholder | To simplify creating payloads, the Chat software provides two placeholders: (1) The content of the Speech Display Bar and (2) The button message (shown in the Message box, not the Label box). Placeholders must appear in these formats: ${SDB} and ${MESSAGE} The placeholders are not required. You can use either, both, or neither. |
Adding a Webhook Event
You can create as many webhook buttons as you want, but you can only specify one URL for each button.
Examples of webhook events: send the latest weather report to your device; trigger a payment; send an alert when something happens; turn on a light; open a door; set a thermostat; operate a smart home device
Note: You can simplify programming webhooks by using ChatEditor, especially copying and pasting URLs and entering data in JSON format.
Select Menu > Edit Mode.
Select and hold the button to which you want to add the webhook event.
Select Edit Button.
Add a label and/or a message and image.
Select the Actions tab.
Select the dropdown menu
to open a list of actions.Select Webhook. A keyboard with a URL prompt opens.
Enter the URL. This can be copied from the webhook service/provider site.
If your event requires a payload, tap below JSON and enter the data in JSON format that you want to send from the button.
Note: Chat software provides two placeholders: (1) The content of the Speech Display Bar and (2) The message [in the Message box] contained on the button. The placeholders must appear as follows: ${SDB} and ${MESSAGE}
Select Save.
Make sure you have an active Wi-Fi connection and choose the button you created.