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

OptionsDescription
typestring
Represents the type of message that is sent
idstring
Represents the ID of the request sent
message_idstring
Represents the ID of the message sent
receiverstring
Represents the destination phone number
senderstring
Represents a sender ID for sms or Device ID for Whatsapp which can be Alphanumeric
messagestring
Text of a message that would be sent to the destination phone number
sent_atstring
Represents the time the message was sent
coststring
Represent amount charged for the message sent
statusstring
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
channelstring
This is the route through which the message is sent. It is either dnd, whatsapp, or generic

Status of messages sent

StatusDescription
DeliveredThe message has been delivered to the recipient phone number
DND Active on Phone NumberIt means do-not-disturb is active on the recipient's phone number
Message SentThis 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
ReceivedThis applies to inbound messages when Termii receives an incoming message
Message FailedThe message failed due to poor network from the recipient's end
RejectedIt means do-not-disturb is active on the recipient phone number
ExpiredIt 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

OptionsDescription
typestring
Represents the type of request that is sent
statusstring
Represents the current status of the device
device_idstring
Represents the ID of the device
namestring
Represents the name of the device
{  
   "type":"device_status",
   "status":"disconnected",
   "device_id":"e0c5a9b-0136-4751-9be9-a3c9zzTc0a19",
   "name":"TermiiWh"
}           
Updated at, Wednesday, May 22, 2024