мета-данные страницы
Подключение оператора SmsOffice (Грузия)
Для отправки сообщений клиентам из Грузии у нас реализована интеграция с оператором SmsOffice http://smsoffice.net/
Для подключения нужны логин и API-key. Логин и пароль от ЛК предоставляет оператор клиенту, далее клиенту необходимо в личном кабинете взять API_key, который нужен для отправки сообщений
Настройки в MessageControl:
(пример настроек у клиента Прайм Клин, Тбилиси)
- в поле "Имя отправителя" вписываем имя отправителя, которое клиент уже зарегистрировал у оператора
- в поле "Логин оператора" вписываем логин, который прислал нам оператор
- в поле "Пароль оператора" вписываем API-key, полученный в личном кабинете (не пароль от ЛК, а именно API-key)
Возможные ошибки при отправке
Response code Description\\ 0 The request has been successfully received by our system. This does not mean that the message has already been delivered to the destination.\\ 10 Destination does not contain any valid numbers\\ 20 Balance is insufficient\\ 60 Content parameter is missing\\ 70 Destination parameter is empty\\ 75 All numbers are stoplisted\\ 76 All numbers have invalid format\\ 77 All numbers are stoplisted or have invalid format\\ 80 API key is incorrect\\ 120 API access is disabled\\ 150 Sender not found\\ 500 API key is missing\\ 600 Destination is missing\\ 700 Sender is missing\\ 800 Content is missing\\ -100 Temporary delay\\
Документация от оператора:
How to send message? For transactional messages use urgent=true To send message, use HTTP GET or POST request. GET request example: https://smsoffice.ge/api/v2/send/?key=[API_KEY]&destination=[CUSTOMER_MOBILE]&sender=smsoffice&content=TestMessage[TIME]&urgent=true When using POST request, append slash symbol at the end of the path as follows: send/ You will receive a JSON response which contains the following properties: { "Success": boolean, "Message": string, "Output": object, "ErrorCode": integer } You can use HTTPS to encrypt data. Maximum length of HTTP GET request is 4096 bytes. If the request exceeds maximum length, use HTTP POST. When using POST request Content-Type must be application/x-www-form-urlencoded Examples From browser http://smsoffice.ge/api/v2/send?key=[API_KEY]&destination=[CUSTOMER_MOBILE]&sender=smsoffice&content=TestMessage PHP $data = 'key=' . urlencode('[API_KEY]') . '&destination=' . urlencode('[CUSTOMER_MOBILE]') . '&sender=' . urlencode($sender). '&content=' . urlencode($text) $url= "http://smsoffice.ge/api/v2/send?".$data $response = file_get_contents($url); cURL function get_data($url) { $ch = curl_init(); $timeout = 5; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $data = curl_exec($ch); curl_close($ch); return $data; } $data = curl_escape($ch, 'key=[API_KEY]&destination={$mobile}&sender={$sender}&content={$text}'); $returned_content = get_data('http://smsoffice.ge/api/v2/send?{$data }'); Required parameters key API key. Can be viewed on profile page destination Comma separated list of phone numbers. The number of phones is unlimited. Each number must be in international format, without 00 and +. For example: 995577123456,995599123456 sender Header which will be displayed as the sender of the message in the receiver's phone. Max. 11 characters. For example, SMSOFFICE. Or max.16 digits. For example, +995577123456 Precondition: the sender must be registered. content Text. Any unicode character is allowed. Max. 1000 characters. optional parameters contentType Message type. Possible values: 1: Text message 2: Flash message reference Unique identifier of the message in your system. You will receive the reference as a callback when the status of the message is updated. In case of the message with several destinations, you will receive the same reference values for each destination phone number. Reference must be a UTF-8 string with length of at most 20 characters. If you are willing to receive callbacks, this parameter is required. urgent If urgent=true, the message will be sent, even if the receiver has blocked receiving messages. scheduledAt If you pass this parameter, the message will be sent at the specified date (specified in Unix format as seconds) Response codes Response code Description 0 The request has been successfully received by our system. This does not mean that the message has already been delivered to the destination. 10 Destination does not contain any valid numbers 20 Balance is insufficient 60 Content parameter is missing 70 Destination parameter is empty 75 All numbers are stoplisted 76 All numbers have invalid format 77 All numbers are stoplisted or have invalid format 80 API key is incorrect 120 API access is disabled 150 Sender not found 500 API key is missing 600 Destination is missing 700 Sender is missing 800 Content is missing -100 Temporary delay Receiving message status update events as a callback When the status of your message changes, you will be notified at the predefined URL. If you sent message to multiple destinations, a separate callback will be triggered for each destination. Your system's response to our callback must be: OK Example: http://www.yoururl.com/callback Callback request parameters: reference ID of the message in your system status Updated status of the message. Possible values: Delivered, Undelivered, Expired, Pending, Unknown reason If status is different from Delivered, this parameter will hold the reason of failure. destination Destination phone number. timestamp Delivery date in format yyyyMMddhhmmss Example: http://www.yoururl.com/callback?reference=12345678&status=delivered&reason=&destination=995577123456×tamp=20130501120202&operator=28202 Get Balance To find your current balance call the following API http://smsoffice.ge/api/getBalance?key={api-key} The response is the number of messages left. Parameters key Private API key. Can be viewed on profile page