Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Pass JWT token paramater to Google Dialogflow

Hi,

I created a chatbot agent on Google Dialogflow CX, I use Custom SSO to make users logged in to the page that chatbot embedded. When user logged in there is a JWT token in browser local storage.
I want to pass JWT token to the chatbot agent.
At the end of the story I want to use username (extracted from JWT token) in my responses for example Hi John.
How can I do it?

Thanks.

Solved Solved
0 2 682
1 ACCEPTED SOLUTION

Hi @oozturkplus ,

Welcome to Google Cloud Community!

While you can't directly access browser local storage from Dialogflow CX you can try this workaround that might help you with your use case: 

Pass the JWT to the Chatbot - The JWT can be sent to your Dialogflow CX agent using custom payloads or through query parameters. 

Extract JWT in Dialogflow CX - Extract the JWT from the payload, decode it to retrieve the username, and store the username in a session parameter for use in chatbot responses.

Use the username in the responses - In Dialogflow CX, use the session parameters to personalize responses with the extracted username. 

For more information about Dialogflow CX, you can read this documentation.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.

View solution in original post

2 REPLIES 2

Hi @oozturkplus ,

Welcome to Google Cloud Community!

While you can't directly access browser local storage from Dialogflow CX you can try this workaround that might help you with your use case: 

Pass the JWT to the Chatbot - The JWT can be sent to your Dialogflow CX agent using custom payloads or through query parameters. 

Extract JWT in Dialogflow CX - Extract the JWT from the payload, decode it to retrieve the username, and store the username in a session parameter for use in chatbot responses.

Use the username in the responses - In Dialogflow CX, use the session parameters to personalize responses with the extracted username. 

For more information about Dialogflow CX, you can read this documentation.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.

Please let me know how to use the Token, I never user or if you send the number