Popclip扩展-文本发送至企业微信

作者 : noise 发布时间: 2023-08-6

我使用的代码采用硬编码的形式,你只需要选中所有,popclip会自动识别,点击安装启用即可

需要注意的是代码中11行webhookUrl地址改为自己的企业微信bot webhook地址,完成后再安装

// #popclip extension for sending selected text to Enterprise WeChat webhook
// name: Send to WeChat
// icon: iconify:mdi:wechat
// language: javascript
// module: true
// entitlements: [network]

async function sendToEnterpriseWeChat(input) {
  const axios = require("axios");

  const webhookUrl = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=YOUR_KEY";

  try {
    await axios.post(webhookUrl, {
      msgtype: "text",
      text: {
        content: input.text,
      },
    });

    return "Text sent to Enterprise WeChat successfully!";
  } catch (error) {
    console.error("Failed to send text to Enterprise WeChat:", error);
    return "Failed to send text to Enterprise WeChat";
  }
}

exports.actions = [
  {
    title: "Send to WeChat",
    icon: "iconify:mdi:wechat",
    after: "copy",
    code: async (input, options) => sendToEnterpriseWeChat(input),
  },
];

    来自NOISE资源阁-noisevip.cn
    NOISE宝藏阁 » Popclip扩展-文本发送至企业微信

    发表回复

    微信
    我会尽快回复。
    取消