You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My bot is responding to a slash command by posting a message back to the channel the SlashCommand parameter specifies. The posted message's channel is set to the SlashCommand parameter's ChannelId.
When the slash command is ran from my App Message tab, the message is successfully posted to the App Message tab. However, when the slash command is ran from the user's DM, the the post message API is erroring with the message "channel_not_found".
The chat.postMessage documentation indicates that I should be able to post a message to a user's DM.
If the channel parameter is set to a User ID (beginning with U), the message will appear in that user's direct message channel with Slackbot. To post a message to that user's direct message channel with the app, use the DM ID (beginning with D) instead.
I assumed that the user's DM ID would be the SlashCommand.ChannelId field, when the slash command is ran from the user's DM. Unfortunately, using that SlashCommand.ChannelId is resulting in the "channel_not_found" error.
I hoped that it was just a permission issue and reinstalled the app with the im:write permission. But that didn't fix the issue.
I'm sure that the error is due to my modest knowledge of Slack APIs. Unfortunately, I've not yet found how to structure the post message call to have it go to the user's DM.
How may I post a message to a user's DM.
The text was updated successfully, but these errors were encountered:
Hi, @tahasi. If you want to respond to the slash command in the same channel it came from, the simplest thing to do is have the handler return a SlashCommandResponse with the message. If you need to post the message after the handler returns, then you can use the ISlackApiClient.Respond() extension method, which takes in the SlashCommand and a SlashCommandResponse.
My bot is responding to a slash command by posting a message back to the channel the SlashCommand parameter specifies. The posted message's channel is set to the SlashCommand parameter's ChannelId.
When the slash command is ran from my App Message tab, the message is successfully posted to the App Message tab. However, when the slash command is ran from the user's DM, the the post message API is erroring with the message "channel_not_found".
The chat.postMessage documentation indicates that I should be able to post a message to a user's DM.
I assumed that the user's DM ID would be the SlashCommand.ChannelId field, when the slash command is ran from the user's DM. Unfortunately, using that SlashCommand.ChannelId is resulting in the "channel_not_found" error.
I hoped that it was just a permission issue and reinstalled the app with the
im:write
permission. But that didn't fix the issue.I'm sure that the error is due to my modest knowledge of Slack APIs. Unfortunately, I've not yet found how to structure the post message call to have it go to the user's DM.
How may I post a message to a user's DM.
The text was updated successfully, but these errors were encountered: