Learn how to quickly modify your existing AfricasTalking API calls to send SMS messages using the SMS Gateway Emulator app. With minimal code changes, you can switch from AfricasTalking services to our app, saving costs and gaining full control over your SMS gateway.
There are 2 ways to emulate AfricasTalking API.
Change the API url directly.
Via our Proxy Server.
Whatever you do, make sure to change AppApiKey
to EMULATOR_API_KEY
,
username
to EMULATOR_USERNAME
, and set EMULATOR_SENDER_ID
.
https://developers.africastalking.com/docs/sms/sending/bulk
curl -X POST \
https://api.africastalking.com/version1/messaging/bulk \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'apiKey: AppApiKey' \
-d '{
"username": "username",
"message": "This is a sample message.",
"senderId": "ABC",
"phoneNumbers": [
"2B254711XXXYYY",
"2B254711YYYZZZ"
]
}'
curl -X POST \
https://api.smsgatewayemulator.com/version1/messaging/bulk \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'apiKey: $EMULATOR_API_KEY' \
-d '{
"username": "$EMULATOR_USERNAME",
"message": "This is a sample message.",
"senderId": "$EMULATOR_SENDER_ID",
"phoneNumbers": [
"2B254711XXXYYY",
"2B254711YYYZZZ"
]
}'
curl -X POST \
https://api.africastalking.com/version1/messaging/bulk \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'apiKey: $EMULATOR_API_KEY' \
-d '{
"username": "$EMULATOR_USERNAME",
"message": "This is a sample message.",
"senderId": "$EMULATOR_SENDER_ID",
"phoneNumbers": [
"2B254711XXXYYY",
"2B254711YYYZZZ"
]
}' \
--cacert ./sms_gateway_emulator_ca.crt \
--proxy https://proxy.smsgatewayemulator.com \
--proxy-cacert ./sms_gateway_emulator_ca.crt
import africastalking
africastalking.initialize("YOUR_USERNAME", "YOUR_API_KEY")
recipients = ["+254711XXXYYY"]
message = "Hello from Africastalking Emulator"
sender = "shortCode or senderId"
try:
response = africastalking.SMS.send(message, recipients, sender)
print (response)
except Exception as e:
print ('Encountered an error while sending: %s' % str(e))
import africastalking
africastalking.initialize("EMULATOR_USERNAME", "EMULATOR_API_KEY")
recipients = ["+254711XXXYYY"]
message = "Hello from Africastalking Emulator"
sender = "EMULATOR_SENDER_ID"
try:
africastalking.SMS._baseUrl = "https://api.smsgatewayemulator.com/version1"
response = africastalking.SMS.send(message, recipients, sender)
print (response)
except Exception as e:
print ('Encountered an error while sending: %s' % str(e))