You're never really done for, as long as you‘ve got a good story and someone to tell it to.

为你的兔小巢加上实时消息推送-飞书部分代码

为你的兔小巢加上实时消息推送(完整版)

飞书使用的函数代码
'use strict';
const request = require("request")
const productId = ""
const botUrl = ""
function requestPromise(r,t){return new Promise(function(e,n){request({uri:r,method:"POST",body:JSON.stringify(t)},function(r,t,i){if(r)return n(r);try{e(i)}catch(r){n(r)}})})}

exports.main_handler = async (event, context, callback) => {
    const txcData = JSON.parse(event.body);
    if (txcData.type == "post.created") {
        await requestPromise(botUrl, {
            "msg_type": "interactive",
            "card": {
                "config": {
                        "wide_screen_mode": true,
                        "enable_forward": true
                },
                "elements": [{
                        "tag": "div",
                        "text": {
                                "content": txcData.payload.post.content,
                                "tag": "lark_md"
                        }
                }, {
                        "actions": [{
                                "tag": "button",
                                "text": {
                                        "content": "点击查看详情 :玫瑰:",
                                        "tag": "lark_md"
                                },
                                "url": `https://support.qq.com/products/${productId}/post/${txcData.payload.post.id}`,
                                "type": "default",
                                "value": {}
                        }],
                        "tag": "action"
                }],
                "header": {
                        "title": {
                                "content": "新增用户反馈",
                                "tag": "plain_text"
                        }
                }
            }
        } )
    }
    return "ok"
};
# 兔小巢  

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×