The Transactional SMS Object represents a transactional SMS template in your Go-Mailer account. The API allows you to send or dispatch SMS messages to your users.
Sends the specified transactional SMS to the specified recipients. A recipient does not have to be a contact in your account.
The SMS template's unique code.
The phone number of the recipient. Format should be 234xxxxxxxxx
A unique tracking ID for the SMS message.
A key => value set of information which will be used to replace any placeholders specified in the transactional SMS.
The key should be the name of the placeholder used. e.g: if you used @firstname placeholder in your template, then your data object should look like this { firstname: "Sample Name" }
const response = await fetch("https://api.go-mailer.com/v1/sms", {
method: "POST",
headers: {
Authorization: "Bearer <API_KEY>"
},
body: JSON.stringify({
code: "BIRTHDAY_SMS",
to: "234xxxxxxxxx",
tracking_id: "unique-tracking-id",
context: {
firstname: "John",
age: 47,
}
})
});If you configured a webhook URL in your Go-Mailer account, SMS delivery notifications will be sent to that URL.
The unique ID of the SMS message.
The state of the SMS message. e.g., sent, delivered, failed.
The unique tracking ID supplied when you sent the SMS message.
{
"message_id": "unique-message-id",
"messagestate": "failed",
"tracking_id": "unique-tracking-id"
}