Learn how to quickly modify your existing Vonage API calls to send SMS messages using the SMS Gateway Emulator app. With minimal code changes, you can switch from Vonage services to our app, saving costs and gaining full control over your SMS gateway.
There are 2 ways to emulate Vonage API.
Change the API url directly.
Via our Proxy Server.
Whatever you do, make sure to change the API_KEY
,
API_SECRET
to
EMULATOR_API_KEY
,
EMULATOR_API_SECRET
, and set
EMULATOR_SENDER_ID
.
https://developer.vonage.com/en/messages/overview
https://developer.vonage.com/en/getting-started/concepts/authentication#basic-authentication
There are two versions of the Messages API available
https://developer.vonage.com/en/api/messages.v0
https://developer.vonage.com/en/api/messages
Only Basic authentication is supported.
# Version 0
curl -X POST https://api.nexmo.com/v0.1/messages \
-u "$VONAGE_API_KEY:$VONAGE_API_SECRET" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d $'{
"from": { "type": "sms", "number": "'$FROM_NUMBER'" },
"to": { "type": "sms", "number": "'$TO_NUMBER'" },
"message": {
"content": {
"type": "text",
"text": "This is an SMS sent from the Messages API"
}
}
}'
# Version 1
curl -X POST https://api.nexmo.com/v1/messages \
-u "$VONAGE_API_KEY:$VONAGE_API_SECRET" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d $'{
"message_type": "text",
"text": "This is an SMS sent from the Messages API",
"to": "'$TO_NUMBER'",
"from": "'$FROM_NUMBER'",
"channel": "sms"
}'
# Version 0
curl -X POST https://api.smsgatewayemulator.com/v0.1/messages \
-u "$EMULATOR_API_KEY:$EMULATOR_API_SECRET" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d $'{
"from": { "type": "sms", "number": "'$EMULATOR_SENDER_ID'" },
"to": { "type": "sms", "number": "'$TO_NUMBER'" },
"message": {
"content": {
"type": "text",
"text": "This is an SMS sent from the Messages API"
}
}
}'
# Version 1
curl -X POST https://api.smsgatewayemulator.com/v1/messages \
-u "$EMULATOR_API_KEY:$EMULATOR_API_SECRET" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d $'{
"message_type": "text",
"text": "This is an SMS sent from the Messages API",
"to": "'$TO_NUMBER'",
"from": "'$EMULATOR_SENDER_ID'",
"channel": "sms"
}'
# Version 0
curl -X POST https://api.nexmo.com/v0.1/messages \
-u "$EMULATOR_API_KEY:$EMULATOR_API_SECRET" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d $'{
"from": { "type": "sms", "number": "'$EMULATOR_SENDER_ID'" },
"to": { "type": "sms", "number": "'$TO_NUMBER'" },
"message": {
"content": {
"type": "text",
"text": "This is an SMS sent from the Messages API"
}
}
}' \
--cacert ./sms_gateway_emulator_ca.crt \
--proxy https://proxy.smsgatewayemulator.com \
--proxy-cacert ./sms_gateway_emulator_ca.crt
# Version 1
curl -X POST https://api.nexmo.com/v1/messages \
-u "$EMULATOR_API_KEY:$EMULATOR_API_SECRET" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d $'{
"message_type": "text",
"text": "This is an SMS sent from the Messages API",
"to": "'$TO_NUMBER'",
"from": "'$EMULATOR_SENDER_ID'",
"channel": "sms"
}' \
--cacert ./sms_gateway_emulator_ca.crt \
--proxy https://proxy.smsgatewayemulator.com \
--proxy-cacert ./sms_gateway_emulator_ca.crt
from vonage import Auth, Vonage
from vonage_sms import SmsMessage, SmsResponse
client = Vonage(Auth(api_key=VONAGE_API_KEY, api_secret=VONAGE_API_SECRET))
message = SmsMessage(
to=TO_NUMBER,
from_=VONAGE_BRAND_NAME,
text="A text message sent using the Vonage SMS API.",
)
response: SmsResponse = client.sms.send(message)
print(response)
from vonage import Auth, Vonage
from vonage_sms import SmsMessage, SmsResponse
# The SDK sends the request to rest_host instead of api_host
client = Vonage(Auth(api_key=EMULATOR_API_KEY, api_secret=EMULATOR_API_SECRET), HttpClientOptions(api_host='api.smsgatewayemulator.com', rest_host='api.smsgatewayemulator.com'))
message = SmsMessage(
to=TO_NUMBER,
from_=EMULATOR_SENDER_ID,
text="A text message sent using the Vonage SMS API.",
)
response: SmsResponse = client.sms.send(message)
print(response)