I’m trying to send a Twilio WhatsApp image to Google Vision API via Make, but Base64 encoding keeps failing with a 400 error

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:

  1. Webhook: Receives Twilio message with a MediaUrl.
  2. 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.
  3. Set Variable: I use base64encode(9.data) to convert the image to Base64.
  4. 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 :folded_hands:

I ran into the same 400 error when using Make to connect Twilio and Google Vision. The fix for me was ensuring the image was properly downloaded as binary, then encoded to Base64 without headers like data:image/jpeg;base64,. Also double-check the MIME type in the request payload. Google Vision’s API is picky—stray characters break it easily.