Skip to content

Instantly share code, notes, and snippets.

View jmadden's full-sized avatar
☘️

Jim Madden jmadden

☘️
View GitHub Profile
@jmadden
jmadden / collapse-header.js
Created October 1, 2025 22:24
Collapse ReadMe Reference Doc Header Sections
function bindSidebarHeadingToggles(root) {
const container = root || document;
const sections = container.querySelectorAll('.rm-Sidebar-section');
sections.forEach(section => {
const heading = section.querySelector(':scope > .rm-Sidebar-heading');
const list = section.querySelector(':scope > ul.rm-Sidebar-list');
if (!heading || !list) return;
// Skip if this <h2> already contains a <button> (native toggle)
@jmadden
jmadden / CustomListeners.js
Last active March 11, 2021 18:49
Location plugin-dual-channel-recording/src/listeners/CustomListeners.js
import { Actions, Manager, TaskHelper } from '@twilio/flex-ui';
import { getCustomerParticipant, getMyParticipant } from '../helpers';
const manager = Manager.getInstance();
const startCallRecording = async (callSid, callbackParameters) => {
console.debug('Creating recording for call SID:', callSid);
const fetchUrl = `https://${process.env.REACT_APP_SERVERLESS_DOMAIN}/recording/create`;
@jmadden
jmadden / 1-start.js
Last active July 19, 2023 22:31
Voice mail system using Twilio Functions
exports.handler = function(context, event, callback) {
let twiml = new Twilio.twiml.VoiceResponse();
const OWNER = '+1##########'; //Your mobile number.
if(event.From == OWNER){
const gather = twiml.gather({
action:'/callOut'
});
gather.say("Please enter the phone number you'd like to call followed by the pound sign.");
@jmadden
jmadden / sequential_dialing.php
Last active April 6, 2022 03:02
Sequentially dial phone numbers using Twilio and Twilio's PHP helper library
<?php
// Require the bundled autoload file - the path may need to change
// based on where you downloaded and unzipped the SDK
require __DIR__ . '/twilio-php-master/Twilio/autoload.php';
// Use Twilio\TwiML to build TwiML instructions through PHP
use Twilio\Twiml;
// Instantiate a TwiML object.
$response = new Twiml();
@jmadden
jmadden / 1-outbound-call.php
Last active June 12, 2025 10:16
Twilio PHP Outbound Call and Gather Example
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;
// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "YOU_ACCOUNT_SID";
$token = "YOUR_AUTH_TOKEN";
$client = new Client($sid, $token);
@jmadden
jmadden / forward_to_first_number.xml
Last active June 15, 2024 07:08
TwiML Incoming Calls - Forward call to numbers in order. Fire off VMail and send SMS on no answer
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<!-- Forward to first number and if no answer, action URL points to second number to try -->
<Dial timeout="15" action="forward_to_second_number.xml">
<Number url="whisper_instructions.xml">+15554441212</Number>
</Dial>
</Response>
<?php
use Twilio\Twiml;
class TwimlWrap
{
/** @var TwilioTwiml */
protected $twiml;
public function __construct()
@jmadden
jmadden / record-status.php
Last active June 9, 2017 19:44
Send an SMS message through Twilio and record the message status to a log file using a Status Callback URL
<?php
$sid = $_REQUEST['MessageSid'];
$status = $_REQUEST['MessageStatus'];
$logfile = "status_callback_log.txt";
$log = fopen($logfile, 'a+');
fwrite($log, date('Y-m-d H:i:s')." SID = " . $sid . "\n");
fwrite($log, date('Y-m-d H:i:s')." Status = " . $status . "\n");
fwrite($log, "\n");
fclose($log);
<?php
// PHP Helper Library was dinstalled using Composer.
// Required if your envrionment does not handle autoloading
require __DIR__ . '/vendor/autoload.php';
// Use the REST API Client to make requests to the Twilio REST API
use Twilio\Rest\Client;
// Your Account SID and Auth Token from twilio.com/console
@jmadden
jmadden / heroku_notes.md
Last active August 29, 2015 14:03
#Heroku Notes – Configurations and commands through the Heroku Toolbelt

#Heroku Notes ######Configurations and commands through the Heroku Toolbelt

Setting Environment Variables

Variables can be set and accessed on Heroku Dynos. To review your Dyno's configuration type the following in your toolbelt.

$ heroku config

Folloing is an example of how your results may look: