Created
November 9, 2016 12:39
-
-
Save ewandennis/498af8c168f4276d5486f3d415f32aa1 to your computer and use it in GitHub Desktop.
Sending SMS with SparkPost Enterprise
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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