How to capture Location Responses in Google Dialogflow

1 min. readlast update: 07.18.2024

When a user sends their location, WhatsApp shares latitude & longitude as coordinates.

User query received in Dialogflow on behalf of the user is in following format -

location:{{Latitude}},{{Longitude}}

e.g. - location:28.502241,77.0841821

 

How to Capture Location Type User Query

Step 1 : Create Regular Expression Entity

Use this as regex - ^location:(-?\d+(\.\d+)?),*(-?\d+(\.\d+)?)$

Step 2: Create a New Intent

  • Give it a name

  • In training phrase put this as example - location:28.502241,77.0841821

  • Map @Location entity to it

  • Create a new parameter Location

  • Use $Location in place of Value & Default Value

  • Save

  • Test your Intent

Was this article helpful?