1. Get Information About the SMS Campaign
The method allows you to retrieve detailed information about the campaign along with the statistics of messages sent.
Request URL
GET http://one-api.bsg.world/api/campaigns/{id}/detail
Request Parameters
| Parameter | Required | Type | Default | Description |
| id | Yes | integer | No |
Campaign ID created using:
|
Response Parameters
| Parameter | Type | Description | |
| id | integer | Campaign ID. | |
| name | string | Auto-generated campaign name. | |
| sender | string | Sender name. | |
| status | string |
Campaign status. Possible values:
|
|
| message_type | string | Campaign type: sms. | |
| start_at | string |
Date and time of the scheduled campaign start. Display format according to ISO 8601: yyyy-mm-dd hh:mm:ss |
|
| real_start_at | string |
Actual date and time the campaign started. Display format according to ISO 8601: yyyy-mm-dd hh:mm:ss |
|
| finished_at | string |
Date and time the campaign is completed. Display format according to ISO 8601: yyyy-mm-dd hh:mm:ss |
|
| created_at | string |
Date and time the campaign is created. Display format according to ISO 8601: yyyy-mm-dd hh:mm:ss |
|
| statistics | array | Campaign statistics: | |
| delivered | integer | Number of messages received by the recipient | |
| scheduled | integer | Number of messages scheduled for the campaign | |
| moderation | integer | Number of messages in moderation | |
| accepted | integer | Number of messages accepted by the operator | |
| sending | integer | Number of messages in the queue for sending | |
| sent | integer | Number of messages that have been sent and are expecting to be delivered | |
| expired | integer | Number of undelivered messages (phone switched off) | |
| failed | integer | Number of messages with a send error (probably a missing prefix) | |
| undelivered | integer | Number of undelivered messages | |
| unknown | integer | Number of messages for which there is no delivery report | |
| total_messages | integer | Total number of messages created within the campaign | |
| total_phones | integer | Number of contacts in the campaign | |
| total_price | string | Total campaign price | |
| currency | string | The currency in which the campaign cost is specified. ISO 4217 format. | |
Response Sample
If the request is successful, you will receive a response:
{
"data": {
“id”: “12345”,
“name”: “string”
“sender”: “testsms”,
“status”: “done”,
“type”: “instant”,
“start_at”: “2022-01-01 00:01:02”,
“actual_start_at”: “2022-01-01 00:01:03”,
“creation_at”: “2022-01-01 00:00:01”,
“finished_at”: “2022-01-01 00:10:03”,
“statistics”: [
{
“delivered”: 0,
“scheduled”: 0,
“moderation”: 0,
“accepted”: 0,
“sending”: 20,
“sent”: 100,
“expired”: 0,
“failed”: 0,
“undelivered”: 0,
“unknown”: 0
}
]
“total_messages”: 120,
“total_phones”: 120,
“total_price”: “35,0987645”,
“currency”: “USD”
}
}
2. Get SMS Messages
The method allows you to get information about the status of a single message or the status of each message in an SMS campaign.
Request URL
GET http://one-api.bsg.world/api/messages
Request Parameters
| Parameter | Required | Type | Default | Description |
| page[limit] | No | integer | 50 | The number of messages in the response. The parameter value range: min - 15, max - 500. |
| page[offset] | No | integer | 0 | Get messages starting from offset |
| filter[from] | No | string | No | Filter by sending date “from”. Format ISO 8601: yyyy-mm-dd hh:mm:ss |
| filter[to] | No | string | Now | Filter by sending date “to”. Format ISO 8601: yyyy-mm-dd hh:mm:ss |
| filter[campaign_id] | No | integer | No |
Filter to get messages by ID of campaign created using:
|
| filter[reference_id] | No | string | No | Filter to get messages by external message ID |
| filter[id] | No | integer | No | Get a message by message ID |
| sort | No | string | id | Sort by id, phone, delivered |
| way | No | string | asc | Sorting options: asc, desc |
Response Parameters
| Parameter | Type | Description | |
| id | integer | Message ID | |
| campaign_id | integer | Campaign ID | |
| reference_id | string | External message ID (reference) | |
| type | string | Campaign type: sms | |
| source | string |
Possible values:
|
|
| text | string | Message text | |
| phone | string | The phone number to which the message was sent | |
| validity | integer | Message validity time, hours | |
| status | string |
Message status. Possible values:
|
|
| amount | object | Message price data: | |
| value | string | Message price | |
| currency | string | The currency in which the message cost is specified. FormatISO 4217. | |
| sender | string | SMS Sender name | |
| created_at | string | Date and time of the message creation. Format ISO 8601: yyyy-mm-dd hh:mm:ss | |
| send_at | string | Date and time the message was sent. Format ISO 8601: yyyy-mm-dd hh:mm:ss | |
| delivered_at | string | Date and time the delivery report was received. Format ISO 8601: yyyy-mm-dd hh:mm:ss | |
Response Sample
If the request is successful, you will receive a response:
{
"data": [
{
"id": 26130,
"campaign_id": 1,
"reference_id": "string",
"type": "sms",
"source": "web",
"text": "text",
"phone": 12345678900,
"validity": 72,
"status": "scheduled",
"amount": {
"value": "string",
"currency": "UAH"
},
"sender": "sender",
"created_at": "2021-04-27 19:44:06",
"send_at": "2021-04-27 19:44:06",
"delivered_at": "2021-04-27 19:44:06"
}
],
"meta": {
"page": {
"total": 1,
"offset": 20,
"limit": 40
}
}
}3. Get a List of SMS Campaigns
The method for retrieving a list of created campaigns.
The maximum period for which you can sample the campaigns is 3 months.
Request URL
GET http://one-api.bsg.world/api/campaigns
Request Parameters
| Parameter | Required | Type | Default | Description |
| filter[type] | No | string | sms | Filter by campaign type, sms |
| filter[from] | No | string | filter[to] -3 month | Date and time of the sampling beginning. Format ISO 8601: yyyy-mm-dd hh:mm:ss |
| filter[to] | No | string | now |
Date and time of the sampling end. Format ISO 8601: yyyy-mm-dd hh:mm:ss It is possible to specify a future date: the valid value is 30 days ahead of the current date. |
| page[offset] | No | int | 0 | Get messages starting from offset |
| page[limit] | No | int | 50 | Number of campaigns in response |
| sort | No | string | id | Sort by id, sender, type |
| way | No | string | asc | Sorting options: asc, desc |
Response Parameters
| Parameter | Type | Description | |
| id | integer |
Created campaign ID.
|
|
| name | string | Campaign name | |
| sender | string | SMS Sender name. | |
| status | string |
Campaign status. Possible values:
|
|
| message_type | string | Campaign type: sms. | |
| start_at | string | Campaign start date. Format ISO 8601: yyyy-mm-dd hh:mm:ss | |
| real_start_at | string | Actual date and time the campaign started. Format ISO 8601: yyyy-mm-dd hh:mm:ss. | |
| finished_at | string | Campaign completion date. Format ISO 8601: yyyy-mm-dd hh:mm:ss | |
| created_at | string | Date and time the campaign is created. Format ISO 8601: yyyy-mm-dd hh:mm:ss. | |
| statistics | array | Campaign statistics: | |
| delivered | integer | Total number of messages delivered within the campaign | |
| sent | integer | Total number of messages sent within the campaign | |
Response Sample
If the request is successful, you will receive a response:
{
"data": [
{
"id": 1,
"name": "string",
"sender": "string",
"status": "creation",
"message_type": "sms",
"start_at": "2021-04-27 19:44:06",
"real_start_at": "2021-04-27 19:44:06",
"finished_at": "2021-04-27 19:44:06",
"created_at": "2021-04-27 19:44:06",
"statistics": {
"delivered": 0,
"sent": 0
}
}
],
"meta": {
"page": {
"total": 1,
"limit": 30,
"offset": 0
}
}
}
}
Comments
0 comments
Article is closed for comments.