skm
skm

Reputation: 91

slack incoming webhook always posting to default channel even though I give different channel

I am trying to send messages to slack channel using incoming webhooks and the webhook is created with default channel as #channel1 but now I want to send message to channel #general using the same incoming webhook

and I am using the following command to do that

curl -X POST -H 'Content-type: application/json' --data '{ "channel": "#general", "text":"Sample Message!"}' https://hooks.slack.com/services/XXXXXX

However, it still sends the message to #channel1 , ignoring the channel name I gave #general.

Any suggestions as to why or am I missing some setting some where?

Upvotes: 2

Views: 1563

Answers (1)

Erik Kalkoken
Erik Kalkoken

Reputation: 32697

If you create a webhook through a Slack app the channel is static and can not be overridden by including a channel property in the request.

If you want to use the channel override feature you need to create a webhook through the legacy "Incoming Webhook" app, which you can install from the Slack App Directory.

You can also read more about this legacy feature here.

See also this answer.

Upvotes: 4

Related Questions