feishu-飞书交互机器人开发
Posted 蝶泳奈何桥.
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了feishu-飞书交互机器人开发相关的知识,希望对你有一定的参考价值。
title: feishu-飞书交互机器人开发
categories: Feishu
tags: [飞书, api, 机器人]
date: 2021-10-16 16:06:26
comments: false
mathjax: true
toc: true
feishu-飞书交互机器人开发
前篇
- 官方
- 事件订阅概述 - https://open.feishu.cn/document/ukTMukTMukTM/uUTNz4SN1MjL1UzM
- 参考代码 - https://open.feishu.cn/document/home/develop-a-bot-in-5-minutes/coding
- 订阅事件列表 - https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-list
流程
-
创建 机器人应用
-
启用机器人
-
获取相关参数:
-
appid, app secret
-
Verification Token , Encrypt Key (非必须)
-
-
配置 请求网址
注意, 配置请求网址时, 需要启动好服务, 因为点击 保存 时, 飞书会去检测服务是否合法
接收数据
单聊
"schema": "2.0",
"header":
"event_id": "8b2c88ad4704eb90eca6d1113a4adbcd",
"token": "duxbbHtnGLampGhotmBg9ULesmHBDfBZ",
"create_time": "1634371309743",
"event_type": "im.message.receive_v1",
"tenant_key": "13cbf99e6a0f175e",
"app_id": "cli_a1d96e502478500c"
,
"event":
"message":
"chat_id": "oc_dc97f47a1cb562ab32e6504be5745adc",
"chat_type": "p2p",
"content": "\\"text\\":\\"11\\"",
"create_time": "1634371309564",
"message_id": "om_b6bec1170d06865491f374f594ce6be2",
"message_type": "text"
,
"sender":
"sender_id":
"open_id": "ou_acc48efbf7a13be212bf9e5b8bbd5a11",
"union_id": "on_4c95af379a29a957a02a66349eb3c6d4",
"user_id": "gag2a216"
,
"sender_type": "user",
"tenant_key": "13cbf99e6a0f175e"
群里 @ 机器人
"schema": "2.0",
"header":
"event_id": "aa25beadec35205718786f602bcd2661",
"token": "duxbbHtnGLampGhotmBg9ULesmHBDfBZ",
"create_time": "1634370421496",
"event_type": "im.message.receive_v1",
"tenant_key": "13cbf99e6a0f175e",
"app_id": "cli_a1d96e502478500c"
,
"event":
"message":
"chat_id": "oc_15ed0b49b1de8dac5542363ac4dec90d",
"chat_type": "group",
"content": "\\"text\\":\\"@_user_1 中国智造\\"",
"create_time": "1634370421100",
"mentions": [
"id":
"open_id": "ou_b32abc1a55f7bc597d8e5d25ea337eaf",
"union_id": "on_609321e054cf257f09540a10df6c15c2",
"user_id": ""
,
"key": "@_user_1",
"name": "bot-msg",
"tenant_key": "13cbf99e6a0f175e"
],
"message_id": "om_689890eb294f514e4acc84a83c955fc9",
"message_type": "text"
,
"sender":
"sender_id":
"open_id": "ou_acc48efbf7a13be212bf9e5b8bbd5a11",
"union_id": "on_4c95af379a29a957a02a66349eb3c6d4",
"user_id": "gag2a216"
,
"sender_type": "user",
"tenant_key": "13cbf99e6a0f175e"
文件消息
"event":
"message":
"chat_id": "oc_dc97f47a1cb562ab32e6504be5745adc",
"chat_type": "p2p",
"content": "\\"file_key\\":\\"file_v2_b611a01a-e2ca-4830-ac7e-017c9333212g\\",\\"file_name\\":\\"VIP玩家.xlsx\\"",
"create_time": "1635741623964",
"message_id": "om_d7471e5c1a60edc15ff60c3696fee787",
"message_type": "file"
,
"sender":
"sender_id":
"open_id": "ou_acc48efbf7a13be212bf9e5b8bbd5a11",
"union_id": "on_4c95af379a29a957a02a66349eb3c6d4",
"user_id": "gag2a216"
,
"sender_type": "user",
"tenant_key": "13cbf99e6a0f175e"
,
"header":
"app_id": "cli_a1d96e502478500c",
"create_time": "1635741624375",
"event_id": "35b237099dcbf86ee78ccd58cea31c92",
"event_type": "im.message.receive_v1",
"tenant_key": "13cbf99e6a0f175e",
"token": "duxbbHtnGLampGhotmBg9ULesmHBDfBZ"
,
"schema": "2.0"
以上是关于feishu-飞书交互机器人开发的主要内容,如果未能解决你的问题,请参考以下文章