Participant Data in Webmessaging

How do I get data passed from the page on which the bot is located to the Bot Flow.

I'm trying to do the following -

On the html page where the Webmessaging script has been added, I've added another script as follows to get a header element

<script type="text/javascript" charset="utf-8">
  var req = new XMLHttpRequest();
  req.open('GET', document.location, false);
  req.send(null);
  var user_data = req.getResponseHeader('user-data').toLowerCase();
  Genesys("command", "Database.set", { messaging: { customAttributes: { token2: user_data }}});
</script>

This is supposed to set Participant Data which I should be able to get via Get Participant Data Action and pass it on to the bot flow as a variable.

Question is, I don't see the token2 attribute anywhere to be able to use it. Where do I find that attribute to put its value in a variable?

Hello Rishia,

The custom data will be automatically added with the next message sent with the WebMessaging client.

When this message will be process by the flow, you will have access to the token2 value .

May be you can make a test with fix value to make sure you are able to access it . And after update your code to use a variable.

regards

Fred

Thanks Fred for the quick response, I've done the following and able to get the data

  1. Added this snippet to the head of the page on which the bot is located

     <script type="text/javascript" charset="utf-8">
           Genesys("command", "Database.set", { messaging: { customAttributes: { token1: "this is from the web page" }}});
         </script>
    
  2. Thru a Messenger Deployment configured an Inbound Message initial flow to include a "Get Participant Data" action to pass on the Attribute "token1" to a variable called "Flow.token1" which is available in the Inbound Message Flow.

  3. After the "Get Participant Data" I'm calling a "Call Bot Flow" action and passing the "Flow.token1" value to an Input variable in the Bot Flow called "Flow.token"

  4. In one of the Intents within the Bot Flow, I'm displaying the value of "Flow.token" in a "Communication" action.

  5. I get "this is from the web page" as a response.

Glad to read you find the solution

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.