Dialogflow es 如何在Dialogflow中检测意图文本API中发送accessToken
我正在使用Python中的detect intent API开发我的聊天机器人后端,一旦识别出意图,它就会转到我的webhook并获取适当的数据 这是我从文本中获取数据的检测代码Dialogflow es 如何在Dialogflow中检测意图文本API中发送accessToken,dialogflow-es,actions-on-google,Dialogflow Es,Actions On Google,我正在使用Python中的detect intent API开发我的聊天机器人后端,一旦识别出意图,它就会转到我的webhook并获取适当的数据 这是我从文本中获取数据的检测代码 def detect_intent_texts(project_id, session_id, text, language_code='en-US'): session_client = dialogflow.SessionsClient().from_service_account_file( 'my
def detect_intent_texts(project_id, session_id, text, language_code='en-US'):
session_client = dialogflow.SessionsClient().from_service_account_file(
'my_service_account_json.json')
session = session_client.session_path(project_id, session_id)
print('Session path: {}\n'.format(session))
text_input = dialogflow.types.TextInput(text=text, language_code=language_code)
query_input = dialogflow.types.QueryInput(text=text_input)
response = session_client.detect_intent(session=session, query_input=query_input)
data = MessageToDict(response.query_result)
print (json.dumps(data, indent=4))
response = parse_response(data)
return response
我如何发送access_令牌,以便我的webhook能够识别
哪个用户正在访问bot
p.S.我的webhook正在该路径中查找访问令牌
req.get("originalDetectIntentRequest").get("payload").get("user").get("accessToken")
“有效载荷”属性下的所有内容都取决于平台。例如,助手平台将用户信息放在这里,这就是您的webhook当前试图处理的内容
如果要将访问令牌放在同一位置,可以将query\u params
命名参数与正在查询的文本以及任何其他相关内容一起传递给调用detect\u intent()
。()该参数可以是dict,如果是,则必须具有与对象相同的字段名