treethought / flask-assistant

Framework for Building Virtual Assistants with Dialogflow and python
Apache License 2.0
379 stars 101 forks source link

feature request easy way to ask user for their location #67

Closed chaoranxie closed 6 years ago

chaoranxie commented 6 years ago

Not sure if it is on the road map, but i was wondering what would it take to implement a helper method like ask to ask for permission.

Reference https://developers.google.com/actions/reference/rest/Shared.Types/Permission https://developers.google.com/actions/assistant/helpers https://github.com/actions-on-google/actions-on-google-nodejs/blob/ef01c100c4c9e2c95744842c4238127e1417262d/assistant-app.js#L910

chaoranxie commented 6 years ago

i figured it out, you have to make sure to add actions_intent_PERMISSION event to search-nearby-event intent

@assist.action('search-nearby-event')
def search_nearby_event():
    if 'device' not in request['originalRequest']['data']:
        # https://developers.google.com/actions/reference/rest/Shared.Types/Permission
        return permission(['DEVICE_PRECISE_LOCATION'], "To search nearby events,")
    coordinates = request['originalRequest']['data']['device']['location']['coordinates']