curl --request POST \
--url https://app.yampi.ai/api/v1/accounts/{account_id}/webhooks \
--header 'Content-Type: application/json' \
--header 'api_access_token: <api-key>' \
--data '
{
"url": "https://example.com/webhook",
"name": "<string>",
"subscriptions": [
"conversation_created",
"conversation_status_changed"
]
}
'const options = {
method: 'POST',
headers: {api_access_token: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://example.com/webhook',
name: '<string>',
subscriptions: ['conversation_created', 'conversation_status_changed']
})
};
fetch('https://app.yampi.ai/api/v1/accounts/{account_id}/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.yampi.ai/api/v1/accounts/{account_id}/webhooks"
payload = {
"url": "https://example.com/webhook",
"name": "<string>",
"subscriptions": ["conversation_created", "conversation_status_changed"]
}
headers = {
"api_access_token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": 123,
"url": "<string>",
"name": "<string>",
"subscriptions": [
"conversation_created"
],
"secret": "<string>",
"account_id": 123
}{
"description": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
}Add a webhook
Add a webhook subscription to the account
curl --request POST \
--url https://app.yampi.ai/api/v1/accounts/{account_id}/webhooks \
--header 'Content-Type: application/json' \
--header 'api_access_token: <api-key>' \
--data '
{
"url": "https://example.com/webhook",
"name": "<string>",
"subscriptions": [
"conversation_created",
"conversation_status_changed"
]
}
'const options = {
method: 'POST',
headers: {api_access_token: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://example.com/webhook',
name: '<string>',
subscriptions: ['conversation_created', 'conversation_status_changed']
})
};
fetch('https://app.yampi.ai/api/v1/accounts/{account_id}/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.yampi.ai/api/v1/accounts/{account_id}/webhooks"
payload = {
"url": "https://example.com/webhook",
"name": "<string>",
"subscriptions": ["conversation_created", "conversation_status_changed"]
}
headers = {
"api_access_token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": 123,
"url": "<string>",
"name": "<string>",
"subscriptions": [
"conversation_created"
],
"secret": "<string>",
"account_id": 123
}{
"description": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
}Authorizations
Token de usuario. Envía el valor en el header api_access_token. Lo obtienes en el perfil (GET /api/v1/profile) o al regenerarlo.
Path Parameters
The numeric ID of the account
Body
The url where the events should be sent
"https://example.com/webhook"
The name of the webhook
The events you want to subscribe to.
conversation_created, conversation_status_changed, conversation_updated, message_created, message_updated, contact_created, contact_updated, webwidget_triggered, conversation_typing_on, conversation_typing_off [
"conversation_created",
"conversation_status_changed"
]
Response
Success
The ID of the webhook
The url to which the events will be send
The name of the webhook
The list of subscribed events
conversation_created, conversation_status_changed, conversation_updated, contact_created, contact_updated, message_created, message_updated, webwidget_triggered, conversation_typing_on, conversation_typing_off Secret used to sign webhook requests. Signed webhook deliveries include X-Yampi-Timestamp and X-Yampi-Signature; the signature is sha256= followed by the HMAC-SHA256 of {timestamp}.{raw_request_body} using this secret. Deliveries also include X-Yampi-Delivery when a delivery id is available.
The id of the account which the webhook object belongs to