Page tree

This page contains an outdated version of the Altcraft Platform documentation.
You can find the latest information by following this link: https://guides.altcraft.com.

Description

Adds or edits profile subscriptions. Changes subscription status.

Request URL

Method: POST

https://example.com/api/v1.1/subscriptions/set

Request parameters

ParameterTypeExampleRequiredDescription
tokenstring"abcdefghijklmnqrstuvwxyz"YesAPItoken
formatstring"json"NoResponse data format
By default – json
db_idint1YesDatabase ID
profile_idstring"abcdefghijklmnqrstuvwxyz"YesProfile ID
resource_idint1YesResource ID
statusstring"subscribed"No

Subscription status.

We recommend that you pass the parameter only when you need to update the subscription status.

priorityint0NoSubscription priority
datestring
NoRegistration date
ipstring
NoRegistration IP
urlstring
NoRegistration URL
skip_triggersbooltrueNoSkip trigger events.
By default– false

Additionally for the Email channel:

Parameters

Type

Example

Description

channelstring"email"Channel type
emailstring"john@example.com"Email address

Additionally for the Push channel:

Parameters

Type

Example

Description

channelstring"push"Channel type
providerstring"Firefox"Push provider
subscription_idstring"abcdefghijklmnqrstuvwxyz"Subscription ID

Additionally for the SMS channel:

Parameters

Type

Example

Description
channelstring"sms"Channel type
phonestring"+79000000000"Phone number

Additionally for the Telegram channel:

Parameters

Type

Example

Description

channelstring"telegram_bot"Channel type
cc_dataobject
{
   "id": 1
}
Chat ID between Telegram bot and user

Additionally for the WhatsApp channel:

Parameters

Type

Example

Description

channelstring"whatsapp"Channel type
cc_dataobject
{
   "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

ParameterTypeDescription
errorintError code
error_textstringError text
actionstringSubscription update result
is_safeboolSafe and successful operation (no hard bounces e t c)
is_new_subscriptionboolNew for this resource
is_new_channelboolNew for this channel of an existing resource
is_new_contactboolNew subscription for an existing channel
is_restoredboolA previously deleted subscription restored
  • No labels