Transfer custom variables during a chatbot subscription
Integrating SendPulse with messaging apps allows you to pass custom variables to your SendPulse account when a user subscribes to your chatbot through a website widget or chatbot link. Use this feature to automatically update variable values in your chatbot Audience.
You can also send UTM tags during a subscription. Your chatbot's Audience saves every subscriber’s UTM values to variables.
Transfer of chatbot subscription data varies based on the platform:
- Live chat, Facebook, Instagram, and Telegram transfer variables through website widgets and subscription links.
- WhatsApp transfers variables if a user clicks your subscription link and then sends a predefined message manually. If they only follow the link, WhatsApp will not transfer their variables.
- Viber transfers variables only if a user opens your chatbot in the app.
Subscription through a live chat or widget
The JavaScript code in live chat and subscription widgets can automatically detect and save UTM tags.
When a user visits your website through a link with UTM tags, formatted using ? and &, these tags will be automatically saved to this user’s contact data once they subscribe.
To transfer more tags or custom variables, use one of the two methods described below.
Keep in mind that to transfer variables, you need to create them in the Audience tab first. Data sent to non-existent fields will be disregarded.
Variable names, such as {{name}} or {{city}}, must match those in your script exactly, including letter case. System variables like {{phone}} and {{email}} don’t need to be created manually.
Method 1. Using the window.oSpP script
Once you’ve created a live chat or subscription widget, you can use a script to automatically transfer variables during a chatbot subscription. Here’s what it can look like:
<script type="text/javascript">
window.oSpP = {
phone: '+123123123',
email: 'username@example.com',
name: "Annabelle",
city: "London"
}
</script>
Suppose that your website, linked to a chatbot, receives a visitor's data, such as name, city, email, or phone. If this visitor then subscribes to your chatbot, it will receive and save their data to variables.
If a customer subscribes to your chatbot before their phone, email, city, and name variables are added, their data will not be saved to your SendPulse account.
You can automatically show subscriber names in conversations by passing them from your live chat. To do this, use the window.oSpP.full_name parameter in your script:
<script> window.oSpP = { full_name: "Anabelle Cane", city: "London" } </script>
Contacts will immediately appear with their specified names from Conversations and Audience.
If you collect additional web push subscriber variables using window.oSpP, it may interfere with your chatbot’s variable collection widget, causing it to malfunction. To avoid this, use an alternative method.
Method 2. Using hidden input fields
This method is applicable to subscription widgets.
Add additional fields with the sp_push_custom_data class to your website:
<input type="hidden" name="email" class="sp_push_custom_data " value="username@example.com">
<input type="hidden" name="phone" class="sp_push_custom_data " value="+123123123">
<input type="hidden" name="name" class="sp_push_custom_data " value="Annabel">
<input type="hidden" name="city" class="sp_push_custom_data " value="London">
Both methods are applicable to websites running on any CMS.
Subscription through a link
You can also pass variables during a subscription if you add them to your chatbot link using the delimiters listed below. All parameters in the examples are optional.
This method helps pass UTM tags, email addresses, phone numbers, or any other custom variables. When a user follows the link and starts a conversation, variable values will be automatically saved to that subscriber’s profile in your chatbot’s Audience.
You can copy a link sample for every messaging app. Read more: Launch a bot via a link or QR code.
In Telegram chatbot links, add the tg.pulse.is intermediate domain since Telegram limits the format and length of transferred data. Your link will look like this:
https://tg.pulse.is/{bot_name}?start={flow_id}&var1_name=value1&var2_name=value2&utm_campaign=summer_sale&utm_medium=banner
Here, {bot_name} is your Telegram chatbot’s name, {flow_id} is the ID of the flow to be triggered, var_name is a variable name from your chatbot’s Audience, value is the value to be passed, and utm_campaign and utm_medium are optional UTM parameters.
WhatsApp chatbot links include an intermediate domain, wa.pulse.is. Your flow will start only when a user sends a preset message, such as “Start” or any other message that you can customize. Your link will look like this:
https://wa.pulse.is/{bot_owner_phone_number}?start={chain_id}&text=Start&var1_name=value1&var2_name=value2&utm_campaign=summer_sale&utm_medium=banner
The text= parameter is required. Your link will not work without it.
A Facebook chatbot link that passes additional variables will look like this:
https://m.me/{page_id}?ref={flow_id}__var1_name=value1__var2_name=value2__utm_campaign=summer_sale__utm_medium=banner
An Instagram chatbot link that passes additional variables will look like this:
https://ig.me/{bot_name}?ref={flow_id}__var1_name=value1__var2_name=value2__utm_campaign=summer_sale__utm_medium=banner
Viber chatbot links only work on devices with the app installed. Your link will look like this:
viber://pa?chatURI={bot_name}&context={flow_id}|var1_name=value1|var2_name=value2|utm_source=summer_sale|utm_medium=banner
Subscription through a website form
Redirect users to your chatbot once they fill out the form on your SendPulse-powered website, and send data to your chatbot audience.
Go to your chatbot, click the three dots, and copy your flow link. Use this link in your form settings.
Variables in your chatbot audience must match your form field names exactly.
Read also: Customize the confirmation page: Go to page.
Last Updated: 08.08.2025
or