Skip to content

Instantly share code, notes, and snippets.

@ewandennis
Created November 9, 2016 12:39
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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: "19999999999@us.sms.int"
}
}
],
metadata: {
binding: "notifications"
},
return_path: "bounces-marketing@yourservice.sparkpostelite.com",
content: {
from: {
name: "SMS Notifications",
email: "notices@yourservice.sparkpostelite.com"
},
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