Location Button (Messenger) - Making sending your location easy :)


(Salem Jafar Ababneh) #24

Where can I find a token? I just don’t get the idea of tokens.


(daniel.beckett) #25

@Salem_Jafar_Ababneh

The original post is a bit outdated now since there’s an easier method available that doesn’t require a token. :slight_smile:

If you use the Make a Custom Request service you can use the following code:

 {
    "text":"Please share your location:",
    "quick_replies":[
      {
        "content_type":"location"
      }
    ]
  }

(Imad Jundi) #26

Hi Salem

I used the following code

 {
    "text":"Please share your location:",
    "quick_replies":[
      {
        "content_type":"location"
      }
    ]
  }

and setting the method to sendMessage for telegram

it is only showing the text Please share your location and move to on.
it is not showing a button to select the location.


(Karen Barker) #27

Hi Imad,

The code in this thread will only work for Facebook messenger. If you want to do this on Telegram then you’ll need to update the custom request as follows:

{
	"chat_id": "{{bot_new_message.channel_id}}",
	"text": "Hello World",
	"reply_markup": {
		"keyboard": [
			[{
				"text": "Send Location",
				"request_location": true
			}]
		]
	}
}

You’ll also need to send some Metadata of Method = sendMessage.

Hope this helps. :thumbsup:


(Imad Jundi) #28

Agree with @kcfl
Ask for location will be a great solution.


(Imad Jundi) #29

Hi @KarenBarker
thank you, this helped me setup the button for asking for location in telegram but i faced the following issues.
I’m not given any chance to press the button, it disappear immediately and the ‘New File’ trigger is not started.
i tried to insert ‘Wait for a while’ for one minute after the request for location, now i can press the button and the ‘New File’ trigger is started.
but for sure, this is not practical, what am i missing here?


(Karen Barker) #30

Hi Imad,

The only way to allow the flow to wait for the user to press the button is to end the first flow at this point. Create a 2nd flow with the New File Trigger, and then continue with the further required actions in this flow once the user has sent their location. :thumbsup:


(Imad Jundi) #31

Hi Karen,
It is working now. i will try to ask for the location at the end of the first flow.
as Dan explained for me, i need to save all previous fields as attributes so they can be used with the second flow.
this will double the interactions counter but it’s not a problem for now.
we will be waiting for ‘Ask for location’ action.

thank you again.


(Kurt Anderson) #32

Daniel,

Will the user submitting their location via this button trigger the Find Location template flow to trigger, similarly to if the user had submitted their location using the native messenger send location feature?


(daniel.beckett) #33

@anderkd

Yeah, the custom request should trigger the new file trigger when used.


(Anish Duggal) #34

Does Anyone have a flow they can share that will do this.

I’m trying to get users location and then open a google map in a webview that will give them directions to where we are.

Thanks

Anish


(Anish Duggal) #35

Sorry I just saw the Location flow in the new flows area. Not sure how long that has been there or how long i’ve been blind. :slight_smile:

I hope that will take care of it.