All pages

API reference

Create a webhook receiver

POST /v1/webhooks

View as Markdown

A new receiver in one of this key's projects — live for a live key, test for a test key. The address must be public https. At most 10 per project. The signing secret is in this answer and never again. Needs webhooks:write.

Body

Sent as JSON. A field this operation does not take is refused, so a typo fails loudly.

Field Type Required Description
agent_ids array of string (uuid) No Only these agents' conversations. Empty is every agent in the project.
events array of string or null No The events it hears. Leave it out for the defaults: everything but conversation.transcript and form.abandoned.
include_values boolean No Whether events carry the values a conversation started with, your metadata and both phone numbers.
project_id string (uuid) Yes The project whose conversations it hears.
url string Yes Where events are POSTed: a public https address.

Answer

201 with WebhookReceiverWithSecret.

Errors

Every error is a problem document with a stable code.

Status When
401 The key is missing, mistyped, unknown, revoked or expired.
403 The key lacks a permission, a live key was sent from a browser, or the organization is frozen and the request would change something.
404 This key reaches no such project.
409 The project is frozen.
422 The address, an event or an agent does not fit, or the project is full.
429 Too many requests for this key or its organization; see Retry-After.
500 Something went wrong on our side. Quote the request_id to support.

Examples

Create a webhook receiver
#!/bin/sh
# Create a webhook receiver. Keep the secret in the answer: it is shown once.
curl -sS --fail-with-body -X POST "https://api.aigently.ai/v1/webhooks" \
  -H "Authorization: Bearer $AIGENTLY_API_KEY" \
  --json '{
  "project_id": "0b1c2d3e-4f5a-6b7c-8d9e-0f1a2b3c4d5e",
  "url": "https://hooks.aigently.ai/aigently",
  "events": [
    "conversation.ended",
    "conversation.analyzed"
  ]
}'

Try it

Sends this request to the API from your browser, with a test key. Nothing it does rings a phone.