Send a phone system's end-of-call event
Takes the end-of-call event of a phone system as the system sends it, and asks for one survey invitation for the customer on the call, the same way as Send...
POST /v1/triggers/pbx/{vendor}
Takes the end-of-call event of a phone system as the system sends it, and asks for one survey invitation for the customer on the call, the same way as Send a survey trigger. Set-up for each system: Phone systems.
Send no Idempotency-Key: Sayvara makes the key from the system's own call id, so each call gets at most one survey: the same event sent again answers replayed: true, and another leg of the same call (such as a transfer) answers ignored with the reason already_surveyed.
Options in the query string: surveyId, orgUnitId, lang (ar or en), country (SA by default; for numbers without a country code), utcOffset (for systems that send local time), minTalkSeconds and direction (inbound, outbound or both).
A call that gets no survey answers 202 with { "status": "ignored", "reason": "..." }. The reason is one of not_call_end, not_voice, internal, not_answered, too_short, direction_filtered, no_customer_number, invalid_number or already_surveyed. Do not retry these calls.
Once your organisation turns on signed triggers, the body needs a Sayvara-Signature header too. The query string is not part of the signature: a signed request is accepted with the options it was first sent with only.
| Property | Value |
|---|---|
| Authentication | API key or OAuth access token: Authorization: Bearer ... |
| Scope | events.write |
| Success | 202 Accepted |
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
vendor |
enum | Yes | The phone system that sent the event. One of amazon-connect, 3cx, yeastar, asterisk, avaya, webex-cc. |
Request body
Content type: application/json.
{}Response
202 Accepted
| Field | Type | Description |
|---|---|---|
invitationId |
string (uuid) | The id of the queued invitation. With an Idempotency-Key, the same key always gives the same id. |
status |
"queued" |
queued when the invitation is queued. A call that gets no survey answers ignored with a reason instead. |
replayed |
boolean | true when this Idempotency-Key was used before with the same body. Nothing new was queued. |
{
"invitationId": "3f6c1a2e-8b4d-4c7a-9e21-5d0b7f3a9c10",
"status": "queued",
"replayed": false
}Errors
Errors have the body { "code": "...", "message": "...", "requestId": "..." }. See Errors.
| Status | Code | Meaning |
|---|---|---|
| 400 | VALIDATION_FAILED |
The body is not this system's end-of-call event, or a query option is wrong. details names the field. |
| 400 | SURVEY_REQUIRED |
Several surveys are live: add surveyId to the query string. |
| 401 | INVALID_SIGNATURE |
Signed triggers are on, and the Sayvara-Signature is missing, wrong or more than 5 minutes old. |
| 401 | INVALID_API_KEY |
The API key or access token is missing, wrong, revoked or expired. |
| 403 | API_KEY_SCOPE |
The key or token does not hold the scope this operation needs. |
| 403 | IP_NOT_ALLOWED |
An OAuth access token was used from an address outside its client's allow-list. |
| 403 | ENTITLEMENT_REQUIRED |
Your plan does not include API access. |
| 404 | UNKNOWN_PBX_RECIPE |
vendor is not one of the six systems. |
| 404 | SURVEY_NOT_LIVE |
No live survey has this surveyId. |
| 409 | NO_LIVE_SURVEY |
Your organisation has no live survey. |
| 409 | SIGNED_REQUEST_REPLAYED |
This signed request was already used with other options. Sign it again. |
| 429 | RATE_LIMITED |
Too many requests. Wait for the number of seconds in the Retry-After header. |
Example request
curl -X POST "https://api.sayvara.com/v1/triggers/pbx/amazon-connect" \
-H "Authorization: Bearer $SAYVARA_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'Was this page helpful?
Thanks. Need more help? Email support@sayvara.com