Subscriptions (JS SDK)

Manage Subscriptions

Method Objective

The method allows changing the status of the current user's subscriptions to notification channels.

Syntax and parameters

personaclick("subscription", "manage", params);

NameTypeRequirementDescription
paramsObjectrequiredObject with request parameters.

Request parameters

NameTypeRequirementDescription
emailstringoptionallyThe current user's Email.
phonestringoptionally

The current user's phone in full international format.

A phone number in full international format may begin with a plus sign (+) followed by the country code, city (area) code, and phone number.

external_idstringoptionallyStore side user ID.
loyalty_idstringoptionallyThe Loyalty Program user ID (loyalty card).
telegram_idstringoptionallyTelegram User ID.
email_bulkbooleanoptionallyIt changes the current user's subscription status to bulk email campaigns.
email_chainbooleanoptionallyIt changes the current user's subscription status to triggered email campaigns.
email_transactionalbooleanoptionally

It changes the current user's subscription status for transactional email campaigns.

It's recommended that always use the "true" value, even if you don't use transactional messages.

sms_bulkbooleanoptionallyIt changes the current user's subscription status to bulk SMS campaigns.
sms_chainbooleanoptionallyIt changes the current user's subscription status to triggered SMS campaigns.
sms_transactionalbooleanoptionally

It changes the current user's subscription status for transactional SMS campaigns.

It's recommended that always use the "true" value, even if you don't use transactional messages.

web_push_bulkbooleanoptionallyIt changes the current user's subscription status to bulk webpush campaigns.
web_push_chainbooleanoptionallyIt changes the current user's subscription status to triggered webpush campaigns.
web_push_transactionalbooleanoptionally

It changes the current user's subscription status for transactional webpush campaigns.

It's recommended that always use the "true" value, even if you don't use transactional messages.

mobile_push_bulkbooleanoptionallyIt changes the current user's subscription status to bulk app campaigns.
mobile_push_chainbooleanoptionallyIt changes the current user's subscription status to triggered app campaigns.
mobile_push_transactionalbooleanoptionally

It changes the current user's subscription status for transactional app campaigns.

It's recommended that always use the "true" value, even if you don't use transactional messages.

Examples of use

personaclick("subscription", "manage", {
    email: "john.doe@examplestore.com",
    phone: "+100000000000",
    email_bulk: true,
    email_chain: true,
    email_transactional: true,
    sms_bulk: true,
    sms_chain: true,
    sms_transactional: true,
    web_push_bulk: true,
    web_push_chain: true,
    web_push_transactional: true,
    mobile_push_bulk: true,
    mobile_push_chain: true,
    mobile_push_transactional: true
});

personaclick("subscription", "manage", {
    email: "john.doe@examplestore.com",
    email_bulk: true,
    email_chain: false,
    email_transactional: true,
});

personaclick("subscription", "manage", {
    phone: "+100000000000",
    sms_bulk: false,
    sms_chain: false,
    sms_transactional: true
});

personaclick("subscription", "manage", {
    email_transactional: true,
    sms_transactional: true
});

Subscription Statuses

Method Objective

The method allows checking the user's current subscription status by did (device id), email or phone number.

Syntax and parameters

personaclick("subscription", "check", success, error);
NameTypeRequirementDescription
successfunctionrequiredA callback function, to which the API response will be passed. Response type: object.
errorfunctionoptionallyA callback function that will be called when an error occurs (any HTTP status code other than 200).

API Response Data

The response is JSON type with the following properties:

NameTypeDescription
existsbooleanShows whether a profile with the requested property exists or not.
email_confirmedbooleanShows whether the email is confirmed or not.
email_bulkbooleanEmail subscription status for bulk campaigns.
email_chainbooleanEmail subscription status for chain/trigger campaigns.
email_transactionalbooleanEmail subscription status for transactional campaigns.
email_bouncedbooleanThe email is hard bounced or not.
email_suppressedbooleanThe email is suppressed or not.
email_blacklistedbooleanThe email is blacklisted or not.
email_invalidbooleanThe email is invalid or not.
sms_bulkbooleanPhone subscription status for SMS bulk campaigns.
sms_chainbooleanPhone subscription status for SMS chain/trigger campaigns.
sms_transactionalbooleanPhone subscription status for SMS transactional campaigns.
web_pushbooleanWhether or not the user with the email/phone has a subscription to web push.
web_push_bulkbooleanWeb-push subscription status for bulk campaigns.
web_push_chainbooleanWeb-push subscription status for chain/trigger campaigns.
web_push_transactionalbooleanWeb-push subscription status for transactional campaigns.
mobile_pushbooleanWhether or not the user with the email/phone has a subscription to mobile app push.
mobile_push_bulkbooleanMobile app push subscription status for bulk campaigns.
mobile_push_chainbooleanMobile app push subscription status for chain/trigger campaigns.
mobile_push_transactionalbooleanMobile app push subscription status for transactional campaigns.
telegram_bulkbooleanTelegram subscription status for bulk campaigns.
telegram_chainbooleanTelegram subscription status for chain/trigger campaigns.
telegram_transactionalbooleanTelegram subscription status for transactional campaigns.
statusstringAvailable only in case of an error. Contains the "error" value in this case.
messagestringAvailable only in case of an error. Contains a description of the error.

Request Example

personaclick("subscription", "check", function(response) {
    // success
}, function(error) {
    // fail
});

Copyright 2018-2024 PersonaClick