i am not able to open slack via google app scripts

Looks like your payload is invalid as "type": "modal" should be part of the view. Try this payload:

var payload_upd = {
  "trigger_id": trigger_id,
  "view": {
    "type": "modal",
    "title": {
      "type": "plain_text",
      "text": "Gratitude Box",
      "emoji": true
    },
    "submit": {
      "type": "plain_text",
      "text": "Submit",
      "emoji": true
    },
    "close": {
      "type": "plain_text",
      "text": "Cancel",
      "emoji": true
    },
    "blocks": [
      {
        "type": "input",
        "block_id": "my_block",
        "element": {
          "type": "plain_text_input",
          "action_id": "my_action"
        },
        "label": {
          "type": "plain_text",
          "text": "Say something nice!",
          "emoji": true
        }
      }
    ]
  }
};

Also, make sure you specify “Bearer” in your Authorization header.

var options_upd = {
  "headers": {"Authorization": "Bearer " + myToken},
  "method": "post",
  "contentType": "application/json",
  "payload": JSON.stringify(payload_upd),
}; 

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top