Hi Make team,
I’m trying to build a scenario that receives a WhatsApp image via Twilio, downloads it using HTTP, encodes it in Base64, and sends it to the Google Vision API for OCR. However, I keep getting this error from the Google API:
javascript
CopyEdit
Error: 400 Bad Request
"Invalid value at 'requests[0].image.content' (TYPE_BYTES), Base64 decoding failed"
Here’s my setup:
- Webhook: Receives Twilio message with a MediaUrl.
- HTTP GET: Downloads the image from Twilio using Basic Auth. This step works and I see the binary data and file size in the output.
- Set Variable: I use
base64encode(9.data)
to convert the image to Base64. - HTTP POST: I send the Base64 string to Google Vision using the
image.content
field.
But the encoded string seems invalid. The raw request body looks like this:
json
CopyEdit
{
"requests": [
{
"image": {
"content": "{{base64encode(9.data)}}"
},
"features": [
{
"type": "DOCUMENT_TEXT_DETECTION"
}
]
}
]
}
I suspect the binary buffer isn’t being read correctly or the Base64 output is malformed. I’ve tried using base64encode()
on both the HTTP step output and storing it in a variable, but I still get the same decoding error.
Can someone confirm:
- Is
base64encode(9.data)
the correct way to encode an image buffer for Google Vision? - Do I need to use a different module like Download a file, Get a file, or something else before encoding?
- Is there a better way to pass binary data through Make to Google Vision?
Any help is appreciated!
Thanks