如何从检测意图 API 触发 dialogflow 事件?

How can I trigger dialogflow event from detect intent API?

如何通过 python 检测意图 API 在 dialogflow 中触发事件。 我想在开始聊天后立即触发欢迎意图 window。

您需要将 "WELCOME" 事件作为查询输入的一部分发送到对 detect_intent() 的调用。它可能看起来像这样

import dialogflow

client = dialogflow.SessionsClient()

session = client.session_path('[PROJECT]', '[SESSION]')

event_input = dialogflow.types.EventInput(name='WELCOME', language_code='en-US')
query_input = dialogflow.types.QueryInput(event=event_input)
response = client.detect_intent(session=session, query_input=query_input)