Slack JSON - Custom Bot Username and Icon

I'm looking to send out a Post json request using Zapier's webhook function, together with Slack's incoming webhook set up.

I'm using block kit to develop the message style, and so far that's worked great. However, I'd like my bot to display with a custom username and emoji/icon and I'm having trouble.

Here is the JSON payload I'm trying, based off this tutorial https://api.slack.com/methods/chat.postMessage#args

The post seems to ignore the first two lines and posts as the standard bot name

{
"as_user": false,
"username": "test",
"blocks": [
        {
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": "*78 Varet St #14*\n 2 Bed / $2300 \n <@ben> \n 3rd Deposit This Month"
            },
            "accessory": {
                "type": "image",
                "image_url": "https://p.sharinpix.com/3/3521a32/YXBwLnNoYXJpbnBpeC5jb20vaW1hZ2VzL2I2M2RkZTY4LWZkMDMtNGZlYy04OGUxLWYwZjA0N2E4NjQ3NS90aHVtYm5haWxzL29yaWdpbmFsLWI5MTdlNzAzY2U2LmpwZw/77-varet-st-building.jpg?timestamp=1639154285",
                "alt_text": "cute cat"
            }
        },
        {
            "type": "divider"
        }
    ]
} 

Any help would be greatly appreciated!

1 answer

  • answered 2022-05-05 16:53 John Salzman

    If you just want to modify the icon and name of your bot ( will be the same throughout the app ), you should be able to do that on https://api.slack.com/apps/{YOUR_APP_ID}/general? under the Display Information section.

    If you want to be able to change it from message to message, you will have to grant your app additional permissions scopes. See https://api.slack.com/methods/chat.postMessage#authorship

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum