Search code examples
slackslack-apislack-block-kit

is it possible to change a slack bots image & name when sending messages


I'm trying to build a slack bot that will post messages as various celebs; so message will appear at first glance to come form someone famous with their image. This isn't working. I managed to change the bots name&image but messages sent were going to the slackbot DM's page. I turned it into a chat app; but there when i change the profile it says invalid user. It lets me change the usernames of other people in the workspace but not the bot.

function changeProfile() {
  (async () => {
    const result = await web.users.profile.set({
      profile:{real_name: "Jacinda Adern"},
      user:"U0281UY0CSK". //id of bot
    });

  })();
}

Solution

  • You can try requesting the chat:write.customize scope (https://api.slack.com/scopes/chat:write.customize).

    This scope will let you customize the username, icon_url and icon_emoji properties in a chat.postMessage call.