Last active
September 18, 2017 01:09
-
-
Save Brodan/288ff0448c9c981cfb9d89c626929f85 to your computer and use it in GitHub Desktop.
A Twilio Function snippet for handling Travis CI webhook notifications.
This file contains hidden or 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
exports.handler = function(context, event, callback) { | |
let travis_payload = JSON.parse(event.payload); | |
let message_body = `${travis_payload.repository.name} \ | |
failed to build after changes pushed by \ | |
${travis_payload.committer_name}`; | |
let client = context.getTwilioClient(); | |
client.messages.create({ | |
to: '+15555555555', // Text this number | |
from: '+15555555555', // From a valid Twilio number | |
body: message_body | |
}) | |
.then(message => { | |
console.log(message.sid); | |
callback(null, "OK"); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment