Failed to send test alert notification with CURL

Hi All,
I have one than more notification channels in Grafana v7.1.2. I try to check slack channel API with curl.

I got notification channel by uid successfully. But, I failed test notification channel.

curl -X POST -H "Accept: application/json" -H "Authorization: Bearer eyJrIjoiNldnMDh6V0pVdFpOd0M3OGtZNVRteXlZcm9jQnZIa2oiLCJuIjoiQVBJX0FkbWluIiwiaWQiOjF9" -d '{ "id": 5, "type": "Slack" , "settings": {"uploadImsge": true, "url": "https://hooks.slack.com/services/XXXX"} }' http://xxx.xx.xx.xx:3000/api/alert-notifications/test {"message":"Failed to send alert notifications"}

Log is below;
msg="Failed to send alert notifications" logger=context userId=0 orgId=1 uname= error="Unsupported notification type" remote_addr=xxx.xx.xx.x t=2021-04-27T07:17:35-0400 lvl=eror msg="Request Completed" logger=context userId=0 orgId=1 uname= method=POST path=/api/alert-notifications/test status=500 remote_

The test is running with the same information from the interface. How can I use the api properly?

I solved the problem myself. I add that the solution will be useful. First of all, there is not enough information in the document for the API for slack testing. If you are using API key -H "Authorization: Bearer does not work in test notification. You need to configure this way.

curl -XPOST -H "Content-Type: application/json" -d '{"type":"slack","settings":{"url":"https://hooks.slack.com/services/xxx/xxx"}}' http://api_key:KEY_HERE@xxx.xx.xxx.x:3000/api/alert-notifications/test

1 Like

This topic was automatically closed after 365 days. New replies are no longer allowed.