Send Messages
In order to send messages, you need to create a Delivery using the deliver()
method. This method requires a Private Key, and thus only available in the Backend SDKs.
Ensure you have installed DashX SDKs before continuing.
- Node.js
- Python
- Ruby
// Sending a Message Template
dashx.deliver('email/forgot-password', {
to: user.email,
data: { reset_password_token: '<TOKEN>' }
});
// Sending an Ad-Hoc Message
dashx.deliver('email', {
content: {
name: 'Contact us',
from: 'noreply@dashxdemo.com',
to: [email, 'sales@dashx.com'],
subject: 'Contact Us Form',
html_body: `
<mjml>
<mj-body>
<mj-section>
<mj-column>
<mj-divider border-color="#F45E43"></mj-divider>
<mj-text>Thanks for reaching out! We will get back to you soon!</mj-text>
<mj-text>Your feedback: </mj-text>
<mj-text>Name: {{name}}</mj-text>
<mj-text>Email: {{email}}</mj-text>
<mj-text>Feedback: {{feedback}}</mj-text>
<mj-divider border-color="#F45E43"></mj-divider>
</mj-column>
</mj-section>
</mj-body>
</mjml>`
},
data: {
name,
email,
feedback
}
});
// Sending a Message Template
dashx.deliver('email/forgot-password', {
to: user.email,
data: { reset_password_token: '<TOKEN>' }
})
// Sending an Ad-Hoc Message
dashx.deliver('email', {
content: {
name: 'Contact us',
from: 'noreply@dashxdemo.com',
to: [email, 'sales@dashx.com'],
subject: 'Contact Us Form',
html_body: `
<mjml>
<mj-body>
<mj-section>
<mj-column>
<mj-divider border-color="#F45E43"></mj-divider>
<mj-text>Thanks for reaching out! We will get back to you soon!</mj-text>
<mj-text>Your feedback: </mj-text>
<mj-text>Name: {{name}}</mj-text>
<mj-text>Email: {{email}}</mj-text>
<mj-text>Feedback: {{feedback}}</mj-text>
<mj-divider border-color="#F45E43"></mj-divider>
</mj-column>
</mj-section>
</mj-body>
</mjml>`
},
data: {
name,
email,
feedback
}
})
# Sending a Message Template
dashx.deliver('email/forgot-password', {
to: user.email,
data: { reset_password_token: '<TOKEN>' }
})
# Sending an Ad-Hoc Message
dashx.deliver('email', {
content: {
name: 'Contact us',
from: 'noreply@dashxdemo.com',
to: [email, 'sales@dashx.com'],
subject: 'Contact Us Form',
html_body: `
<mjml>
<mj-body>
<mj-section>
<mj-column>
<mj-divider border-color="#F45E43"></mj-divider>
<mj-text>Thanks for reaching out! We will get back to you soon!</mj-text>
<mj-text>Your feedback: </mj-text>
<mj-text>Name: {{name}}</mj-text>
<mj-text>Email: {{email}}</mj-text>
<mj-text>Feedback: {{feedback}}</mj-text>
<mj-divider border-color="#F45E43"></mj-divider>
</mj-column>
</mj-section>
</mj-body>
</mjml>`
},
data: {
name,
email,
feedback
}
})