Object (JSON Object) change events
Triggers when certain objects (docs) in the database are created, modified, or deleted.
Info
- Event name: object
- Friendly name: Object
Modifiers
To restrict the kind of document or the action or both, you can set the custom data to:
- type: A list of object types to handle:
account
call_recording
callflow
device
fax
faxbox
mailbox_message
media
user
vmbox
- action: A list of object actions to handle:
doc_created
doc_deleted
doc_edited
Samples
type
and action
fields reflect the selected modifiers above:
{
"id": "c4c0ad092e57bc1d28e69bbd20dad932",
"account_id": "0e10f9365fb2383d0fa65e907bfe4cb3",
"action": "doc_created",
"type": "user"
}
Include Document Data
v2 Hook
Document data and metadata is included in the v2
Webhook. To use v2 hooks,
set the version
of the hook to v2
using the
Webhooks API.
v2
object hooks also include some document metadata similar to what the API responds with after
a document update request.
{
"action": "event",
"name": "doc_created",
"type": "user",
"is_soft_deleted": false,
"account_id": "c7612246de30adab3a1371274297eff7",
"database": "account%2Fc7%2F61%2F2246de30adab3a1371274297eff7",
"id": "a60063fda11c56b8a150761a1a8e67fd",
"event_name": ...
"event_category": ...
"timestamp": "63907712980"
"data": {
"metadata": {
"created": "63907712980",
"modified": ...
... //Additional metadata when it would be present in a response from the REST API
},
"doc": {
// public fields of the modified doc.
}
}
}
System Config
It is also possible to include data from the document on the webhook via system_config.
In the webhooks.object
document, set include_fields.{DOC_TYPE}
to the list of JSON keys to read from the document.
For instance, if you want to include a user”s first/last name, set "include_fields.user":["first_name", "last_name"]
.
The webhook payload received will then look something like:
id={USER_ID}&account_id={ACCOUNT_ID}&action=doc_created&type=user&last_name={LAST_NAME}&first_name={FIRST_NAME}&cluster_id={CLUSTER_ID}