xgqfrms

企业微信如何添加机器人 All In One

jira 问题同步到群里

https://weibanzhushou.com/blog/330#:~:text=开启企业微信内部群,可发现添加机器人按钮。

webhook 调用地址

https://zhuanlan.zhihu.com/p/66312814

cURL test OK

https://work.weixin.qq.com/help?doc_id=13376

curl \'http://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=633a31f6-7f9c-4bc4-97a0-xxx\' \
   -H \'Content-Type: application/json\' \
   -d \'
   {
        "msgtype": "text",
        "text": {
            "content": "hello world"
        }
   }\'

jira

cURL to Fecth



demo

const wxRobot = (params = {}, desc = \'\') => {
    // const witheList = [\'xgqfrms\',];
    const url = \'/qywx/cgi-bin/webhook/send?key=???\';
    // 测试 robot
    // const url_test = \'/qywx/cgi-bin/webhook/send?key=???\';
    const obj = {
        msgtype: \'markdown\',
        markdown: {
            content: `
description: ${desc}\n
data: ${JSON.stringify(params, null, 4)}\n
            `,
        },
    };
    const options = new Blob(
        [JSON.stringify(obj)],
        {type : \'application/json\'}
    );
    if(navigator.sendBeacon) {
        navigator.sendBeacon(url, options);
        // navigator.sendBeacon(url_test, options);
        // const {
        //     user,
        // } = params;
        // if(witheList.includes(user)) {
        //     navigator.sendBeacon(url_test, options);
        // }
    } else {
        // fallback
        fetch(
            url,
            {
                method: \'POST\',
                mode: \'no-cors\',
                headers: {
                    \'Content-Type\': \'application/json\',
                },
                body: JSON.stringify(obj),
            },
        ).catch(err => console.log(\'fetch error\', err)).finally(() => \'\');
    }
};

export {
    wxRobot,
};

// export default wxRobot;


refs

企业微信机器人

群机器人配置说明 - 企业微信API

https://work.weixin.qq.com/api/doc/90000/90136/91770



©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载

分类:

技术点:

相关文章:

  • 2021-08-07
  • 2022-01-23
  • 2021-11-18
  • 2022-12-23
  • 2021-11-26
  • 2021-11-29
  • 2022-03-10
  • 2022-12-23
猜你喜欢
  • 2022-01-02
  • 2022-01-06
  • 2021-11-24
  • 2021-07-12
  • 2021-12-29
  • 2022-12-23
相关资源
相似解决方案