pythonslackslack-apislack-commandsslack-bolt

Python Slack Bolt: Channel not found in DMs with scopes


I'm using a slash command in a DM and getting the following error message from Slack:

{'ok': False, 'error': 'channel_not_found'}

My bot currently has the following scopes and is using the say function to send messages to the specified DM channel.

Here are the bot's scopes for reference:

app_mentions:read
channels:history
channels:join
channels:read
chat:write
chat:write.public
commands
groups:history
groups:read
im:history
im:read
im:write
incoming-webhook
mpim:history
mpim:read
mpim:write
mpim:write.invites
users.profile:read
users:read

I am unable to send the message through an ack because it's through a modal and needs to send to different channels sometimes (part of the prompt), another problem I am experiencing (does anyone know if my bot can join a private channel itself or smth?)

The line in question is below:

message = await say(channel=data["channel_block"]["event-rsvp-channel"]["selected_conversation"], blocks=block_data["blocks"])

Solution

  • sorry if i'm late to the party! hope you figured this out.

    your bot can't join a private channel unless it's already a member, and this includes DMs between two people - you would have to create a group message with person A, person B, and bot.

    i would also use chat_postMessage instead of say.