0

I am trying to send message to users in slack. I am using chat.postMessage api. here is my code

const messageObject = {
            channel: "channelId",
            "blocks": [
                {
                    "type": "section",
                    "text": {
                        "type": "mrkdwn",
                        "text": "The survey is about to begin"
                    }
                },
                {
                    "type": "actions",
                    "elements": [
                        {
                            "type": "button",
                            "text": {
                                "type": "plain_text",
                                "emoji": true,
                                "text": "Begin"
                            },
                            "style": "primary",
                            "action_id": `123`
                        }
                    ]
                }
            ]
        }

      const res = await axios.post(`${slackBaseUrl}/chat.postMessage`, messageObject, {
            headers: getOAuth2Headers(token)
        });

In the slack I am receving the message in slackbot channel but I want the message to get posted in my own bot channel

here is the link to image

any help would be really helpful

Moazzam Arif
  • 298
  • 1
  • 5

0 Answers0