Events and Report
Introduction
Events are our way of letting you know when something happens on your account. When an event occurs, we create an Event
object.
Verifying events
It is important to verify that an event originated from Termii.
You can verify an event by validating the signature, a valid event is raised with an header X-Termii-Signature
which is a HMAC SHA512
signature of the event payload signed with your secret key.
Outbound Message (Delivery Report)
An outbound message is a message routed from a client or an application and delivered to the end user's mobile phone. You can receive delivery status report of your messages sent in your application using Termii's Webhook Notification. Add your webhook url in your termii developer console
Request Type :
POST
Content-Type : application/json
Options | Description |
---|---|
type | string Represents the type of message that is sent |
id | string Represents the ID of the request sent |
message_id | string Represents the ID of the message sent |
receiver | string Represents the destination phone number |
sender | string Represents a sender ID for sms or Device ID for Whatsapp which can be Alphanumeric |
message | string Text of a message that would be sent to the destination phone number |
sent_at | string Represents the time the message was sent |
cost | string Represent amount charged for the message sent |
status | string Represents the status of the message sent. A message can have any of the following states; DELIVERED | Message delivered to handset , DND Active on Phone Number , Message Failed |
channel | string This is the route through which the message is sent. It is either dnd, whatsapp, or generic |
Status of messages sent
Status | Description |
---|---|
Delivered | The message has been delivered to the recipient phone number |
DND Active on Phone Number | It means do-not-disturb is active on the recipient's phone number |
Message Sent | This is first state of every message triggered on Termii. It means the message has been sent to the telecom providers, but we are yet to get the delivery report |
Received | This applies to inbound messages when Termii receives an incoming message |
Message Failed | The message failed due to poor network from the recipient's end |
Rejected | It means do-not-disturb is active on the recipient phone number |
Expired | It means that the recipient's device may have been switched off or out of signal for a long period of time, and the networks' validity of the message has expired |
Device offline Notification
You can receive your device offline notification update directly in your application using Termii's Webhook Notiifcation. Add your webhook url in your termii developer console
Request Type :
POST
Content-Type : application/json
Options | Description |
---|---|
type | string Represents the type of request that is sent |
status | string Represents the current status of the device |
device_id | string Represents the ID of the device |
name | string Represents the name of the device |
{
"type":"device_status",
"status":"disconnected",
"device_id":"e0c5a9b-0136-4751-9be9-a3c9zzTc0a19",
"name":"TermiiWh"
}