I am just starting out with dialogflow and trying to build a flutter e-commerce app with dialogflow playbooks.
I want it to be personalized so that different brands can ask questions only related to their data and not others.
I am sending the userid via
Future<String> sendMessage(String sessionId, String message) async {
try {
final dialogflow = await AuthClient.getDialogflowApi();
final sessionPath =
'projects/$projectId/locations/$location/agents/$agentId/sessions/$sessionId';
final queryInput = df.GoogleCloudDialogflowCxV3QueryInput(
languageCode: 'en',
text: df.GoogleCloudDialogflowCxV3TextInput(text: message),
);
logs show it as
{
"insertId": "2a73yadnmoh",
"jsonPayload": {
"queryInput": {
"text": {
"text": "what products do I have"
},
"languageCode": "en"
},
"session": "projects/***/locations/global/agents/***/sessions/userid_is_here"
},
"resource": {
"type": "global",
"labels": {
"project_id": "***"
}
},
"timestamp": "2025-01-29T19:25:27.261958Z",
"severity": "INFO",
"labels": {
"agent_id": "***",
"environment_id": "",
"session_id": "userid_is_here",
"location_id": "global"
},
"logName": "---",
"receiveTimestamp": "2025-01-29T19:25:27.977275078Z"
}
with the userId being sent as $sessionId
Now, the Dialogflow is directly connected to a playbook, which uses the Openapi tool to send the question to a cloud function, which gets the answer from my big query database.
I have only used playbooks until now with no flows etc
How do I get the sessionId and send it to the cloud function?
Hi @Tayyibl,
Welcome to Google Cloud Community!
It looks like you are trying to pass your session ID (which you are using as a user ID) from Dialogflow to your cloud function. This cloud function is being used in your Dialogflow playbook through the OpenAPI tool, allowing you to personalize the data returned from BigQuery based on the user.
Here are the potential ways that might help with your use case:
You may refer to the documentation below, which offers information on Google Cloud’s Cloud Run, BigQuery, and Dialogflow Sessions:
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.
Hi @MarvinLlamas ,
Thank you for your response.
Could you please clarify how to do these steps
Ive made changes to my open API and tried to send the session id along with the question