0

I am using slack webhook to post a report and I am trying to add icon_emoji, channel and username however its ignoring all of those When i use try it here it works tho https://api.slack.com/docs/messages/builder?msg=%7B%22username%22%3A%22Report%20notifier%22%2C%22channel%22%3A%22%23general%22%2C%22text%22%3A%22New%20Report%20%3C!everyone%3E%20%3C!here%3E%22%2C%22icon_emoji%22%3A%22%3Asmiley_cat%3A%22%2C%22attachments%22%3A%5B%7B%22text%22%3A%22And%20here%E2%80%99s%20an%20attachment!%22%7D%5D%7D

   { username: "Report notifier",
      channel:"#general",
      text: "New Report <!everyone> <!here>",
      icon_emoji:':smiley_cat:',
      attachments: [
        {
          color: "#FF0000",
          fields: [
            {
              title: "price",
              value: "4",
              short: true,
            },
          ],
        },
      ],
    };
Metawaa
  • 104
  • 11

1 Answers1

0

First, your code is not JSON. Slack needs JSON data input. Second, channel name must be the name without visibility icon (# etc.) Third, using emoji needs to set up permissions - more info in here.

This works (without emoji - I did not set emoji permission):

{
    "username": "Report notifier",
    "channel": "general",
    "text": "New Report <!everyone> <!here>",
    "icon_emoji": ":smiley_cat:",
    "attachments": [
        {
            "color": "#FF0000",
            "fields": [
                {
                    "title": "price",
                    "value": "4",
                    "short": true,
                }
            ]
        }
    ]
}
adpro
  • 156
  • 8