Giter Site home page Giter Site logo

fuel-twilio's Introduction

Twilio

Twilio is a package to allow interaction with the Twilio service.

Installation

  1. Clone (git clone git://github.com/maca134/fuelphp-twilio) / download
  2. Copy to fuel/packages/
  3. Copy fuel/packages/twilio/config/twilio.php to fuel/app/config/
  4. Add your Twilio credentials and defaults for each twiml element.

Introduction

Rest API

This package will allow you to send requests to Twilio:

TwiML: Twilio Markup Language

It also includes an object based implementation of Twilio's TwiML.

Here are the TwiML elements:

Configuration

Copy config/twilio.php to app/config/twilio.php and change whatever setting in need of changing.

Rest API Examples

Make a call

$call = Twilio\Twilio::request('MakeCall');
$response = $call->create(array(
	'To' => '+4412345678901',
	'From' => '+4416789012345',
	'Url' => Uri::create('welcome/call')
));

Send an SMS message

$sms = Twilio\Twilio::request('SmsMessage');
$response = $sms->create(array(
	'To' => '+4412345678901',
	'From' => '+4416789012345',
	'Body' => 'SMS content'
));

TwiML Examples

Simple Example

$twiml = Twilio\Twilio::twiml();
$twiml->say('Hello World!')->pause('', array('length' => '5'));
$twiml->render();

Will render:

<?xml version="1.0" encoding="UTF-8" ?>
	<Response>
		<Say voice="man" language="en" loop="1">Hello World!</Say>
		<Pause length="5" />
	</Gather>
</Response>

Grabbing key presses during a call

$question = Twilio\Twilio::twiml();
$question->say('Please press 1 or 2')->pause()->play('http://some.place.com/music.mp3');

$twiml = Twilio\Twilio::twiml();
$twiml->pause()->gather($question, array(
	'action' => Uri::create('twilio/next_action'),
	'numDigits' => '1'
		)
);
$response = $twiml->render();

Sending an SMS message

$twiml = Twilio\Twilio::twiml();
$twiml->sms($message, array('from' => '+441234567890'));

Notes

Only the TwiML elements Gather and Dial have nested objects.

Gather can have the following nested variables:

  • Say
  • Play
  • Pause

Dial can have:

  • A string, telephone number
  • Number
  • Client
  • Conference

Get In Touch

You can get in touch either through GitHub or you can email me at [email protected].

Checkout my site at http://maca134.co.uk

Thanks

fuel-twilio's People

Contributors

maca134 avatar

Watchers

Branko Vukmirovic avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.