2

I set up a chatbot and it works, kinda. The email is sent when the slash command is used but other than that it does not send the card to the chat saying we received the request. What am I missing here?

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);
  }
}

I have referenced the following:

It's obviously getting the info: enter image description here

Jacques-Guzel Heron
  • 2,480
  • 1
  • 7
  • 16
  • Hi there @DavidMorin ! I tested and researched your issue, and I can confirm that the email is sent but the card is not shown. This may be related to the double `return` in the first function. Please, try to return only one thing per function and write back sharing your findings. – Jacques-Guzel Heron Dec 11 '20 at 10:26

0 Answers0