I'm writing a bot in telegram (using c#).
I want the bot to send message to a user with a list of clickable links. When user presses such a link, the client should post this command back to the bot. It should look like this (example from #pollbot):
I tried:
sendMesage method with parse_mode=HTML and tg:\ links. Problem:
telegram renders them as unsafe and navigates away from the chat. Or shows no link.
/sendMessage?chat_id=xxxxxxxx&parse_mode=HTML&text=CommandText
etc...
sendMessage with markdown - same result or no link
/sendMessage?chat_id=xxxxxxxxx&parse_mode=markdown&text=[\CommandText](\Command)
inline keyboard works OK, but I need a link, not a button
Any advice on how to implement this is higly appreciated.
Words starting with a "/" in a text are automatically made clickable as a link. You can just use sendMessage without a parse_mode and send the text /newpoll.
Related
I'm using WhatsApp Business API and can't find a way to put links with labels in messages.
Like Click here, in HTML. Couldn't find any reference about it in the docs: https://developers.facebook.com/docs/whatsapp/on-premises/guides/messages
How can I do that?
You can put the direct link in the body of the message, there is no option to format the link,
There are other options, you can create a button, there you can set a label and redirect link on click in the template and interactive message type.
I need to create inline_keyboard with callable url link in telegram bot api. The problem is that the telegram does not accept a link similar to 'tel:+99891....', is it possible to somehow add a link that opens the call window to the inline button?
Sorry for my bad English
You could send a contact instead of a message with sendContact instead of sendMessage
So I just chatted to one of line(one of social media) official accounts and they send me a message then when I clicked the button "Call us" it redirected me to my default calling application on my phone and filled out their number. Does anyone know how to do the same thing ?
That is probably an example of tel protocol.
You basically make an HTML link just like any other link, but rather than the href containing an http:// link, the link format looks like this:
tel:1-123-456-7890
When the user clicks it, their operating system sends this number to their default app for handling tel protocols, which is usually a phone app.
Here's an article useful for explaining this protocol, as well as some handy information about using it in CSS:
https://css-tricks.com/the-current-state-of-telephone-links/
With vue js i have developed a chat app. when typing message there might have some suggestion from keyboard. to select that suggested text when i press enter button it sends that suggested message. but sending is not my requirement. i want to select the suggestion. after finishing my message i want to send the message by enter button.
here is my code:
<textarea v-model="Keijiban" #keyup.enter="send" #click="selectContact(kokyaku1)" placeholder="ここにメッセージを入力してください。"></textarea>
in chrome it is working well. But this problem is appearing when i am using inter explorer(IE).
My bot sends messages to groups with inline button, what I want, is when the button is clicked, chat with the bot page should open, i.e. somehow redirect the user to the private chat with the bot.
I'm using this wrapper.
What I have tried so far is to set a url in answer_callback method, equal to the url of my bot i.e. url="https://t.me/my_sample_bot
but I keep getting URL_INVALID response from telegram, I tried http(since I read somewhere in the api documentation that the urls should be HTTP), but that did not work either.
My question is am I doing it right? I mean do I have to set the url in answer_callback method to redirect the user, or I should try another way?
Well I figured it out myself, setting the url was the right way to do it, and though the Wrappers documentation is not detailed, I took a look at source code and there was a docstring for the method answer_callback_query that said this about the url:
:param url: (Optional) URL that will be opened by the user's client. If you have created a Game and accepted the conditions via #Botfather, specify the URL that opens your game – note that this will only work if the query comes from a callback_game button.
Otherwise, you may use links like telegram.me/your_bot?start=XXXX that open your bot with a parameter.
so all I had to do was to give it a link with of my bot, with a start query