How to Transfer Custom Variables During a Subscription to a Chatbot

SendPulse's Facebook Messenger integration allows you to transfer {{phone}} and {{email}} variables to a SendPulse account during a subscription to a Facebook chatbot.

Using this method, you can pass values for existing variables in the сhatbot's "Audience".

Please note that the variable transfer when subscribing to a chatbot currently only works for Facebook and Telegram chatbots. When following an Instagram and WhatsApp chatbot, you cannot pass custom variables.

You can set up the transfer of variables with two methods.

Method 1

After adding the code of a Facebook chat widget, add the following code to the site:

<script type="text/javascript">
    window.oSpP = {
        phone: '+123123123',
        email: ''

If customers subscribed to the chatbot and after that the {{phone}} and {{email}} variables were added for these customers. Their data will not be transferred to the SendPulse account.

Please note: if you added a method for passing additional variables for web push notification subscribers using window.oSpP, there may be conflicts with the widget for collecting additional variables for the chatbot, and widget may not work.

Method 2

Add additional input fields with the sp_push_custom_data class to the site:

<input type="hidden" name="email" class="sp_push_custom_data " value="">
<input type="hidden" name="phone" class="sp_push_custom_data " value="+123123123">

Both methods are universal for sites on any CMS.

Rate this article about "How to Transfer Custom Variables During a Subscription to a Chatbot"

User Rating: 4 / 5 (7)

    Other useful articles

    Popular in Our Blog

    Try a free chatbot for Facebook Messenger