Push Data to Chatbot via URL
If you are looking for a method to update data or to go to a block with just a click of your website URL or Facebook m.me link, this article will bring you the answer. The External Link is a feature that helps bot builders to:
Trigger users to a specific block in your chatbot: whenever customers click the link, they will be directed to the web page on your website and the chatbot there will start from the block you have chosen.
Update user data in User Attributes and Variable: External Link supports Update customers’ data in the User Attribute and Variable automatically when they click the link.
Note: Before starting to learn how to create an external link, you will need to know:
- This document assumes that you have already published your chatbot into your Website or Facebook page. The external link of the website/Facebook page will only work with the chatbot that has been published on it.
- Your customers only need to click the external link and their data will be automatically updated without opening the bot.
- The External Link will not affect the current chatbot on that web page.
Example
It is essential to know how External Link works in our system. For example, your company is running a Campaign for female customers and you promote your product on a lot of websites, social media sites. So, you want to know where your visitors come from
Based on the requirements that we have above, you will need to create an external link for female customers that choose black color products from Facebook ads. That link will have a specific formula and order for each part like the example below:
https://example.com?bs_ref=block:s58fa63fe-6791-42bf-8674-fd4c377aa44f;user:gender:female;user:Source:Facebook;variables:Color:Black
Note: This URL link will not work, it is just used to show as an example.
Let break this down! There are 05 parts of the above External Link:
Part | Example |
---|---|
Website | https://example.com |
BotStar signature in URL parameters | ?bs_ref= |
Block ID | block:s58fa63fe-6791-42bf-8674-fd4c377aa44f; |
User Attributes | user:gender:female; |
user:Source:Facebook; | |
Variable | variables:Color:Black |
After creating this External Link, when a customer clicks it, they will be triggered to the website https://example.com. When they click the bot, the conversation will start the flow from the block which has the ID: s58fa63fe-6791-42bf-8674-fd4c377aa44f.
User Attribute about gender
called System User Attributes and user attribute Source
called Custom User Attributes will automatically be updated into female
and Facebook
accordingly. Finally, the variable color
will have the value black
This is how your customer data will be shown when they click the External Link:
Create an external link
You have known how the External Link works through the example above. Now, let's get to discover how to build an External link for your own Website and Facebook Messenger
External Links for Websites
To set up an External Link, follow the format below:
Website: fill in your website URL
BotStar signature ?bs_ref=
Block: block:block ID;
The first message of the conversation will start from the provided block ID. You can get the block ID by clicking on the block, the ID field is in the Properties Panel.
If there is no block ID added into the External Link, to new chat users, the bot will trigger the default block which is located right after the entry block, and follow the flow from there. And regarding current chat users, the bot will show the previous conversation history between them and the chatbot.
User Attributes: user:[user attribute]:[Value of attribute];
Regarding the user Attribute, there are some types of format that you will need to follow, which are System User Attributes and Custom User Attributes.
The User Attribute type called System User Attributes, which is located at the top left side of customer information in the Audience feature, you will need to type in this exact format, or else the information will not be updated.
- first Name
- last Name
- user ID
- gender:male/ female/ unknown
- birthday: yyyy-mm-dd
If you want to create our own user attribute called Custom User Attributes, then you will need to create a user attribute in the Bot Builder. Please remember that you will need to replace the “Space between two words into "%20" in the external Link
If there is no User ID in the External Link, the system will get the user_id which is saved before. If the chat user is a new one, the bot will create a new User ID.
Variables:variables:[variable name]:[Value of the variable];
Note:
- You may change the order of
User Attributes
andVariables
without interrupting the link. If you want to add more attributes, you’ll need to use the semicolon “;” between them. At the end of the External Link, do not put any dot (.).- You can also create the attributes by using codes that would help you manage the customers’ information easily.
External Links for Messenger
https://m.me/104131861279735?ref=block:s58fa63fe-6791-42bf-8674-fd4c377aa44f;user:email:botstar@email.com;variables:BotStar_Feature:Good
Similarly, to set up an External Link for Messenger
, you have to follow the below format:
Messenger link: fill in by the m.me link
. Click on Publish
> Share
> Messenger
> copy the URL
BotStar signature: ?ref=
Block: block:[block ID];
User Attributes: user:[user attribute]:[Value of attribute];
- first Name
- last Name
- user ID
- gender: male/ female/ unknown
- birthday: yyyy-mm-dd
Variables:variables:[variable name]:[Value of the variable];
Congrats! You've just learned how to set up the External Links. Wish you a wonderful experience with this feature!
If you have any concerns, please feel free to leave a comment below or contact us through support@botstar.com. For more details on how we have helped our customers grow their business, you can view our use cases, blogs or join our BotStar community to learn and share new things 😊