How to Attach a File to a Message with GraphQL
Step 1: Get an attachment ID
First, use the
attachmentUploadFromUrl mutation to obtain an
attachmentId in the response. Make sure to store this, as you'll need them later. The URL is anywhere you want to store the file yourself, this can be your own CDN, or someone else's, so long as it's publicly accessible to the internet, we'll be able to download the file.
Step 2: Send the Message
This step uses the
id from Step 1. Pass it into the mutation's variables as the
blobOrAttachmentId . In this example, we are using
templateProactiveMessageCreate to create a proactive message to a user using a template. The same workflow applies for Media Message Create .
This uses the
MessageProactiveTemplateCreateInput input type .
In your variables,
$input could look like this: