If you want to have access to the variable in all messages, specify this as the tag global.

Methods:

/api/v2/tags/vars/delete/ -delete variables linked to the tag

Method's Assignment

The method allows deleting variables linked to the tag.

Request Parameters

Is the parameter mandatory? Parameter Name Parameter Description
yes token  see here
yes store_department_id  see here
yes tag  Tag that variables are linked to 
yes vars  List of variables to be deleted

Request Example

http://sailplay.net/api/v2/tags/vars/delete/?tag=global&vars=key1,key2&store_department_id=3132&token=0e96be0867401601dfac6e8691476bfaaa73f3a7

Server Response Example

{"status": "ok", "deleted_count": 2}

/api/v2/tags/vars/get/ - receive information about variables linked to the tag

Method's Use

The method allows receiving the list and values of variables linked to the tag.

Request Parameters

Is the parameter mandatory? Parameter Name Parameter Description
yes token  see here
yes store_department_id  see here
yes tag  Tag that variables are linked to 
yes vars  List of variables for which you need to receive information 

Request Example

http://sailplay.net/api/v2/tags/vars/get/?tag=global&vars=key1,key2&store_department_id=3132&token=0e96be0867401601dfac6e8691476bfaaa73f3a7

Server Response Example

{
    "status": "ok",
    "vars":{
            "key1": "value1",
            "key2": "value2"
        }
}

/api/v2/tags/vars/set/ - set information about variables linked to the tag

Method's Use

The method allows editing variables linked to the tag.

All variables are processed by the server as strings.

When sending a long string in the variable's value (for example, HTML code), it is recommended to send parameter vars in the POST part of the request.

Request Parameters

Is the parameter mandatory? Parameter Name Parameter Description
yes token  see here
yes store_department_id  see here
yes tag  Tag that variables are linked to
yes vars  List of variables in the format of JSON-object.

Request Example

http://sailplay.net/api/v2/tags/vars/set/?tag=global&vars={“key1”:”value1”,“key2”:”value2”}&store_department_id=3132&token=0e96be0867401601dfac6e8691476bfaaa73f3a7

Server Response Example

{"updated_count": 0, "created_count": 1, "status": "ok"}

 

/api/v2/tags/use/ - assign tag to the audience

Method's Use

The method allows assigning the tag specified in the parameter  use_tag, (and run the chain linked to it) for the tag's audience, specified in the parameter for_tag..

This mechanism is an equivalent of trigger mailings where the audience is defined by the tag.

Let's take a look at the implementation of the notification about the arrival of the expected product:

When the user clicks on the button "Tell me when iPhone 7 arrives" (s)he is assigned the tag 
"Expecting iPhone 7" and the variable for this tag item_name = "iPhone 7".
SailPlay sets up the tag chain "The expected product has arrived".
The email text includes the structure $[this["item_name"]] that
will be substituted with the value of the variable item_name of the tag specified in the parameter for_tag.
When the product arrives we call the method use with parameters  use_tag =
"The expected product has arrived" and for_tag = "Expecting iPhone 7". All clients with the tag
"Expecting iPhone 7" will be assigned the tag "The expected
product has arrived". They will be sent an email where  $[this["item_name"]] will be substituted with "iPhone 7".

Assigning the tag and completing actions of the chain is executed in turn and it can take some time.

The size of the audience for this method is limited by 20,000 people.

Request Parameters

Is the parameter mandatory? Parameter Name Parameter Description
yes token  see here
yes store_department_id  see here
yes use_tag  The assigned tag with the chain to be executed.
yes for_tag  The tag assigned to the audience that will receive the tag from the parameter use_tag.

Request Example

http://sailplay.net/api/v2/tags/use/?use_tag=The expected product has arrived&for_tag=iPhone 7&store_department_id=435&token=b3c7ac443b9b93bf4daa20f5429a255b5f77bb4b

Server Response Example

{"status": "ok","message": "job in queue"}