Skip to content

Instantly share code, notes, and snippets.

@TMcManus
TMcManus / conference.php
Created December 3, 2012 08:48
Unique Conference
<?php
/*
* Download the twilio-php helper library from:
* https://github.com/twilio/twilio-php
* Copy the "Services" folder into the directory containing this file.
*/
require('Services/Twilio.php');
$response = new Services_Twilio_Twiml;
$dial = $response->dial();
@TMcManus
TMcManus / circuit-breaker.php
Last active October 13, 2015 04:18
Twilio Usage Trigger Manager and Subaccount Circuit Breaker
<?php
/**
* ### Subaccount Circuit Breaker Script ###
* This script is designed to make a subaccount suspend itself in response to
* a Usage Trigger firing a callback. You can learn about Usage Triggers here:
* https://www.twilio.com/docs/api/rest/usage-triggers
*
* Why would you want to do this? In some cases suspending a subaccount based on high,
* unexpected usage can be a good thing. Coding errors and fraud can both cause spikes
* in undesired usage. Setting this script up might help you to sleep better at night.
@TMcManus
TMcManus / main.xml
Created November 19, 2012 15:30
Play a message before connecting a call
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>This call may be recording for Quality Assurance purposes.</Say>
<Dial record="true">
<Number url="message.xml">+18085551234</Number>
</Dial>
</Response>
@TMcManus
TMcManus / call-download.php
Last active August 18, 2024 22:49
Twilio Call Log CSV Download Script
<?php
/**
* Download the library from: https://github.com/twilio/twilio-php
* Copy the 'Services' folder into a directory containing this file.
*/
require('Services/Twilio.php');
$account_sid = "ACXXXXXXXXXXX"; // Your Twilio account sid
$auth_token = "YYYYYYYYYYYY"; // Your Twilio auth token
@TMcManus
TMcManus / README.md
Created October 4, 2012 00:43
Risky Account Finder

Installation and Use

  1. In a python environment that has pip installed, do pip install twilio then pip install phonenumbers.
  2. Do python risky-account-finder.py
@TMcManus
TMcManus / send-sms-from-a-number-pool.php
Created October 3, 2012 21:43
How to send SMS Messages from a pool of numbers
<?php
// Sending SMS messages from a pool of numbers
// Load the Twilio PHP Helper Library
// This library can be downloaded from: https://github.com/twilio/twilio-php
require('Services/Twilio.php');
// Fill in your account credentials
$sid = "ACXXXXXXX"; // Your Account SID from www.twilio.com/user/account
$token = "YYYYYYY"; // Your Auth Token from www.twilio.com/user/account
@TMcManus
TMcManus / validation.php
Created April 30, 2012 04:45
Phone Number Validation Link for Twilio
<?php
/**
* Include the offical Twilio PHP Helper Library, which can be found at
* http://www.twilio.com/docs/libraries
*/
include 'Services/Twilio.php';
// Your Twilio Credentials
$accountSid = 'AC1987654gef...'; // Replace with your own Account Sid
@TMcManus
TMcManus / create_database.php
Created April 27, 2012 22:52
<Gather> a birthday with Twilio
<?php
$db = new PDO('sqlite:database.sqlite');
// Create the SQLite table.
$db->exec('CREATE TABLE gather_date (id INTEGER PRIMARY KEY, call_sid TEXT(32), year TEXT(4), month TEXT(2), day TEXT(2));');
// Populate it with some data
$db->exec("INSERT INTO gather_date (call_sid, year, month, day) VALUES ('fhsdhfiuh', '2010', '09', '01');");
if (file_exists('database.sqlite'))
@TMcManus
TMcManus / fix_idea.php
Created March 22, 2012 16:43
Auto-responder Fix idea
<?php
$twilio_welcome_message = "Welcome to Twilio SMS. Configure your number's SMS URL to change this message. Reply HELP for help. Reply STOP to unsubscribe. Msg&Data rates may apply.";
if($_RESPONSE['Body'] != $twilio_welcome_message){
echo("<Sms>Welcome to Twilio SMS. Configure your number's SMS URL to change this message. Reply HELP for help. Reply STOP to unsubscribe. Msg&Data rates may apply.</Sms>");
}
@TMcManus
TMcManus / form.html
Created March 13, 2012 00:30
Simple Form to SMS
<form action="form_to_sms.php" method="post">
<label for="phone">Phone Number</label>
<input type="tel" name="phone"/><br/>
<label for="body">Message Body</label>
<textarea name="body" maxlength="160"></textarea><br/>
<input type="submit" />
</form>