Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions sms/README.md
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)
Copy link
Member

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 include workflows:. See README for other examples.

sync_code:
after:
- type: webphp
description: send sms to site owner
script: private/quicksilver/sms/twilio_deploy_notification.php
```
3 changes: 3 additions & 0 deletions sms/twilio-php/README.md
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
Copy link
Member

Choose a reason for hiding this comment

The 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 twilio-php/Services/Twilio.php.) I haven't unpacked the library yet; if it contains the twilio-php directory, maybe say "Delete this folder and replace it with...". Specify if root folder should be renamed.

22 changes: 22 additions & 0 deletions sms/twilio_deploy_notification.php
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`,
));