add push webhook
continuous-integration/drone/push Build is passing

This commit is contained in:
jianxin committed 2025-03-26 18:49:29 +08:00
1 parent 0e315a6cae
commit 28740517cf
3 files changed
+374 -3

No files matched your search

+17 -2
View File
@@ -131,8 +131,9 @@ def do_bitable_record_add(data) -> None:
if field.get("field_id") == "fldaxMbywh":
# 有可能值为空
if field.get("field_value"):
action_data["deal_person"] = json.loads(field.get("field_value")).get("users")[0].get("name")
action_data["deal_person"] = (
json.loads(field.get("field_value")).get("users")[0].get("name")
)
print(f"table_id: {table_id}")
print(f"record_id: {record_id}")
@@ -196,6 +197,20 @@ def create_app() -> Flask:
def index():
return {"test": "ok"}
@app.route("/webhook", methods=["GET"])
def push_xbot_activity_bot():
# 解析请求体中的json数据
data = json.loads(request.data)
print(f"webhook receive data: {data}")
open_id = data.get("open_id")
activity_code = data.get("activity_code")
if not open_id or not activity_code:
return {"status": "error", "msg": "open_id or activity_code is not exist"}
process_push_xbot_activity_bot.delay(activity_code, open_id)
return {"status": "ok"}
return app