Google Chat Bot Not Sending Message to Chat

Viewed 194

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

0 Answers
Related