API

API entry point

The unified query entry point is https://smartconnect.smstraffic.ru/api. Use this location to make queries using appropriate methods. All data, both input and output, are represented as JSON.

The common field, required for all input queries is token - a company unique identifier that you can obtain in the company management section.

 

 

Callbacks

Callback is an HTTP POST query we send to the location, specified in the company management section, when a new incoming message appears. No matter which communication channel was used to get the message, we deliver the unified message data:

 

Integer channel_account_id - unique communication channel account  identifier.

String thread_id - unique chat identifier.

String message - the message text.

Integer message_id - the message unique identifier.

Integer time - the message creation time.

 

 

Methods

POST /messages/submit

Submits a message via a communication channel.

 

Input

 

Required String token - a company unique identifier.

Required Integer channel_account_id - unique communication channel account identifier.

Required String thread_id - unique chat identifier.

Required String message - message text. Its maximun length depends on the channel.

 

Output

 

Integer status. Status of the operation. Possible values are:

  • 200 - the message was sent;
  • 400 - the input data is malformed, the operation failed;
  • 500 - something went wrong, the operation failed.

String description - some extended information regarding the query result. Can be empty.

 

 

POST /bulk

Initiate bulk messaging via all communication channels or defined one.

 

Input

 

Required String token - a company unique identifier.

Required String message - message text. Its maximun length depends on the channel.

Optional Integer channel_account_id - unique communication channel account identifier.

 

Output

 

Integer status. Status of the operation. Possible values are:

  • 200 - the task was queued;
  • 400 - the input data is malformed, the operation failed;
  • 500 - something went wrong, the operation failed.

String description - some extended information regarding the query result. Can be empty.

Integer task_id - queued task unique identifier.

 

 

POST /bulk/task

Get a bulk messaging task.

 

Input

 

Required String token - a company unique identifier.

Required Integer task_id - queued task unique identifier.

 

Output

 

Integer status. Status of the operation. Possible values are:

  • 200 - the task was queued;
  • 400 - the input data is malformed, the operation failed;
  • 500 - something went wrong, the operation failed.

Array task - the task data. Has these fields:

  • id - the task unique identifier;
  • message - a message to send;
  • total - total amount of the message recievers;
  • sent - total messages sent;
  • started_at - the time when the dispatching has started;
  • done_at - the time, when the dispatching has been over.

 

 

POST /channels/accounts

Returns a list of channel accounts thas allow bulk messaging.

 

Input

 

Required String token - a company unique identifier.

 

Output

 

Integer status. Status of the operation. Possible values are:

  • 200 - the message was sent;
  • 400 - the input data is malformed, the operation failed;
  • 500 - something went wrong, the operation failed.

String description - some extended information regarding the query result. Can be empty.

Array accounts. The list of channel accounts. Each account has these fields:

  • id - the unique identifier
  • name
  • channel_id - a channel that this account belongs to
  • channel_name - the channel name

 

 

POST /chats/export

Initiate an export chats task. Default period - last month.

 

Input

 

Required String token - a company unique identifier.

Optional String date_from - start date in the format of dd.mm.yyyy.

Optional String date_to - end date in the format of dd.mm.yyyy.

Optional Integer uid - user ID.

Optional Integer category - chat's category ID.

Optional String name - client's name.

 

Output

 

Integer status. Status of the operation. Possible values are:

  • 200 - the task is pending;
  • 400 - the input data is malformed, the operation failed;
  • 500 - something went wrong, the operation failed.

Integer task_id. Pending task id.

 

 

POST /chats/pull

Get the chats export task status and export file location if it is ready.

 

Input

 

Required String token - a company unique identifier.

Integer task_id. The task id.

 

Output

 

Integer status. Status of the operation. Possible values are:

  • 200 - the task found;
  • 400 - the input data is malformed, the operation failed;
  • 500 - something went wrong, the operation failed.

String description. Extended information regarding the status.

Integer task_id. The task id.

String location. The export file location. Can be empty if is not ready yet.

 

 

POST /statistics/export

Initiate an export statistics task. Default period - last month.

 

Input

 

Required String token - a company unique identifier.

Optional String date_from - start date in the format of dd.mm.yyyy.

Optional String date_to - end date in the format of dd.mm.yyyy.

 

Output

 

Integer status. Status of the operation. Possible values are:

  • 200 - the task is pending;
  • 400 - the input data is malformed, the operation failed;
  • 500 - something went wrong, the operation failed.

Integer task_id. Pending task id.

 

 

POST /statistics/pull

Get the statistics export task status and export file location if it is ready.

 

Input

 

Required String token - a company unique identifier.

Integer task_id. The task id.

 

Output

 

Integer status. Status of the operation. Possible values are:

  • 200 - the task found;
  • 400 - the input data is malformed, the operation failed;
  • 500 - something went wrong, the operation failed.

String description. Extended information regarding the status.

Integer task_id. The task id.

String location. The export file location. Can be empty if is not ready yet.

 

 

POST /users

Get users list.

 

Input

 

Required String token - a company unique identifier.

 

Output

 

Integer status. Status of the operation. Possible values are:

  • 200 - the task found;
  • 400 - the input data is malformed, the operation failed;
  • 500 - something went wrong, the operation failed.

Array users. The list of users. Each has these fields:

  • id - the unique identifier;
  • name;
  • status - user's status. Can be 0 - operator, 1 - administrator, 2 - supervisor.

 

POST /users/{id}

Get user's information.

 

Input

 

Required String token - a company unique identifier.

 

Output

 

Integer status. Status of the operation. Possible values are:

  • 200 - the task found;
  • 400 - the input data is malformed, the operation failed;
  • 500 - something went wrong, the operation failed.

Array user. The user's information:

  • id - the unique identifier;
  • name;
  • status - user's status. Can be 0 - operator, 1 - administrator, 2 - supervisor.