5

I use this format to send text messages to a special group via my Bot in Telegram , but I don't know how to send hashtag character in my text ?

https://api.telegram.org/bot/sendMessage?chat_id

user7386793
  • 61
  • 1
  • 3

3 Answers3

6

Use percent encoding.

For example: https://api.telegram.org/bot<token>/sendMessage?chat_id=12345678&text=This%20is%20an%20%23hashtag

MarcoBuster
  • 1,145
  • 1
  • 13
  • 21
  • How should we write searchable hashtag? when I send hashtag in my text before a phrase, the phrase is not clickable for instant search. – Alireza Sep 04 '17 at 09:27
  • 1
    @Alireza your "phrase" must be a word without spaces or special chars (except for `_`) in it. Example: `#hello`, `#hello_world`, `#telegram`, `#telegramisthebest`. – MarcoBuster Sep 04 '17 at 10:14
  • It actually is. I use POST method and I have a uuid4 token that I want to enable it for instant search. but it doesn't activate. I should also say that I have set parse method to "Markdown". Does it have anything to do with it? – Alireza Sep 04 '17 at 11:43
  • @Alireza you can convert your uuid4 in anything else, because it's impossible to enable it for instant search. The parse mode doesn't affect the hashtags mechanics. – MarcoBuster Sep 04 '17 at 13:37
1

If you are using php for your bot, you can use this in your script

 "https://api.telegram.org/bot/sendMessage?chat_id=xxxxxxxx&text=".urlencode($text)
Herossandro
  • 131
  • 8