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

(Anish Duggal) #13

Hello @kellseyshaw , @perisicrob

Could I also get the same advice mentioned above cannot seem to get location working. I keep getting the below error.

{
“error”: {
“message”: “Unsupported post request. Object with ID ‘me’ does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api”,
“type”: “GraphMethodException”,
“code”: 100,
“fbtrace_id”: “BdW2r0JFzLK”
}
}

Thanks

(Anish Duggal) #14

All is good. I got it to work so far.

(Khashayar) #15

We definitely need that ‘Ask for Location’ method. Without it, the location button is pretty much useless.

1 Like
(Kārlis Janisels) #16

Hi, I tried the code but I got stuck. Nothing is happening, bot does not give any response. Here is code:
{
“recipient”:{
“id”:"{{set_location.user_id}}"
},
“message”:{
“text”:“Please share your location:”,
“quick_replies”:[
{
“content_type”:“location”,
}
]
}
}

What am I missing?

(Sarah Palombo) #17

Hi @Karlis_Janisels :slight_smile:

Are you using the HTTP request as Kellsey explains above or an easier way is to use the Make a custom Request?

If you click Options in your Flow, you can go to Interactions what does the details show there? Is there an error show for this action.

A common issue is not setting the content-type: application/Json

If you’re struggling reach out to support@flowxo.com and share your flow I’m sure we can help get this working :+1:

Sarah

(Steven Booth) #18

@sarahpalombo @johnjackson Hello! Small change I’d suggest to the original example, below.

Hope this is helpful, keep up the great work team :smile:

Also just to note that with Flow XO’s ‘custom request’ bot action, you can use just the following code too:

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

And this is a great tool for checking your JSON is fully validated, with liniting on each line - https://jsonformatter.curiousconcept.com/

1 Like
Location Quick Reply error message
(Khashayar) #19

Hey,

I might be missing something but what’s the point of asking for co-ordinates when there’s no way to record them as attribute?

If there is a way to do that, could someone point me towards the right direction?

Since “ask for location” isn’t next in line, is there a way to implement this for now?

(Karen Barker) #20

Hey Khashayar,

Currently receiving location is done as a New File trigger. When the user sends their location, the latitude and longitude are received and stored in the metadata of the flow trigger. You could then set attributes for each of these from the metadata and then you can use them globally across flows.

1 Like
(Anish Duggal) #22

After receiving the long and lat coordinates. How would one go about resolving to the city level?

(Khashayar) #23

I’m using the Google Maps API for that

1 Like
(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"
      }
    ]
  }
1 Like
(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.