|
|
@@ -13,4 +13,36 @@ SMTP 密码:ofgfjztgxvgkbiaa
|
|
|
|
|
|
三 n8n 配置
|
|
|
|
|
|
+工作流配置:
|
|
|
+使用 webhook 生成地址 作为 chatwoot 的机器人地址,分测试和正式版
|
|
|
+生成 一个过滤
|
|
|
+{{ $json.body.message_type }} 等于incoming 说明:避免机器人自己聊天
|
|
|
+{{ $json.body.private }} 等于false 说明:避免客服的私聊模式进入工作流
|
|
|
+{{ $json.body.conversation.status }} 等于 pending 说明:当客服介入聊天后,工作流停止
|
|
|
+
|
|
|
+生成 HTTP Request 关联 dify
|
|
|
+Method 选择 post
|
|
|
+URL 选择 http://47.109.158.218:8088/v1/chat-messages 说明:这个是 dify 的聊天信息
|
|
|
+开启Send Headers
|
|
|
+设置Authorization 为Bearer app-ieGbmugS3yP7tzFESP56KWD7 说明 这个是 dify 的聊天api-key
|
|
|
+设置Content-Type 为application/json
|
|
|
+开启Send Body
|
|
|
+选择 json
|
|
|
+配置 json
|
|
|
+```
|
|
|
+{{ { "inputs": {}, "query": $json.body.content, "response_mode": "blocking", "user": $json.body.account.name } }}
|
|
|
+```
|
|
|
+
|
|
|
+生成 HTTP Request 关联 chatwoot
|
|
|
+Method 选择 post
|
|
|
+URL 选择 `http://47.109.158.218:3000/api/v1/accounts/{{ $('Webhook').item.json.body.account.id }}/conversations/{{ $('Webhook').item.json.body.conversation.id }}/messages`
|
|
|
+说明:这个是 chatwoot 的聊天信息,其中`{{ $('Webhook').item.json.body.account.id }}`是跨表获取的 webhook 第一次传入的参数
|
|
|
+开启Send Headers
|
|
|
+设置api_access_token 为mmFb9KQVxKFemRBQ168w3Tzb 说明 这个是 chatwoot 的访问令牌
|
|
|
+设置Content-Type 为application/json
|
|
|
+开启Send Body
|
|
|
+Body Content Type为JSON
|
|
|
+Specify Body为Using Fields Below
|
|
|
+配置content为{{ $json.answer }}
|
|
|
+
|
|
|
四 dify 配置
|