Skip to main content
Version: 1.3.x

Email Attachments

You can send attachments with your emails. This works for both templated emails and hardcoded emails.

How to send email attachments with Engagespot?​

In the data payload of your send notification request (API or SDK), include an attachments array which can contain one or more attachment objects as mentioned below.

{
"content":"base64 encoded file content (Max - 10MB)",
"name":"Filename for example - sample.pdf",
"contentType":"MIME Type of attachment for example - application/pdf"
}

Here is a full example of send notification request with attachment.​

const { EngagespotClient } = require('@engagespot/node');

const client = EngagespotClient({
apiKey: 'YOUR_ENGAGESPOT_API_KEY',
apiSecret: 'YOUR_ENGAGESPOT_API_SECRET',
});

client.send({
notification: {
templateId: 485729,
},
data: {
attachments: [
{
content:
'JVBERi0xLjMNCiXi48/TDQoNCjEgMCBvYmoNCjw8DQovVHlwZSAvQ2F0YWxvZw0KL091dGxpbmVzIDIgMCBSDQovUGFnZXMgMyAwIFINCj4+DQplbmRvYmoNCg0KMiAwIG9iag0KPDwNCi9UeXBlIC9PdXRsaW5lcw0KL0NvdW50IDANCj4LjI1MDAgNjA0Ljk0NDAgVGQNCiggbW9yZSB0ZXh0LiBBbmQgbW9yZSB0ZXh0LiBBbmQgbW9yZSB0ZXh0LiBBbmQgbW9yZSB0ZXh0LiBBbmQgbW9yZSB0ZXh0LiA==',
name: 'sample.pdf',
contentType: 'application/pdf',
},
],
},
recipients: ['unique-user-id'],
});