Skip to content

Instantly share code, notes, and snippets.

@ewandennis
Created November 9, 2016 12:39
Show Gist options
  • Save ewandennis/498af8c168f4276d5486f3d415f32aa1 to your computer and use it in GitHub Desktop.
Save ewandennis/498af8c168f4276d5486f3d415f32aa1 to your computer and use it in GitHub Desktop.
Sending SMS with SparkPost Enterprise
'use strict';
var SparkPost = require('sparkpost');
let client = new SparkPost('YOUR_API_KEY', {
endpoint: 'https://yourservice.sparkpostelite.com/'
});
client.transmissions.send({
campaign_id: "SMS notifications",
options: {
open_tracking: false,
click_tracking: false
},
recipients: [
{
address: {
name: 'You there',
email: "[email protected]"
}
}
],
metadata: {
binding: "notifications"
},
return_path: "[email protected]",
content: {
from: {
name: "SMS Notifications",
email: "[email protected]"
},
subject: "unused",
text: "Hi {{address.name}} \nThis SMS notifications is a demo. \nClick here for our site ==> http://www.sparkpost.com/",
}
}).then(function(res) {
console.log(res);
}).catch(function(err) {
console.log(err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment