Custom WebHook to tellegram chanell

Hello, im trying to add alerting to telegram chanel. Correct curl webhoock is

curl -i -X POST -H “Content-Type: application/json” -d ‘{“text”: “Hello, this is some text\nThis is more text”, “chat_id”:“12345”}’ https://api.telegram.org/bot12345:AABBCCDD/sendMessage

But when i’m trying send test messsage in alert, i’m getting error ( found it in cosole)

java.io.IOException: Failed: HttpResponseProxy{HTTP/1.1 400 Bad Request [Server: nginx/1.12.2, Date: Wed, 26 Jun 2019 17:53:36 GMT, Content-Type: application/json, Content-Length: 80, Connection: keep-alive, Strict-Transport-Security: max-age=31536000; includeSubDomains; preload, Access-Control-Allow-Origin: *, Access-Control-Expose-Headers: Content-Length,Content-Type,Date,Server,Connection] ResponseEntityProxy{[Content-Type: application/json,Content-Length: 80,Chunked: false]}}

I have this settings for destination:

And this for alert:

Please help, how to solve this

Hi @Vinnyard,

You need to put the -d body inside the action message since it’s expecting it in that format: { “text”: “…” }

And how to do that? As i understood, query params from destination and message body will be merged somewhere, where i have no controll

@Vinnyard

You can take look at the reply here Mattermost webhook integration - #2 by mihirsoni

In a gist, when you create an Action, inside message you should provide format in a way destination expect.

In case of your use case, you would put below in message as part of Action message.

‘{“text”: “Hello, this is some text\nThis is more text”, “chat_id”:“12345”}’

Thank you very much )))
It’s working )) It’s ALIVE ))

1 Like

Closing the topic as it has been answered.