Contact Groups API
- September 2, 2022
- AmpenetSolutions
- 0
You can use the Ampenet SMS Contact Groups API to handle contact groups that are identified by a unique random ID. This ID is used to create, view, update, and delete groups.
API Endpoint
https://sms.ampenet.com/api/v3/contacts
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 |
Create a Group
API Endpoint
https://sms.ampenet.com/api/v3/contacts
Parameters
PARAMETER | REQUIRED | TYPE | DESCRIPTION |
---|---|---|---|
name | string | The name of the group. |
Example Request (PHP)
curl -X POST https://sms.ampenet.com/api/v3/contacts \
-H 'Authorization: Bearer 7|xs6pv2dspHJq8sWLhrpNFH5YLilMRQcVxLwSw2Sd' \
-d "name=ampenet"
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 a Group
Returns information about an existing group. You simply need to provide the unique group ID that was returned when the group was created or received.
API Endpoint
https://sms.ampenet.com/api/v3/contacts/{group_id}/show/
Parameters
PARAMETER | REQUIRED | TYPE | DESCRIPTION |
---|---|---|---|
group_id | string | Contact groups uid |
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."
}
Update a Group
API Endpoint
https://sms.ampenet.com/api/v3/contacts/{group_id}
Parameters
PARAMETER | REQUIRED | TYPE | DESCRIPTION |
---|---|---|---|
group_id | string | Contact groups uid | |
name | string | New group name |
Example Request (PHP)
curl -X PATCH https://sms.ampenet.com/api/v3/contacts/6065ecdc9184a \
-H 'Authorization: Bearer 7|xs6pv2dspHJq8sWLhrpNFH5YLilMRQcVxLwSw2Sd' \
-d "name=ampenet new"
Returns (JSON)
Returns a contact object if the request was successful.
{
"status": "success",
"data": "groups data with all details",
}
If the request failed, an error object will be returned.
{
"status": "error",
"message" : "A human-readable description of the error."
}
Delete a Group
API Endpoint
https://sms.ampenet.com/api/v3/contacts/{group_id}
Parameters
PARAMETER | REQUIRED | TYPE | DESCRIPTION |
---|---|---|---|
group_id | string | Contact groups uid |
Example Request (PHP)
curl -X DELETE https://sms.ampenet.com/api/v3/contacts/6065ecdc9184a \
-H 'Authorization: Bearer 7|xs6pv2dspHJq8sWLhrpNFH5YLilMRQcVxLwSw2Sd'
Returns (JSON)
Returns a contact object if the request was successful.
{
"status": "success",
"data": "null",
}
If the request failed, an error object will be returned.
{
"status": "error",
"message" : "A human-readable description of the error."
}
View All Groups
Lists all groups.
API Endpoint
https://sms.ampenet.com/api/v3/contacts/
Example Request (PHP)
curl -X GET https://sms.ampenet.com/api/v3/contacts \
-H 'Authorization: Bearer 7|xs6pv2dspHJq8sWLhrpNFH5YLilMRQcVxLwSw2Sd'
Returns (JSON)
Returns a contact object if the request was successful.
{
"status": "success",
"data": "group data with pagination",
}
If the request failed, an error object will be returned.
{
"status": "error",
"message" : "A human-readable description of the error."
}