Webhooks
SeguridadAl configurar puntos finales de webhook, puede proteger su aplicación contra solicitudes no deseadas configurando el secreto del webhook. Cada firma de solicitud se crea utilizando el algoritmo hash HMAC_SHA256. El algoritmo firma la carga útil del webhook con el secreto que usted proporcionó. El hash resultante se incluye en el encabezado de la firma de la solicitud en el siguiente formato:
X-TopMessage-Signature: {TOPMESSAGE_HMAC_SIGNATURE}
Administre sus puntos finales de webhook
aquí
Recibir informe de entrega
El informe de entrega de los mensajes salientes se envía a su punto final de webhook, indicando si cada mensaje se entregó correctamente o falló.
Nombre | Amable | Descripción |
---|---|---|
data | object | Contiene los siguientes detalles del mensaje que se envía. |
Objeto de datos
Nombre | Amable | Descripción |
---|---|---|
id | string | Identificador único de su mensaje. |
status | string | Estado inicial de su mensaje. Valores posibles: PENDING , FAILED , DELIVERED , SEEN |
channel | string | El canal de comunicación envía su mensaje. Valores posibles: SMS y WHATSAPP Por defecto: SMS |
Recibir mensaje entrante
Los mensajes entrantes recibidos en su número de teléfono SMS o WhatsApp se reenvían en tiempo real al punto final del webhook especificado.
Nombre | Amable | Descripción |
---|---|---|
data | object | Contiene los siguientes detalles del mensaje que se envía. |
Objeto de datos
Nombre | Amable | Descripción |
---|---|---|
account_id | string | Identificador único de su cuenta. |
from | string | El/los número(s) de teléfono móvil del remitente en formato internacional. |
sender_code | string | Tu número de teléfono TopMessage SMS o WhatsApp. |
text | string | Su mensaje de texto se enviará a los destinatarios. |
channel | string | El canal de comunicación envía su mensaje. Valores posibles: SMS y WHATSAPP Por defecto: SMS |
to | string | Tu nombre de remitente de SMS o WhatsApp de TopMessage. Puedes consultar los nombres disponibles o crear uno nuevo en la página de remitentes.Ir a la página de remitentes. |
request_id | string | Identificador único de solicitud generada por usted para rastrear solicitudes. Por defecto: NULL |
POST
https://{yourDomain}/your/webhook/path
X-Topmessage-Signature: {TOPMESSAGE_HMAC_SIGNATURE}
Content-Type: application/json
Solicitar muestra (informe de entrega)
Payload
Java
Python
{
"data":
{
"id":"b04fc4d3-f232-46b7-b66b-538c0d4b3404",
"channel":"SMS",
"status":"DELIVERED"
}
}
public class TopMessageDeliveryReport {
private String id;
private String requestId;
private String channel;
private String status;
}
class TopMessageDeliveryReport:
id: str
request_id: str
channel: str
status: str
Solicitar muestra (mensaje entrante)
Payload
Java
Python
{
"data": {
"id":"e3fc3b55-807f-41cf-93cf-cd365fef8515",
"channel":"WHATSAPP",
"account_id":"0d1f7f1c-27df-41bf-8bdc-5666608a4285",
"sender_details":
{
"sender_id":"476c7381-ca60-4e98-9657-a4af98ec032b",
"sender_name":"TopMessage",
"sender_code":"19134216816"},
"Number":"491511234567",
"text":"Received"
}
}
}
public class TopMessageIncomingMessage {
private String id;
private String channel;
private String accountId;
private SenderDetails senderDetails;
private String number;
private String referenceMessageId;
private String text;
private String mediaId;
private Location location;
public static class SenderDetails {
private String id;
private String name;
private String code;
}
public static class Location {
private String name;
private String address;
private String latitude;
private String longitude;
}
}
class SenderDetails:
id: str
name: str
code: str
class Location:
name: str
address: str
latitude: str
longitude: str
class TopMessageIncomingMessage:
id: str
channel: str
account_id: str
sender_details: SenderDetails
number: str
reference_message_id: str
text: str
media_id: str
location: Location