Share button and passing attributes to ref url

(Prakhar Monga) #1

I want my users to share the bot link with their friends.
I want to add a ref parameter where the user invited will land in the flow after clicking, I also want to add userId of the person who is referring. for example:{{flowname}}&userId={{userId}}.

how is it possible?
(I know the share button can be generated by using a custom request.)

(Daniel Beckett) #2

Are you generating the link in the bot and sending it through the bot?

(Prakhar Monga) #3

yes, I want the user to click and share from the bot.
the link is simply a ref link pointing to flow the only thing I want to add is userId of the person who is referring.
How to create a ref link?

(Daniel Beckett) #4

The format you were using is pretty much right. Just make sure you are choosing the output from your trigger by using the ‘XO’ icon to select from the output list.

For Facebook it also only accepts a single ?ref value so you won’t be able to specify both flow name and user ID in the same link.

(Prakhar Monga) #5

i did not understand output from trigger.
I want my users to go to a certain flow when they click on ref link button.

it is possible in other bot platforms like manychat and chatfuel. i Have seen this.

(Daniel Beckett) #6

There are the Web Tools that can be used to create links for specific flows but this is a bit different to what you’ve described.

Since you want to create the ref link for each user dynamically within the flow you’re going to need to use a bit of a workaround since Facebook only reads the first appended parameter on the URL, e.g. a single ?ref value.

As a workaround to this limitation you could separate ref values by a character and then use the Text (String) service to split the values once you receive the Metadata. For example, you could use a URL like:

I’m separating 1, 2, 3 & 4 by using a hyphen.

In my flow the Metadata will come through as:
“ref”: “1-2-3-4”

This means that I can add an action to Split the Text where I grab the ref value {{new_message.metadata__ref}} and use the hyphen a the separator.

On the output from the split text action I get each value:

These could be used to save to an Attribute or placed into other actions.

You can then have a master flow that splits the values from the URL, records the User ID that did the referral and then triggers the relevant flow.

1 Like
(Prakhar Monga) #7

ok, i have created the link and its is like{{botId}}?ref=fxo_widget:{{random string}}
how to append user attributes to it for example is this right:{{botId}}?ref=fxo_widget:{{random string}}&att={{username}}-{{userId}}-{{something here}}-{{something here}}

(Daniel Beckett) #8

You will need to remove the second field - Facebook only picks up the first one. This means it would pickup ?ref and then not capture the &att part.

You want to send it all as one string:{{random string}}-{{username}}-{{userId}}-{{something here}}-{{something here}}

It also looks like you’re trying to use the bot ID in the link? You just want to use the one shown in the bot setup instead.

(Prakhar Monga) #9

The bot id is automatically generating in the link i created using webtools.
Is it right?
What i want to achieve is :
I want to put this link generated to a facebook share button so that user can share it with his friends and when the invited user clicks on it the flow triggered by this link will open and i want to set user attributes there like who has been invited by whom and then record that info to google sheets.
How to achieve this kind of functionality?

(Daniel Beckett) #10

Hi @Prakhar_Monga

It may be best to pick this up from the support desk. Could you please email and we’ll pick it up from there :slight_smile:

(Prakhar Monga) #11

Thanks a lot.
I mailed to the support team.


I have flows that does exactly what you are describing. Let me know if you still need this & I’ll share my flows.

(Prakhar Monga) #13

@Kloic it would be great if you could do that. I will be thankful to you.

(Chris L) #14

This is doable with a single ref field.

This is how I do it to pass any attributes in with the link:

Then, “Split Text” using seperator “__”

Now, set attributes:

(Prakhar Monga) #15

@Chris_L thanks a lot. Definitely give it a try