Track SMS
This guide shows how to retrieve the current status of an individual message using the REST API.
Track SMS code
var loginCredentials = new EsendexCredentials("YourUsername", "YourApiPassword");
var sentMessageService = new com.esendex.sdk.sent.SentService(credentials);
var message = test.GetMessage(new Guid('esendexmessageid'));
Console.WriteLine(message.Status);
$authentication = new \Esendex\Authentication\LoginAuthentication(
"EX000000", // Your Esendex Account Reference
"user@example.com", // Your login email address
"api-password" // Your API password
);
$headerService = new \Esendex\MessageHeaderService($authentication);
$message = $headerService->message("messageId");
print_r($message->status());
UserPassword userPassword = new UserPassword("YourUsername","YourApiPassword");
BasicServiceFactory serviceFactory = ServiceFactory.createBasicAuthenticatingFactory(userPassword);
SentService sentService = serviceFactory.getSentService();
try{
response = sentService.getMessage("3b8314b8-1a28-4e88-8b5c-175b11037dd2");
}catch(Exception e){
e.getStackTrace();
}
var config = require('./config'),
esendex = require('../')(config);
esendex.messages.get({ id: messageheader.id }, function (err, message) {
if (err) return console.log(err);
client := New("user@example.com", "api-password")
response, err := client.Message("45e1bc74-2e0f-4141-bda5-bb7fdbb4feff")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%v %s: %s\n", response.SubmittedAt, response.To, response.Summary)
These examples require the SDKs
You will need:
- Your Esendex account reference (EX0xxxxxx), username and API password.
- Don't have an account yet? You'll need to create an account.
- Need an API password? You can generate one on your user profile.
- The ID of the message you wish to track.
What you might want to do with the response
- Save the response against the action that triggered your system to send a message.
What else you might want to do
- Check the status of all the messages in the batch you sent.
What you might want to do next
- Repeat this call again later if the message hasn’t been delivered.
- Check for a reply to your message.