Skip to content

VK.COM

Sending

To send a VK message it is required:

  • pass the send message template to your manager or to technical support (support@devinotele.com);
  • get the template ID (it will be substituted into the request in the templateId parameter);
  • call POST /vk/messages, sending message parameters in the body with authorization data in the heading.

Attention

There are restrictions on stripping in VK:
- no more than 50 notifications per second for one service (for one group in VK);
- no more than 5 notifications per day for one user from one service (one group in VK).

Request parameters

Parameter Data type Description
to string Phone number in international format.
According to the standard E.164
templateId string Template ID in Devino Online
templateData
(optional)
object Additional values for the template
routes array[string] Array of VK routes in order of use. Possible values:
[VK]
[OK]
[OK,VK]
[VK,OK]
deliveryPolicy string Delivery policy.
Possible values: ANY, MOBILE_DEVICE_REQUIRED.
Default ANY.
If MOBILE_DEVICE_REQUIRED is specified, then delivery is made only if the user has a mobile application and has used it within the last 7 days. In this case, delivery is made to all available devices, not just mobile ones.
validity
(optional)
integer Indicated only in case of sending a message using a template. Minimum value - 15 (seconds). Miaximum value (day) - 86400 (seconds).
pushToken
(optional)
string User device ID
callbackData
(optional)
string The data to be specified in the callback with the message status
callbackUrl
(optional)
string URL, which the system will send notifications of changes in the message status
Any valid URL with an http or https scheme

Request example

curl -X POST /vk/messages \
 -H 'Authorization: Key QWxhZGRpbjpvcGVuIHNlc2FtZQ==' \
 -H 'Content-Type: application/json' \
 -d '{ 
    "messages": [
        { 
            "callbackData":
                {
                    "clientId": 44444
                },
            "callbackUrl": "http://10.10.10.10:1000/callback",
            "deliveryPolicy": "ANY",
            "pushToken": "123",
            "routes": [
                "VK"
            ],
            "templateData": {
                "attr1": "100.50",
                "attr2": "1288899"
            },
            "templateId": 16,
            "to": 79100000000,
            "validity": 15
        }
    ]
}' https://api.devino.online/whatsapp/messages

Response example

{
    "result": [
        {
            "code": "OK",
            "messageId": "3482512350952730368"
        }
    ]
}

Response parameters

Parameter Data type Description
code string Points out the result of message processing.
1. OK - Processed successfully
2. REJECTED - An error has occurred while processing the request.
reasons
(optional)
Array[String, String] An array of the errors which occurred while processing the message.
To be given with code=REJECTED only
reasons.key string Error code.
reasons.ref
(optional)
string A reference to the parameter where the error occurred.
messageId
(optional)
string Message ID.
To be given with code=OK only
description
(optional)
string Error description.
To be given with code=REJECTED only

Webhook

To get the status of VK messages, you must specify callbackUrl parameter when sending a message using POST /vk/messages method.

Request example

[
    {
        "channel":"VK",
        "messageId":"3594444391611888888",
        "ts":1611111767111,
        "status":"DELIVERED",
        "errorCode":9,
        "callbackData":{
          "clientId":"45656"
        },
        "pushToken":"123"
    }
]

Request parameters

Parameter Data type Description
channel string Send channel ("VK")
messageId int Message ID
ts int Indicates when the status object was created
status enum VK message delivery status code
For details, see the Possible statuses section
errorCode
(optional)
int Reason code, the message was not delivered to the subscriber (status = undelivered)
callbackData object The data that was specified in callbackData when sending the message
pushToken string User device ID

Possible statuses

Status Description
sent Message sent to subscriber
delivered Message delivered to subscriber
seen The message was viewed by a subscriber
expired Was not delivered within the allotted time
undeliverable Message cannot be delivered
rejected The message was rejected by the operator or Devino
unknown An unknown error has occurred

Error codes

Code Description
SENT Message sent
DELIVERED Delivered
READ Read
NOT_ENOUGHT_DATA Not enough data in the request
INCORRECT_SIGNATURE Invalid signature
UNSUPPORTED_NUMBER Number not supported (country or operator)
INCORRECT_NUMBER phoneinfo detects this number as invalid
NUMBER_IN_BLACK_LIST Number is blacklisted
NUMBER_TYPE_NOT_ALLOWED Number is virtual or from the category of spam
RATELIMIT Limit exceeded
FAILED There was an attempt, the notification was not delivered
UNSUPPORTED This type of delivery is not supported for this number/service
VP_EXPIRED_AFTER_SEND Lifetime expired before receiving VK message status
BLOCKED_BY_USER The user has denied receiving messages from this sender
UNKNOWN Unknown status from supplier