简体   繁体   中英

Changing Slack bot name / image using Slash Commands?

I'm setting up a slackbot with slash commands and according to API you're able to pass username to set the username of a bot. When I try it, the name does not update. Does this not work with slash commands in the same way that it does with bots?

from bottle import run, post, request
@post('/hello')
def hello():
    mydict = request.forms.get('text')
    response = {
    "username": "test",
    "response_type": "in_channel",
    "text": "Greetings!"
        }
    return response

matt [11:00 AM] /hello

MyBot APP [11:00 AM] Greetings!

Correct. You can not change the name of the app that appears on Slack when you respond to a request like that. It will always show the name you configured in the app settings.

However, there is a workaround for your use case: Instead of replying to the received request directly you can send a message into the channel / to the user with chat.postMessage , which will allow you to specify a custom username and icon.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM