SMS
SMS are an essential part of Our voice — they are the containers for the messages between you, your contacts, and groups. On this page, we’ll dive into the different sms endpoints you can use to manage SMS programmatically. We'll look at how to query, create, update, and delete SMS.
The sms model contains all the information about the SMS between you and your contacts.
Properties
- Name
id
- Type
- string
- Description
The ID (uuid) of the sms.
- Name
from
- Type
- string
- Description
Who sends the SMS.
- Name
to
- Type
- string
- Description
To whom the SMS is sent.
- Name
body
- Type
- string
- Description
The body of the SMS.
- Name
status
- Type
- enum
- Description
The status of the SMS. Types of status : scheduled, sent, undelivered, failed, delivered.
- Name
direction
- Type
- enum
- Description
The direction of the SMS. Types of direction : incoming and outgoing.
- Name
cost
- Type
- double
- Description
The cost of the SMS.
- Name
currency
- Type
- string
- Description
The currency of the SMS.
- Name
account_id
- Type
- string
- Description
Unique identifier for the account.
- Name
contact_id
- Type
- string
- Description
Unique identifier for the other contact in the sms.
- Name
campaign_id
- Type
- string
- Description
Unique identifier for the other campaign in the sms.
- Name
created_at
- Type
- timestamp
- Description
Timestamp of when the sms was created.
- Name
updated_at
- Type
- timestamp
- Description
Timestamp of when the sms was updated.
Display a listing of messages
This endpoint allows you to display a listing of all messages relative to an account
Request
curl --request GET \
--get "https://api.getourvoice.com/v1/messages" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
Display a filtered listing of messages
This endpoint allows you to display a filtered listing of all messages relative to an account
Request
curl --request GET \
--get "https://api.getourvoice.com/v1/messages?page=1&limit=10&filter[to]=&filter[from]=&filter[direction]=outgoing&filter[status]=completed&filter[duration]=" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
Store a new message
This endpoint allows you to add a new sms between you and a contact or group. A contact or group id is required to create a sms.
Required attributes
- Name
to
- Type
- string
- Description
To whom the SMS is sent.
- Name
body
- Type
- string
- Description
The body of the SMS.
- Name
sender_id
- Type
- string
- Description
Who sends the SMS. Your use sender_id or sender_name. Not both.
- Name
sender_name
- Type
- string
- Description
Who sends the SMS. Your use sender_name or sender_id. Not both.
Request
curl --request POST \
"https://api.getourvoice.com/v1/messages?page=1&limit=10&filter[to]=&filter[from]=&filter[direction]=outgoing&filter[status]=completed&filter[duration]=" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"from\": \"16985e4c-6fa7\",
\"to\": \"22996XXXXXX\",
\"body\": \"quaseligendiducimuseligendi\"
}
Response (200)
{
"data": {
"id": "36880e5b-07d9-465d-8ae6-30e409bd74e1",
"account_id": "43c98bbc-2f78-466b-9b94-b154a1b380ec",
"body": "voluptatem",
"from": "facilis",
"to": "['22996XXXXXX', '22961616262']",
"direction": "incoming",
"status": "sent",
"cost": 70536296,
"currency": "XOF",
"created_at": "2023-02-27T11:09:36.000000Z",
"updated_at": "2023-02-27T11:09:36.000000Z"
}
}
Display the specified message
This endpoint allows you to display a specified message.
Parameters
- Name
id
- Type
- string
- Description
The ID (uuid) of the message.
This endpoint allows you to display the specified message.
Request
curl --request GET \
"https://api.getourvoice.com/v1/messages/16985e4c-6fa7-406c-b259-793c9081e715" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
Update the specified message
This endpoint allows you update the specified message. It also takes a PATCH as a method.
Parameters
- Name
id
- Type
- string
- Description
The ID (uuid) of the resource.
Request
curl --request PUT \
"https://api.getourvoice.com/v1/messages/16985e4c-6fa7-406c-b259-793c9081e715" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
Remove the specified message.
This endpoint allows you remove the specified message.
Parameters
- Name
id
- Type
- string
- Description
The ID (uuid) of the resource.
Request
curl --request DELETE \
"https://api.getourvoice.com/v1/messages/16985e4c-6fa7-406c-b259-793c9081e715" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"