-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SMS notification on commit #32
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Twilio SMS integration | ||
|
||
Sign up for an account - https://www.twilio.com | ||
|
||
Requires PHP Helper Library - download here - http://github.com/twilio/twilio-php | ||
|
||
#### pantheon.yml | ||
|
||
Add this snippet to enable | ||
|
||
``` | ||
# Commits: Notify team of new commit to master (dev) | ||
sync_code: | ||
after: | ||
- type: webphp | ||
description: send sms to site owner | ||
script: private/quicksilver/sms/twilio_deploy_notification.php | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Twilio SMS integration | ||
|
||
Download PHP Helper Library - http://github.com/twilio/twilio-php | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be good to tell users how the download should be unpacked (i.e., "Make sure that Twilio.php is at |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
error_reporting(-1); | ||
|
||
require('twilio-php/Services/Twilio.php'); // load twilio library | ||
$account_sid = '################################'; // Twilio account sid | ||
$auth_token = '################################'; // Twilio auth token | ||
$client = new Services_Twilio($account_sid, $auth_token); | ||
|
||
/* | ||
To = Recipient cellphone number | ||
From = Twilio account number | ||
Body = Commit message, git pretty format placeholders are here https://git-scm.com/docs/pretty-formats | ||
*/ | ||
|
||
$client->account->messages->create(array( | ||
// insert recipient cellphone number | ||
'To' => "+15555555555", | ||
// insert twilio number | ||
'From' => "+15555555555", | ||
// commit message | ||
'Body' => "\nLatest commit to {$_ENV['PANTHEON_SITE_NAME']}:\n" . `git log -1 --pretty=%an%n%h%n%B`, | ||
)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For quicksilver-cli, snippets should be labeled
yaml
and includeworkflows:
. See README for other examples.