<!--This code is formatted to be read easily, it must be a single line when run from the terminal-->
<!--Generate an API password here first: https://www.esendex.com/profile-->
curl -H "Content-type: application/xml" -H "Authorization: Basic base64UsernameAndApiPassword" -d "
<?xml version='1.0' encoding='UTF-8'?>
<messages>
<accountreference>EX0000000</accountreference>
<message>
<to>447700900123</to>
<body>Every message matters</body>
</message>
</messages>
" https://api.esendex.com/v1.0/messagedispatcher
/* Requires C# SDK */
/* Generate an API password here first: https://www.esendex.com/profile */
var messagingService = new MessagingService("username", "api-password");
messagingService.SendMessage(new SmsMessage("07123456789", "Hello!", "accountRef"));
/* Requires PHP SDK */
/* Generate an API password here first: https://www.esendex.com/profile */
$message = new \Esendex\Model\DispatchMessage(
"WebApp", /* Send from */
"01234567890", /* Send to any valid number */
"My Web App is SMS enabled!",
\Esendex\Model\Message::SmsType
);
$authentication = new \Esendex\Authentication\LoginAuthentication(
"EX000000", /* Your Esendex Account Reference */
"user@example.com", /* Your login email address */
"api-password" /* Your generated API password */
);
$service = new \Esendex\DispatchService($authentication);
$result = $service->send($message);
print $result->id();
print $result->uri();
/* Requires Java SDK */
/* Generate an API password here first: https://www.esendex.com/profile */
U
serPassword userPassword = new UserPassword("YourUsername","YourApiPassword");
BasicServiceFactory serviceFactory = ServiceFactory.createBasicAuthenticatingFactory(userPassword);
MessagingService messagingService = serviceFactory.getMessagingService();
SmsMessageRequest message = new SmsMessageRequest("RecipientNumber", "YourMessage");
MessageResultResponse response;
try{
response = messagingService.sendMessage("YourAccountReference", message);
}catch(Exception e){
e.getStackTrace();
}
#Requires the Ruby SDK
#Generate an API password here first: https://www.esendex.com/profile
#Then insert the following code in a file (eg. esendex.rb) in the configs/initializers.
Esendex.configure do |config|
config.username = "<username>"
config.password = "<api-password>"
config.account_reference = "<account_reference>"
end
#Insert the following code in a function.
account = Account.new
batch_id = account.send_message( to: "RecipientNumber", body: "YourMessage")
//Requires the Node.js SDK
var config = require('./config'),
esendex = require('../')(config);
var messages = {
accountreference: config.accountreference,
message: [{
to: "07896563254",
body: "Every message matters!"
}]
};
esendex.messages.send(messages, function (err, response) {
if (err) return console.log('error: ', err);
console.dir(response);
});
//Requires the GoLang SDK
//Generate an API password here first: https://www.esendex.com/profile
accountClient := New("user@example.com", "api-password").Account("EX00000")
accountClient.Send([]Message{
{To: "00000000", Body: "Hello"},
})