0

I want to be able to add a user's token when using the Dialogflow messenger chatbot

<script src="https://www.gstatic.com/dialogflow-console/fast/messenger-cx/bootstrap.js?v=1"></script>
<df-messenger
  df-cx="true"
  location="us-central1"
  chat-title="first test4"
  agent-id="AGENTID"
  language-code="en"
></df-messenger>

I tried the following

const dfMessenger = document.querySelector('df-messenger');
dfMessenger.setAttribute("user-id","ANYTHING");

but it is not sent to my webhook

Any idea how I can pass data from my browser to the webhook request body sent by the messenger?

Dev138
  • 334
  • 1
  • 13

1 Answers1

0

It worked for me:

dfMessenger.setAttribute("user-id","6666666666666");

Print the request body in webhook and see {'payload': {'userId': '6666666666666'}}

Refer this: Google Cloud Docs

blazej
  • 927
  • 4
  • 11
  • 21