Bot able to send a location instead of a google maps link (Telegram)

#1

Hi,

I have a bot that sends a location to the user. Now this function is pretty basic: the bot only sends a google maps link. I would like to replace the google maps link with a real map. In other words, I would like to teach my bot to send a map instead of a google maps link.

In the image below you can see what I obtain and what I would like to obtain:

I suppose I have to use the “code” command or the “get a http request” command and google maps API, but up to now my attempts have been unsuccessful.

Please, can somebody help me? I would be very very grateful.

Thank you very much

Greetings from Italy :slight_smile:

(Karen Barker) #2

Hi there, :wave:

You’ll need to do an HTTP request to the Google maps API in order to get the Latitude and Longitude of the location you wish to display. You can install our Find Location template to see how to do this!

The Telegram API then has a SendLocation option which you can use with our custom request.

The request will need to look something like the following:

Here the chat_id will be the user_id from the flow trigger, latitude and longitude can be found using the data outputs from the Google Maps webhook.

This will then display the map as you require. :thumbsup:

1 Like
#3

Thank you very very much! An enormous hug for you! :hugging:
I tried something really basic, in order to test the sendLocation option, and it works perfectly!
Have an awesome day! :grinning:

1 Like
(Jakub Straka) #4

Could you also provide a similar step-by-step for Messenger? I am trying to figure out what’s the correct url in the Image Card URL field on the Google Maps / Places API (basically Find Location template) but I keep getting blank image of the map. :confused:

Would be much appreciated. Thank you!

(Karen Barker) #5

Hi Jakub,

Unfortunately Facebook do not have an equivalent “SendLocation” API call so there is no way to display the map in Facebook as shown above for Telegram. The URL returned from Google maps also is not in an image format and therefore unfortunately this link will not work to be used and displayed as the card image. I’ve tried looking around for any other options of how to display this within Facebook but haven’t been successful I’m afraid. :disappointed: