I have an existing and functional Chat Bot with Google Dialogflow CX. The Chatbot is directly integrated in a website by the Google Bootstrap.
In some cases a Python script must trigger an intent or page for the user from the backend. In that case the user (and his client) should directly jump in this intent. The session ID of the user is known.
So far I managed it to set a parameter for the user from the python script using the following code.
from google.cloud import dialogflowcx_v3beta1 as dialogflow
from google.cloud.dialogflowcx_v3beta1 import types
session_id = "7826e7-0b7-794-b24-b95271869"
api_endpoint = f"{location_id}-dialogflow.googleapis.com"
client_options = {"api_endpoint": api_endpoint}
client = dialogflow.services.sessions.SessionsClient(client_options=client_options)
event = "live_chat_event"
params = {'message': "Hello World"}
event_input = types.EventInput(event=event)
query_input = types.QueryInput(event=event_input, language_code=language_code)
query_params = types.QueryParameters(parameters=params)
request = types.DetectIntentRequest(
session=session_path,
query_input=query_input,
query_params = query_params
)
response = client.detect_intent(request=request)
print(response.query_result.response_messages[0])
These parameters are then visible by the user on his client, but only after typing the next message.
I need the client to refresh itself or let it jump directly into the next page without any additional input from the user.
How can that be achieved?