rooms:
living_room: 'true'
kitchen: 'false'
study_room:
- size: 20x30
- desk: true
- lights: 'On'
Webhooks
Webhooks are user-defined HTTP callbacks. A webhook
is triggered by an event, such as pushing code to a
repository or typing a keyword in a chat window. An
application implementing webhooks sends a POST
message to a URL when a specific event happens.
Webhooks are also referred to as reverse APIs, but
perhaps more accurately, a webhook lets you skip the
request step in the request/response cycle. No request is
required for a webhook, and a webhook sends data when
triggered.
For security reasons, the REST service may perform
some validation to determine whether the receiver is
valid. A simple validation handshake performs
validation, but this is just one way of validating.
The validation token is a unique token specified by the
server. Validation tokens can be generated or revoked on
the server side through the configuration UI. When the
server sends data to a webhook URL, it includes a
validation token in the request HTTP header. The
webhook URL should consist of the same validation
token value in the HTTP response header. In this way,
the server knows that it is sending to a validated
endpoint and not a rogue endpoint. Figure 7-10
illustrates the flow of webhooks.