Javascript Guide
Install
We provide our JS SDK via our CDN. Grab both the script and styles for it:
Setup
First you need to make sure you're setting the configuration. You do this with a call to window.initResubscribe():
The value of userId
MUST be unique. If you do not have a unique user id at the point you want to make this call, we recommend generating a random value prefixed with 'anonymous-' for every user
Now you can trigger Resubscribe to display by calling window.triggerResubscribe().
Configuration
You can pass the following parameters into openWithConsent.
Param name | Description | Default Value |
---|---|---|
aiType | This value affects how the AI interacts with the user. Options are 'intent' and 'churn'. They are described in the Overview page. | 'churn' |
consent.cancelButtonText | The text shown to the user on the button for declining to chat | 'Not right now' |
consent.description | The smaller text shown in the consent dialog before the user chats with our bot | Varies by aiType |
consent.primaryButtonText | The text shown to the user on the button for consenting to chat | 'Let's chat!' |
consent.title | The large text titling the consent dialog shown before the user chats with our bot | Varies by aiType |
slug | The short string identifying your organization | Required |
userId | A unique identifier for the user in question. | Required |
Headless
Resubscribe additionally supports a headless mode if you would like more control over the consent modal. This is not recommended.
Last updated