Description
Adds or edits profile subscriptions. Changes subscription status.
Request URL
Method: POST
https://example.com/api/v1.1/subscriptions/set
Request parameters
Parameter | Type | Example | Required | Description |
---|---|---|---|---|
token | string | "abcdefghijklmnqrstuvwxyz" | Yes | APItoken |
format | string | "json" | No | Response data format By default – json |
db_id | int | 1 | Yes | Database ID |
profile_id | string | "abcdefghijklmnqrstuvwxyz" | Yes | Profile ID |
resource_id | int | 1 | Yes | Resource ID |
status | string | "subscribed" | No | We recommend that you pass the parameter only when you need to update the subscription status. |
priority | int | 0 | No | Subscription priority |
date | string | No | Registration date | |
ip | string | No | Registration IP | |
url | string | No | Registration URL | |
skip_triggers | bool | true | No | Skip trigger events. By default– false |
Additionally for the Email channel:
Parameters | Type | Example | Description |
---|---|---|---|
channel | string | "email" | Channel type |
string | "john@example.com" | Email address |
Additionally for the Push channel:
Parameters | Type | Example | Description |
---|---|---|---|
channel | string | "push" | Channel type |
provider | string | "Firefox" | Push provider |
subscription_id | string | "abcdefghijklmnqrstuvwxyz" | Subscription ID |
Additionally for the SMS channel:
Parameters | Type | Example | Description |
---|---|---|---|
channel | string | "sms" | Channel type |
phone | string | "+79000000000" | Phone number |
Additionally for the Telegram channel:
Parameters | Type | Example | Description |
---|---|---|---|
channel | string | "telegram_bot" | Channel type |
cc_data | object | { "id": 1 } | Chat ID between Telegram bot and user |
Additionally for the WhatsApp channel:
Parameters | Type | Example | Description |
---|---|---|---|
channel | string | "whatsapp" | Channel type |
cc_data | object | { "phone": "+79000000000" } | WhatsApp user's phone number |
Request example
{ "channel": "email", "db_id": 1, "email": "john@example.com", "priority": 10, "profile_id": "abcdefghijklmnqrstuvwxyz", "resource_id": 1, "status": "suspended", "token": "abcdefghijklmnqrstuvwxyz" }
Response example
{ "data": { "action": "subscribed", "is_new_channel": false, "is_new_contact": false, "is_new_subscription": true, "is_restored": false, "is_safe": true }, "error": 0, "error_text": "Successful operation" }
Response parameters
Parameter | Type | Description |
---|---|---|
error | int | Error code |
error_text | string | Error text |
action | string | Subscription update result |
is_safe | bool | Safe and successful operation (no hard bounces e t c) |
is_new_subscription | bool | New for this resource |
is_new_channel | bool | New for this channel of an existing resource |
is_new_contact | bool | New subscription for an existing channel |
is_restored | bool | A previously deleted subscription restored |