Google API call using Botpress.
# 🤝help
b
1st Thank you for reading this! You're the true MVP! I need confirmation or a little hand holding getting past this curve. The following is from ChatGPT: To make an API call to the Google Maps API using Botpress and an Execute Card, you can follow these steps: Obtain an API key from the Google Cloud Platform Console. You can refer to the official Google Maps API documentation for instructions on how to create an API key. [1] In your Botpress workflow, add an Execute Code card. This card allows you to execute custom code. Use the Botpress built-in axios client to make the API call to the Google Maps API. Axios is a popular HTTP client library that supports making HTTP requests. Here's an example code snippet that demonstrates how to make a basic API call to the Google Maps Geocoding API: Make sure to replace 'YOUR_GOOGLE_MAPS_API_KEY' with your actual Google Maps API key obtained in step 1. Customize the code according to your specific use case. You can refer to the Google Maps API documentation for information on the available endpoints and parameters. For example, if you want to perform a different type of request, such as retrieving directions or places, you would need to modify the API endpoint and parameters accordingly. Can anyone help me through this process. I believe this will be helpful to more than just me. Thanks 🙏

https://cdn.discordapp.com/attachments/1130579836059005019/1130579836524564632/Capture_01.PNG

1st this feels like an unsafe way to do this. and I need to tell the code the response from the user for the address. Again any help is appreciated 🙏
@acceptable-kangaroo-64719 could you please help connect my bot to google maps api, I know there has to be a smarter way then the above suggestion
m
Could you provide some more context about your Issue? Why should that be unsafe? To implement dynamic adresses, just use a variable and store it in there. If you actually take some time, sit down and identify the issue in depth and then just put that into ChatGPT and it'll come up with responses that are actually helpful for solving your issue.
a
Depending on what exactly it is that you want to do, you might not even need the full Google Maps API. I try to avoid Google APIs when I can because their auth strategy is pretty stringent for non-enterprise projects. There are other free APIs for geo-coding (getting latitude and longitude from an address) and reverse geo-coding (getting an address from latitude and longitude). Openstreetmap has a list here https://wiki.openstreetmap.org/wiki/Geocoding Once you have the latitude and longitude of a place, you can make a Google Maps URL that points right to it without making any API calls. The format is
https://www.google.com/maps/@?api=1&map_action=map¢er=latitude,longitude
4 Views