2

我设置了一个聊天机器人,它可以工作,有点。使用斜杠命令时会发送电子邮件,但除此之外,它不会将卡片发送到聊天室,说明我们收到了请求。我在这里想念什么?

function createMessage(voter, voteCount, shouldUpdate) {
  return {
    actionResponse: {
      type: shouldUpdate ? 'UPDATE_MESSAGE' : 'NEW_MESSAGE'
    },
    "cards": [{
      "header": {
        "title": "IM Support",
        "subtitle": "We have received your message",
        "imageUrl": "https://portal.oursite.net/assets/logoBlk.png",
        "imageStyle": "IMAGE"
      },
    }]
  };
}

function onMessage(e) {
  MailApp.sendEmail({
    to: "support@oursite.net",
    subject: "Subject",
    htmlBody: e.message.text,
  });
  if (e.message.slashCommand.commandId === '2') {
    return createMessage(e.user.displayName, 0);
  }
}

我参考了以下内容:

它显然正在获取信息: 在此处输入图像描述

4

0 回答 0