Facebook Messenger bot Send Location button with redirect to the map

Question!

Now I am building the Facebook Messenger Bot at NodeJS and to provide some information I need to know a user location. I have the button "Send Location" and the response with a small instruction how to send manually the location: go to the menu, find an icon and push it. But reality I need that the user just click the Send Location button and automatically redirect to the map where he can just click Current Location and the bot can catch his coordinates. Do you have some ideas how it can be made? PS I saw this button in the "Hi Poncho" and it works great. enter image description here



Answers

You can see similar functionality on my Bot when using the IOS messenger app.

The 'location' feature allows the user to send a their location to the bot. By default, it showe a map with 'Your Location' and 'Tap to view on map'. The lat/long details are sent in the background to the Bot.

I tried from the desktop and it didn't show the quick reply 'send location' button at all.

The bot is running at DMS Software Bot. Type 'quick reply' and hit location.

The source is at FB-Robot on github.



The following code does 3 things:

  1. It gets the path for the linked tables from a table "linked table source" based on the location of the current db - sometimes I have it on my local drive and sometimes it's on a network server.
  2. It updates the references to the source db - I store common codes in that library where I can keep a single copy for use in all my apps
  3. It updates every linked table to the source defined in the table - but only for tables likes to the db with the "Common Tables" name
Function relink_tables()

If Left(CurrentDb().Name, 2) = "C:" Or Left(CurrentDb().Name, 2) = "B:" Then
    Source = "local"
    Else: Source = "network"
    End If
Set rs = CurrentDb.OpenRecordset("select * from [linked table source] where source='" & Source & "'")
Source = rs.Fields("path")

For Each R In References
    If InStr(R.Name, "Common Tables") > 0 Then Application.References.Remove R
    Next R
Application.References.AddFromFile Source

x = 0
Set TDefs = CurrentDb().TableDefs
For Each table In TDefs
    If InStr(table.Connect, "Common Tables") = 0 Then GoTo NT
    table.Connect = ";DATABASE=" & Source
    table.RefreshLink
    x = x + 1
NT:
    Next table
Finish:
MsgBox "remapped " & x & " tables"
End Function


If you want the numbers in string without -, use .replace() as:

>>> string_list = "5-9-7-1-7-8-3-2-4-8-7-9"
>>> string_list.replace('-', '')
'597178324879'

If you want the numbers as list of numbers, use .split():

>>> string_list.split('-')
['5', '9', '7', '1', '7', '8', '3', '2', '4', '8', '7', '9']


This video can help you solving your question :)
By: admin