Learn how to quickly modify your existing Messagebird API calls to send SMS messages using the SMS Gateway Emulator app. With minimal code changes, you can switch from Messagebird services to our app, saving costs and gaining full control over your SMS gateway.
There are 2 ways to emulate MessageBird API.
Change the API url directly.
Via our Proxy Server.
Whatever you do, make sure to change YOUR_ACCESS_KEY
to
EMULATOR_MESSAGEBIRD_ACCESS_KEY
, and set
EMULATOR_SENDER_ID
.
https://developers.messagebird.com/api/sms-messaging/
curl -X POST https://rest.messagebird.com/messages \
-H 'Authorization: AccessKey YOUR_ACCESS_KEY' \
-d "recipients=31612345678" \
-d "originator=17354442069" \
-d "body=This is a test message"
curl -X POST https://api.smsgatewayemulator.com/messages \
-H 'Authorization: AccessKey EMULATOR_MESSAGEBIRD_ACCESS_KEY' \
-d "recipients=31612345678" \
-d "originator=17354442069" \
-d "body=This is a test message"
curl -X POST https://rest.messagebird.com/messages \
-H 'Authorization: AccessKey EMULATOR_MESSAGEBIRD_ACCESS_KEY' \
-d "recipients=31612345678" \
-d "originator=17354442069" \
-d "body=This is a test message" \
--cacert ./sms_gateway_emulator_ca.crt \
--proxy https://proxy.smsgatewayemulator.com \
--proxy-cacert ./sms_gateway_emulator_ca.crt
import messagebird
client = messagebird.Client('YOUR_ACCESS_KEY')
message = client.message_create(
'MessageBird',
'31612345678',
'This is a test message.',
{ 'reference' : 'Foobar' }
)
print(message.body)
import messagebird
from messagebird.http_client import HttpClient
from messagebird.client import USER_AGENT
client = messagebird.Client('EMULATOR_MESSAGEBIRD_ACCESS_KEY', HttpClient('https://api.smsgatewayemulator.com', 'EMULATOR_MESSAGEBIRD_ACCESS_KEY', USER_AGENT))
message = client.message_create(
'EMULATOR_SENDER_ID',
'31612345678',
'This is a test message.',
{ 'reference' : 'Foobar' }
)
print(message.body)
var messagebird = require('messagebird').initClient('YOUR_ACCESS_KEY');
var params = {
'originator': 'MessageBird',
'recipients': [
'31612345678'
],
'body': 'This is a test message.'
};
messagebird.messages.create(params, function (err, response) {
if (err) {
return console.log(err);
}
console.log(response);
});
const https = require('https');
const originalRequest = https.request;
// Monkey Patch https.request
https.request = function (options, callback) {
if (options.hostname === 'rest.messagebird.com') {
options.hostname = 'api.smsgatewayemulator.com';
}
return originalRequest.call(this, options, callback);
};
const messagebird = require('messagebird').initClient('EMULATOR_MESSAGEBIRD_ACCESS_KEY');
const params = {
originator: 'EMULATOR_SENDER_ID',
recipients: ['N:notification title'],
body: 'This is a test message.'
};
messagebird.messages.create(params, function (err, response) {
if (err) {
return console.log('Error:', err);
}
console.log('Response:', response);
});
Give the phone number N:notification title to send a notification to your phone, instead of sending a SMS message.