How can I send non-image attachments (e.g., PDF, videos, documents) using Google Business Messages API?

37 views Asked by At

I'm currently integrating the Google Business Messages API into my application and I'm facing challenges when it comes to sending non-image attachments such as PDF files, videos, and other file types. I've extensively searched through the official documentation and other resources, but I haven't found clear information on how to send these types of attachments using the API.

While I've successfully sent text and image-based messages, I need to be able to send attachments of different formats to provide a more comprehensive experience to users. However, I'm uncertain about the required format, size limitations, and the correct method to include these attachments in the API request.

I would greatly appreciate it if someone could guide me on how to send non-image attachments (PDF, videos, documents) using the Google Business Messages API. Specifically, I'm looking for information on the supported attachment formats, any size restrictions, and the necessary API parameters or endpoints to include in the request.

Any insights, code examples, or pointers to relevant documentation would be highly appreciated. Thank you in advance for your help!

I tried sending a video attachment using the Google Business Messages API. I constructed the message payload with the following content:

{
  "messageId": "fd*****************",
  "representative": {
    "representativeType": "BOT",
    "avatarImage": "",
    "displayName": "i**********t"
  },
  "video": {
    "contentInfo": {
      "fileUrl": "****************************hd.mp4",
      "forceRefresh": true
    }
  }
}

I expected that this payload would successfully send the video attachment to the user. The fileUrl field contains the URL of the video file, and forceRefresh is set to true to ensure the latest version of the video is fetched.

However, please note that the provided content snippet alone does not provide the full context of how this payload is being used in your implementation. To provide a more accurate answer, please provide additional information or specific code snippets related to how you are sending the message using the Google Business Messages API.

0

There are 0 answers