Sri Divya
Sri Divya

Reputation: 59

chat.PostMessage with channel name instead of channel id

Can channel name be used in chat.PostMessage instead of channel Id ? Currently in test setup message is being set even if channel name is passed. Is the feature of sending message to a channel with channel name deprecated ? Or is it still allowed ?

Upvotes: 0

Views: 623

Answers (1)

Taylor Singletary
Taylor Singletary

Reputation: 2296

It's indeed possible, but discouraged, to use a channel name with chat.postMessage. The caution to use is that channel names can change while channel IDs are (usually) forever. You also can't use channel names in most other API method arguments looking for a channel ID. chat.postMessage is unique this way and just extra helpful in detecting your intent.

Upvotes: 2

Related Questions