How to receive the payload passed from the app


This documentation describes how to pass events from the app to the bot. But I’m unable to figure out how to receive it on the bot side?

1 Like

Hey @akri16
Can you please share more information about the use case you’re trying to implement here? Also, please share the link to the document you’re referring here.

Hi , in cloud we can try to create payload like this

</head>
<body>

    
<script type="text/javascript">
  window.ymConfig = { bot: 'x1646748034386', host: 'https://r2.cloud.yellow.ai' , ymAuthenticationToken: 'James_0011', payload: 
  
  {
    "Name": "Jack jamie",
	"JourneySlug": "MobileRechargePending",
	"Languange": "en",
	"config": null,
	"memo": "",
	"result": {
        "success": true,
    },
    "resultStatus": 1000
}
  
  
  ,'pwa': true};  (function () {var w=window,ic=w.YellowMessenger;if("function"===typeof ic)ic("reattach_activator"),ic("update",ymConfig);else{var d=document,i=function(){i.c(arguments)};function l(){var e=d.createElement("script");e.type="text/javascript",e.async=!0,e.src="https://cdn.yellowmessenger.com/plugin/widget-v2/latest/dist/live.min.js";var t=d.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)}i.q=[],i.c=function(e){i.q.push(e)},w.YellowMessenger=i,w.attachEvent?w.attachEvent("onload",l):w.addEventListener("load",l,!1)}})();
</script>

</body>
</html>

and in the bot , for example in Variables node we can access like this : {{{profile.payload.JourneySlug}}}
while in code you can check
app.log("--------PAYLOAD-------", app.profile.payload)

hope it helps, but again as Pratik said you need to define your use case to get better answer. Thank you.

1 Like

Thank you @bita for helping fellow community members! :tada:

1 Like