whatsappwhatsapp-cloud-api

Can i send whatsapp media messages by Meta Cloud API without uploading them?


I am trying to use Meta Cloud API to send an image as whatsapp message, but I don't want to upload it anywhere, can't i just send the binary buffer?

something like this:

const formData = new FormData();
formData.append('messaging_product', 'whatsapp');
formData.append('recipient_type', 'individual');
formData.append('to', content.to);
formData.append('type', 'image');
formData.append(
    'file',
    content.image_buffer,
    {
        filename: 'image.png',
        contentType: 'image/png',
    }
);

I was using a service (Business Solution Provider) that allowed me to send the image directly as binary buffer. Now i will use Meta Cloud API, but didn't find anything like this in the docs


Solution

  • Meta Cloud API doesn't let you send images directly as binary buffers without uploading them somewhere. To handle this, you can upload the image to a temporary storage service like Amazon S3 or Imgur. Then, you grab the URL of the uploaded image and use it to send the image via the Meta Cloud API. This way, you avoid keeping the image permanently stored and still get it sent through the API.