Below is the flow diagram from https://cloud.google.com/dialogflow/docs/fulfillment-overview
How to pass request headers from custom chatbot client (integration [2]) to my webhook service[5] through dialogflow API service [4].
I use the RPC call to send the user query (text entered by user in chatbot) to DF API service:
const dfResponses = await sessionsClient.detectIntent(queryRequest);
responseBody = dfResponses[0].queryResult;
queryRequest has below structure:
const queryRequest = {
session: sessionPath,
queryInput: {
text: {
text: queryText,
languageCode,
},
},
};
I don't see a way through which I can pass headers to my webhook service from by chatbot widget.
Thanks in advance! :)
UPDATE:
Based on the below comment by @Prissoner, I am now trying to pass my auth token to my webhook through queryParams.payload
So now my queryRequest is like below:
session: sessionPath,
queryInput: {
text: {
text: queryText,
languageCode,
},
},
queryParams: {
payload: {
authToken
}
},
};
On calling sessionsClient.detectIntent(queryRequest), I expect request.originalDetectIntentRequest.payload to have the authToken in the webhook request. But then request.originalDetectIntentRequest.payload is an empty object.

jwt tokenthroughAuthorizationheader. I want to control the information that the webHook sends back as response based on whether the user is logged in or not. - Praveen Dass