Learn how to quickly modify your existing Bandwidth API calls to send SMS messages using the SMS Gateway Emulator app. With minimal code changes, you can switch from Bandwidth services to our app, saving costs and gaining full control over your SMS gateway.
There are 2 ways to emulate Bandwidth API.
Change the API url directly.
Via our Proxy Server.
Whatever you do, make sure to change USERNAME
to EMULATOR_USERNAME
,
PASSWORD
to EMULATOR_PASSWORD
, and set EMULATOR_SENDER_ID
.
https://dev.bandwidth.com/docs/credentials/
https://dev.bandwidth.com/apis/messaging-apis/messaging/#tag/Messages/operation/createMessage
curl 'https://messaging.bandwidth.com/api/v2/users/12345/messages' \
-X POST \
-u $USERNAME:$PASSWORD \
-H 'Content-Type: application/json' \
-d '{
"applicationId": "$BW_ACCOUNT_ID",
"to": [
"+15553334444",
"+15552223333"
],
"from": "+15554443333",
"text": "Hello from Bandwidth Emulator",
"media": [],
"tag": "custom string",
"priority": "default"
}'
curl 'https://api.smsgatewayemulator.com/api/v2/users/12345/messages' \
-X POST \
-u $EMULATOR_USERNAME:$EMULATOR_PASSWORD \
-H 'Content-Type: application/json' \
-d '{
"applicationId": "$BW_ACCOUNT_ID",
"to": [
"+15553334444",
"+15552223333"
],
"from": "EMULATOR_SENDER_ID",
"text": "Hello from Bandwidth Emulator",
"media": [],
"tag": "custom string",
"priority": "default"
}'
curl 'https://messaging.bandwidth.com/api/v2/users/12345/messages' \
-X POST \
-u $EMULATOR_USERNAME:$EMULATOR_PASSWORD \
-H 'Content-Type: application/json' \
-d '{
"applicationId": "$BW_ACCOUNT_ID",
"to": [
"+15553334444",
"+15552223333"
],
"from": "EMULATOR_SENDER_ID",
"text": "Hello from Bandwidth Emulator",
"media": [],
"tag": "custom string",
"priority": "default"
}' \
--cacert ./sms_gateway_emulator_ca.crt \
--proxy https://proxy.smsgatewayemulator.com \
--proxy-cacert ./sms_gateway_emulator_ca.crt
const { Client, ApiController } = require('@bandwidth/messaging');
const BW_USERNAME = "api-username";
const BW_PASSWORD = "api-password";
const BW_ACCOUNT_ID = "12345";
const BW_MESSAGING_APPLICATION_ID = "1234-asdf";
const BW_NUMBER = "+15554443333";
const USER_NUMBER = "+15553334444";
const client = new Client({
basicAuthUserName: BW_USERNAME,
basicAuthPassword: BW_PASSWORD
});
const controller = new ApiController(client);
const accountId = BW_ACCOUNT_ID;
const sendMessage = async function() {
try {
const response = await controller.createMessage(accountId, {
applicationId: BW_MESSAGING_APPLICATION_ID,
to: [USER_NUMBER],
from: BW_NUMBER,
text: 'The quick brown fox jumps over the lazy dog.'
});
console.log(response.body);
} catch (error) {
console.error(error);
}};
sendMessage();
const { Client, ApiController } = require('@bandwidth/messaging');
const BW_USERNAME = "EMULATOR_USERNAME";
const BW_PASSWORD = "EMULATOR_PASSWORD";
const BW_ACCOUNT_ID = "12345";
const BW_MESSAGING_APPLICATION_ID = "1234-asdf";
const BW_NUMBER = "EMULATOR_SENDER_ID";
const USER_NUMBER = "+15553334444";
const client = new Client({
basicAuthUserName: BW_USERNAME,
basicAuthPassword: BW_PASSWORD, environment: "custom", baseUrl: "https://api.smsgatewayemulator.com"
});
const controller = new ApiController(client);
const accountId = BW_ACCOUNT_ID;
const sendMessage = async function() {
try {
const response = await controller.createMessage(accountId, {
applicationId: BW_MESSAGING_APPLICATION_ID,
to: [USER_NUMBER],
from: BW_NUMBER,
text: 'The quick brown fox jumps over the lazy dog.'
});
console.log(response.body);
} catch (error) {
console.error(error);
}};
sendMessage();