Sending Attachments
Learn how to send attachments
All messaging endpoints support sending attachments. You can include either one or multiple attachments in one of two formats:
-
HTTPS URL: We’ll download the attachment from the provided URL. This is the easiest method, but requires you to serve your files over the internet.
-
Media Library URI: Use this feature when you need to upload files directly using the
media_library://
protocol.
Using the Media Library
First, create a signed upload URL with the path to your file:
The file will be uploaded to test.png
.
You can also upload to nested paths, for example /storage/upload/sign/media_library/my-dir/test.png
. This will create an upload URL for my-dir/test.png
.
Next, upload your file using the signed URL:
Media library files are automatically deleted after 30 days. Until then, you can use them as often as needed when sending messages or broadcasts by passing them as attachments:
attachments: ["media_library://test.png"]
attachments: ["media_library://my-dir/test.png"]