SMS API
- September 2, 2022
- AmpenetSolutions
- 0
API Endpoint
https://sms.ampenet.com/api/v3/sms/send
Parameters
PARAMETER | REQUIRED | DESCRIPTION |
---|---|---|
Authorization | When calling our API, send your api token with the authentication type set as Bearer (Example: Authorization: Bearer {api_token}) | |
Accept | Set to application/json |
Send An Outbound SMS
The Programmable SMS API from Ampenet SMS allows you to send SMS messages from your web application programmatically. You must first build a new message object. With each request, Ampenet SMS returns the produced message object.
Use this example request to send your first SMS message.
API Endpoint
https://sms.ampenet.com/api/v3/sms/send
Parameters
PARAMETER | REQUIRED | TYPE | DESCRIPTION |
---|---|---|---|
recipient | string | Number to send message. Use a comma (,) to send multiple numbers. Ex. 255712345678,255712876543 | |
sender_id | string | The sender of the message. This can be a telephone number (including country code) or an alphanumeric string. In the case of an alphanumeric string, the maximum length is 11 characters. | |
type | string | The type of the message. For text messages, you have to insert plain as sms type. | |
message | string | The body of the SMS message. | |
schedule_time | datetime | The scheduled date and time of the message in RFC3339 format (Y-m-d H:i) |
Example Request for a Single Number (PHP)
curl -X POST https://sms.ampenet.com/api/v3/sms/send \
-H 'Authorization: Bearer 7|xs6pv2dspHJq8sWLhrpNFH5YLilMRQcVxLwSw2Sd' \
-d "recipient=255712345678" \
-d "sender_id=YourName" \
-d "type=plain" \
-d "schedule_time=2021-12-20 07:00" \
-d "message=This is a test message"
Example Request for Multiple Numbers (PHP)
curl -X POST https://sms.ampenet.com/api/v3/sms/send \
-H 'Authorization: Bearer 7|xs6pv2dspHJq8sWLhrpNFH5YLilMRQcVxLwSw2Sd' \
-d "recipient=254712345678,254712876543" \
-d "sender_id=YourName" \
-d "type=plain" \
-d "schedule_time=2021-12-20 07:00" \
-d "message=This is a test message"
Returns (JSON)
Returns a contact object if the request was successful.
{
"status": "success",
"data": "sms reports with all details",
}
If the request failed, an error object will be returned.
{
"status": "error",
"message" : "A human-readable description of the error."
}
View An SMS
Our SMS API can be used to get information from an existing inbound or outgoing SMS message. You simply need to provide the unique message id that was returned when the message was created or received.
API Endpoint
https://sms.ampenet.com/api/v3/sms/{uid}
Parameters
PARAMETER | REQUIRED | TYPE | DESCRIPTION |
---|---|---|---|
uid | string | A unique random uid which is created on the Ampenet SMS platform and is returned upon creation of the object. |
Example Request (PHP)
curl -X POST https://sms.ampenet.com/api/v3/contacts/6065ecdc9184a/show \
-H 'Authorization: Bearer 7|xs6pv2dspHJq8sWLhrpNFH5YLilMRQcVxLwSw2Sd'
Returns (JSON)
Returns a contact object if the request was successful.
{
"status": "success",
"data": "group data with all details",
}
If the request failed, an error object will be returned.
{
"status": "error",
"message" : "A human-readable description of the error."
}
View All Messages
View all messages.
API Endpoint
https://sms.ampenet.com/api/v3/sms/
Example Request (PHP)
curl -X GET https://sms.ampenet.com/api/v3/sms \
-H 'Authorization: Bearer 7|xs6pv2dspHJq8sWLhrpNFH5YLilMRQcVxLwSw2Sd'
Returns (JSON)
Returns a contact object if the request was successful.
{
"status": "success",
"data": "sms reports with pagination",
}
If the request failed, an error object will be returned.
{
"status": "error",
"message" : "A human-readable description of the error."
}