Recent searches


No recent searches

Allow Branch by condition to see custom fields/conversation fields set via the .js SDK, where the field was not asked for in a previous flow builder step



Posted Oct 02, 2024

I currently have a setup where the user clicks a button to apply for something and the application is actually served up out of our existing chat bot. This was a very handy and flexible way for us to not have to build out all kinds of tool tips.. people can click on something and the click passes in the context. The context allows me to route them to a specific response from the bot (we're using Dialogflow CX at the moment). 

That kind of behavior seems like it should be possible with Messenger. 

Here is the example from the Core API:

 

zE("messenger:set", "conversationFields", [  { id: "123456789", value: 100.50 }])


I can not understand how can I leverage in the flow builder field id 123456789 in the branch by condition, unless I first include that field in a request for more information step?

Nearly all the context data I'm passing in needs to be invisible to the end user. I'd like to pass in the URL they are on, what button they clicked on to launch the chat, what class of user they are (vip, regular etc). 

I found the setting that forces a specific Answer to load first regardless of the intent. So far so good. I name this Answer/flow 'answer_init' 

answer_init -> step 1 branch by condition if field 123456789 is "apply now" - transition to "apply now" answer/flow else, transition to general answer a question flow is a simple example of how context would route the chat to a specific answer before the user has even typed anything. 

I have already created a text field that is editable by end users, and I have created a ticket and saved a value into that field to be sure it exists.

However, when I go to the flow builder, I do not see this field as an option for using in the branch by condition logic.. the only Ticket Fields that exist for me to select are Name and Email?

The Core API documentation mentions setting fields before the web widget is opened:

"Also, if you want to make sure that your conversation fields were set properly before opening the messaging Web Widget, then you would call:

const openWidget = () => {  // your function to trigger messaging Web Widget to open} zE("messenger:set", "conversationFields", [  { id: "123456789", value: 100.50 }], openWidget)


Why can't I use a conversationField in the branch by condition without first using it in a more details step? In the example above, the whole idea is to set that data before the chat even opens? 

Here are the use cases:

VIP vs regular users.. a VIP I might always transfer right away to a live agent and a regular user I would first deflect through chat...

This specific VIP vs. regular user can be done via REST api call, but that means a hit to our db for every chat window opened. 

I have that data already available on the front end, I would like to just pass it to the chatbot, along with the URL they are currently on, possibly a button that was clicked to ask about a specific topic... there are a lot of use cases for the front end to pass context into the chatbot that allow us to start at a specific Answer, or end an existing conversation, and start over at a given Answer. 

Let me know if I missed something obvious, but no matter what I've looked at, read or asked of Chat GPT..nothing seems to indicate what I want to do is possible:

Use the .js api to set a field, tag, or variable such that I can use that field, tag or variable in a branch by condition step without first including that field/tag/variable in some other step.
 


1

2

2 comments

image avatar

Shawna James

Community Product Feedback Specialist

Hey Jason,
 
Thank you for taking the time to provide us with your feedback. This has been logged for our PM team to review. For others who may be interested in this feature request, please add your support by upvoting this post and/or adding your use case to the comments below. Thank you again!

0


Hey Jason,

 

did you manage to get a workaround around this ? I have the same need, where i need. I need to use branch condition on a conversationFields. The only workaround i found is : 

 

  • Have a ask for detail step, which is prefilled (but it is definitely not necessary and require a click from enduser)
  • Make an API call to retrieve the information, but you can actually call Zendesk Sunshine conversation API, please see workaround explanation below

     

My use case is fairly simple, i want to get the country of the user to route him toward the correct Business hours , hence support team.
 

Workaround explanation : 

1. You need to use a “Make API Call” in your bot builder flow 

2. Call the “Sunshine Conversation API” https://docs.smooch.io/rest/#operation/getConversation

3. Save the field in metadata you need as a variable (for instance zen:ticket_field:123456789) 

4. Reuse the variable afterwards

 

 

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post