Hi Friends,
If you are working on any application and looking for an API to share location of any particular place in Telegram Group via bot then this article will really help you to achieve the same.
I am also discussing here the method for sharing the contact number in Telegram group via a bot.
Below are the steps for both requirements:
Let's discuss first, How can we share any contact number via bot in a Telegram group using Telegram REST API:
Here I am assuming you are aware of Telegram bot and chat group creation steps. In case you are not aware then pls refer my blog(https://telegrambotinfo.blogspot.com/2020/04/telegram-bot-creation-steps.html) first.
Below is the REST API syntax to send contact number.
Syntax:
https://api.telegram.org/bot<bot_id>/sendContact?chat_id=<chat_id>&phone_number=<mobile_number_with_country_code>&first_name=<contact_name>
Where
<chat_id>= chat id of the group for the added bot.
<bot_id>=your bot id
<phone_number>=mobile number which you want to share in group
<contact_name>=name of the person
Example:
https://api.telegram.org/bot1142780056:AA875KS4Dt_wgUNgoY87OUDJt-gkdMpIk/sendContact?chat_id=-470720173&phone_number=919897546890&first_name=Ram
Let's discuss now, How can we share location via bot in a Telegram group using Telegram REST API:
We can use "sendLocation" API to send location any chat group with the bot.
Syntax:
https://api.telegram.org/bot<bot_id>/sendLocation?chat_id=-470546173&latitude=<latitude>&longitude=<longitude>
Example:
https://api.telegram.org/bot1142780091:AA875KS4Dt_wgUNgoY87OU7Jt-gkdMpIk/sendLocation?chat_id=-470506173&latitude=29.972543&longitude=77.567188
location latitude and longitude values you can find from google map for any location.
Thanks.
Please write in comments in case of any doubt or any clarification required.
No comments:
Post a Comment