Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(components): added location component #409

Merged
merged 2 commits into from
Mar 16, 2022

Conversation

laurentlp
Copy link
Contributor

This PR adds the location component and enables its support on the webchat.

It requires a Google Maps API Key to be set in the webchat config: https://developers.google.com/maps/documentation/javascript/get-api-key

Screenshot from 2022-03-10 17-47-44

api.rest

### Send Location
POST {{baseUrl}}/api/v1/messages
Authorization: Bearer {{authToken}}
x-bp-messaging-client-id: {{clientId}}
x-bp-messaging-client-token: {{clientToken}}
Content-Type: application/json

{
  "conversationId": "{{convoId}}",
  "payload": {
    "type": "location",
    "latitude": -25.363,
    "longitude": 130.044,
    "title": "",
    "address": "Uluru (Ayers Rock)"
  }
}

@linear
Copy link

linear bot commented Mar 10, 2022

Copy link
Contributor

@samuelmasse samuelmasse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and working 👍

Don't forget that the title and address are also parts of the location message. We show them to the user on every channel, so it would make sense to show them in the webchat also. I'm also not a fan of the hardoced Location: prefix for the fallback

packages/components/src/renderer/location.tsx Outdated Show resolved Hide resolved
packages/components/src/renderer/location.tsx Outdated Show resolved Hide resolved
@laurentlp
Copy link
Contributor Author

With a valid API key

Screenshot from 2022-03-16 11-46-09

Fallback

Screenshot from 2022-03-16 11-45-39

@laurentlp laurentlp closed this Mar 16, 2022
@laurentlp laurentlp reopened this Mar 16, 2022
@laurentlp laurentlp merged commit 89ea074 into master Mar 16, 2022
@laurentlp laurentlp deleted the laurentlp-dev-2299-webchat-location-content-is-not branch March 16, 2022 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants