Webhoook with telegram

I need help to try call a webhook:

but appear Error 1 : The webhook url … is not well formed!

So what is the correct form to use with telegram api?

Thanks you.

remove the quotes and the merge mark and try again..

2 Likes

May be related to the fact that it’s not encoded since you are adding the message on the URL.
https://help.appsheet.com/en/articles/2347653-encodeurl

https://api.telegram.org/bot{my token}/sendMessage?chat_id={my id chat}&text=<<ENCODEURL(CONCATENATE("Hi", " this is a text"))>>

I do it this way though:

Url:

https://api.telegram.org/bot123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11/sendMessage

Body:

{
"chat_id":yourchatid,
"text":"<<CONCATENATE(
"Your",
" text",
" here"
)>>",
"parse_mode":"MarkdownV2"
}
4 Likes

It works perfectly, now my bot sends the plain text or the value of a column in the row.

Two more questions:

  • Could you tell me how to make a line break? I tried with “\n” but it doesn’t work for me.

  • How could a hyperlink be included in the message?

Thank you very much for all your instructions, they have been very helpful.

2 Likes

Place %0a where you will cut the line. Do not use any joins or quotation marks.

About the line Break, that’s a pain I have had for months without solution. I’ve tried a lot of things, believe me. I’d love to help you. The only thing I think worked but not the way I wanted was the \n on the URL and the ENCODEURL() function. But POST using the JSON code for the body… no luck at all.

The hyperlink is easy:
MarkdownV2:

[inline URL](http://www.example.com/)

HTML:

<a href="http://www.example.com/">inline URL</a>

Well, guess what? I tried it again today with the line break stuff and it worked.

This is counterintuitive so make sure you follow me.

Everytime you want to make a line break it has to be outside of your text.

On this example:

{
"chat_id":yourchatid,
"text":"<<CONCATENATE(
"Your",
" text",
" here"
)>>",
"parse_mode":"MarkdownV2"
}

You would think that the line break should be inside your text, like this:

{
"chat_id":yourchatid,
"text":"<<CONCATENATE(
"Your",
" text",
" here",
"\nNew line"
)>>",
"parse_mode":"MarkdownV2"
}

It won’t work. The thing is, you have to make a big mess to make sure every line break is where you want it.

If you want something like this on Telegram:

Hi UserName!> Today is Feb 8, 2022> You have X pending tasks to do

You need something like this on your Body:

{
"chat_id":yourchatid,
"text":"<<CONCATENATE( "Hi *", [ColumnWithUserName]), "*")>>\n
<<CONCATENATE("Today is ", TEXT(TODAY(), MMM DD, YYYY))>>\n
<<CONCATENATE( "You have ", [AnyColumnOrExpressionCountingThis], " pending task to do")>>",
"parse_mode":"MarkdownV2"
}

Basically, make sure the \n is outside any function/expression (it’s not part of your text). It should be between the expressions, out of the <<>>

In other words, every line should be it’s own expression

4 Likes

Thank you very much for your time and dedication. Now it works perfectly.

I think more: Are you try to add a cell with document? I know that telegram admit file (log) so… could be posible to send file insidd to json from a cell?

2 Likes

If you use it without quotation marks, broken json format and if you use it with “%0a” read like text … so not woeks. The correct solution to use in json format is like SkrOYC’s explanation. I

also appreciate your response.

2 Likes

how about entering characters like ‘=’,‘-----’ in the body?

Those are just characters without any impact in the JSON, so just add them in your expressions as text