Raw response for the API
Status code 403
{
“error”: {
“code”: 403,
“message”: “The request is missing a valid API key.”,
“status”: “PERMISSION_DENIED”
}
}
Looks like the key is working in the URL (thx btw) but I’m still not able to Iniciate the call, I don’t know if it’s because it’s needed an OAuth or if it’s because the parameters that are wrong (I’m really lost if this, I don’t understand anything about java or any other coding) I tried to follow the required parameters as the following images:
@ri_scc_94 were you able to figure this out? I’m interested in using the Google API for their speech-to-text tool (similar set up and documentation I assume) and want to make sure this is capable of being used in Bubble.
I’m actually trying to implement this in my app (text-to-speech with Wavenet) at the moment as well. I’m getting the same error response about the missing API key when I actually made an API call from the bubble but was able to initialize the request which is even more strange to me.
Were you able to download the JSON credentials file from google? I believe you want to use JSON web token as the authentication type and place the everything in between -----BEGIN PRIVATE KEY----- and -----END PRIVATE KEY----- in the box that will show up when you select that authentication method.
Google’s format for the key will not work as is, it uses the JSON convention of \n to denote each new line. You will need to actual create a new line every time you see \n in the file and delete the \n before pasting it into the input pox in bubble.
That enabled me to initialize the call. Now I am trying to figure out why I am getting the API key not valid. Please pass a valid API key response error when I actually make a call from the app.
Actually, what I described above should work. I had a problem in my app, not the API request which is why I was able to initialize it but it wasn’t working in my app.
My problem now is that the api returns a Base 64 encoded string that represents an audio file that I need to actually convert to an mp3 file in order to get it to play sound. I am not sure how this will work in bubble.
I’m having problems here, but about the format of the file, google has a way to change the format you want, is the variable “audioEncoding”, that can be LINEAR16, MP3 or OGG_OPUS.
Which part are you still having problems with, the authentication? I may be able to help you because I was able to get it working.
As far as the file format goes, that is correct that the API allows you to specifiy other file formats, but more work needs to be done in order to actually play the API response. The audio content comes back as base 64 encoded because it is a JSON response and JSON does not support binary data (all of those file formats are intended to take binary data). I assumed this meant I was going to have to decode the data to binary, save it to n mp3 file, and feed the mp3 file to bubble’s audio player but I actually found a much simpler method.
This is called a data URI and will save successfully to the database and work as an audio source. The implementation of this for Google Text to Speech could look like this.
data:audio/mp3;base64, Google Text to Speech API Call's - audio content
Where “Google Text to Speech API Call’s - audio content” is a bubble API call with your parameters returning the base 64 encoded response.
Super simple and saves the trouble of having to do different manipulations of the audio response in javascript, which is something I try and avoid whenever possible for simplicity’s sake.
I entered the .Json as you said, it still not calling, I have no idea why. I’ve tried with my google email and with the e-mail in the json file, both didn’t work.
As for what you said about the audio encoding base64 to MP3, I didn’t understand where to put it (I don’t know anything about programing haha)