Python

Errores de webhook

Si los webhooks que ha creado con la función vis/v1/self/webhooks/ o devuelve un 404 o 500, ese webhook se considera desactivado y no verá ninguna carga entrante en él. Puede consultar el estado de todos los webhooks realizando una llamada GET al siguiente endpoint:

https://api.vonage.com/t/vbc.prod/vis/v1/self/webhooks/

Esto devolverá una lista de todos los webhooks que están asociados con su aplicación:

[
 {
 "id": "{}",
 "userId": "{}",
 "accountId": "{}",
 "url": "{}",
 "status": "ACTIVE",
 "events": [
 "CALL"
 ],
 "signingAlgo": "HMAC_SHA256",
 "signingKey": "string",
 "metadataPolicy": "NONE",
 "expireAt": "2030-06-21T11:06:21.038Z",
 "createdAt": "2020-06-23T11:06:21.038Z",
 "purgeAt": "2040-09-16T11:06:21.038Z",
 "statistics": {
 "totalAttempts": 8,
 "totalSuccesses": 5,
 "totalFailures": 3,
 "failed": true,
 "lastSuccess": "2020-06-23T11:28:12.434Z",
 "lastFailure": "2020-06-23T17:21:48.207Z",
 "lastHttpErrorCode": "500 INTERNAL_SERVER_ERROR",
 "lastErrorMessage": "500 INTERNAL SERVER ERROR: [<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n <head>\n <title>NameError: name 'flask' is not defined // Werkzeug Debugger</title>\n... (19777 bytes)]"
 }
 }
]

En el ejemplo anterior, el lastErrorMessage muestra un error al llamar al webhook.

Para recibir eventos al mismo webhook, necesitarás hacer otra petición POST para crear el webhook:

curl --location --request POST 'https://api.vonage.com/t/vbc.prod/vis/v1/self/webhooks/' \ --header 'Authorization: Bearer {ACCESS_TOKEN}' \ --header 'Content-Type: application/json' \ --data-raw '{ "url": "https://{NGROK_URL}/webhook", "events": [ "CALL" ], "signingAlgo": "HMAC_SHA256", "signingKey": "string", "metadataPolicy": "NONE"

A continuación, verá los eventos entrantes después de que el webhook se haya actualizado.

Recepción de eventos de llamada mediante webhooks

Crear un webhook para recibir eventos de llamadas

Disponible en:
JavaScript Python
Pasos
1
Introducción a esta tarea
2
Prerequisites
3
Crear un webhook
4
Crear un servidor local
5
Crear un webhook
6
Limpieza
7
¿Y ahora qué?