Upload
cindy-cullen
View
335
Download
6
Embed Size (px)
DESCRIPTION
Sending and Receiving text and phone messages on my website.
Citation preview
How to Integrate Text and Phone Messaging
with Your Website
by Cindy Cullencindycullen.com
Programming since 1983Building websites since 1999
Freelance web developer since 2003Cell phone user since they were too big to carry
Taught Computers to children and adults – Online, Homeschool co-ops, Elementary School,
Junior High, High School, College, Seminars
Messages
MyOutdoorCalendar.com
Images courtesy of vectorolie / FreeDigitalPhotos.net
We tried…
“We need phone calls and text messages”
Email Mobile Apps
Image courtesy of zirconicusso / FreeDigitalPhotos.net
Short Codes
O Five digit number
O About $1000+/month
O Long application approval process
Shared Short CodesO Buy Keyword(s) – about $25/month
O Phone numbers – about $3/monthO Voice – about $0.05/minuteO Text - about $0.05/minute
O Bulk Monthly plans usually available
Images courtesy of vectorolie / FreeDigitalPhotos.net
BowlingGreenMassage.com
Mass TextOpening today at 3pm
Database of phone numbers
Opening today at 3pm
Opening today at 3pm
Opening today at 3pm Opening today at 3pm
Openin
g to
day a
t 3pm
I’ll ta
ke it!615-555-0123 gets it!
Web Meets Messaging with 10 digit phone numbers
O Twilio
O Tropo
O Plivo
O Nexmo
How it WorksO Buy Phone Number (or short code)
O Receive messages on my websiteO Call or Text that numberO Twilio/Tropo/Plivo/Nexmo sends the message to
my URLO My website processes the message and
responds (usually with XML)
O Send messages from my websiteO My website sends instructions to that number
using a provided library and API
PricingO Phone Numbers
O $0.80/month - $3/month (Avg. $1/month)
O VoiceO Inbound $0.0050/min – $0.03/min (Avg. $0.01/min)O Outbound $0.0130/min – $0.03/min (Avg.
$0.02/min)
O SMSO Inbound Free – $0.01/msg (Avg $0.0075/msg)O Outbound $0.0065/msg - $0.01/msg (Avg.
$0.0075/msg)
My Pick
TwilioO Average pricingO Great documentationO Great tutorialsO SubaccountsO AnalyticsO Developer toolsO TriggersO Easiest to get up and running for ME
Mass TextOpening today at 3pm
Database of phone numbers
Opening today at 3pm
Opening today at 3pm
Opening today at 3pm Opening today at 3pm
Openin
g to
day a
t 3pm
I’ll ta
ke it!615-555-0123 gets it!
Sent to My Script
require "Services/Twilio.php";$AccountSid = “Bxxxxxxx”;$AuthToken = “2xxxxxxxx";$client = new Services_Twilio($AccountSid, $AuthToken);$twilio_number = “615-555-0123”;
If ($_POST[‘From’] == $twilio_number) { $body =; $users = get_users('meta_key=phone'); $special_chars = array("-","(",")");
foreach ($users as $user) { $phone = '+1'.str_replace($special_chars,"",get_user_meta($user->ID, 'phone', true)); $numbers[] = $phone; }
foreach ($numbers as $number) { $sms = $client->account->messages->sendMessage($twilio_number, $number, $_POST[‘Body’]); }} else { // Process user message}
Respond to Text
<?php header(“content-type: text/xml”);echo “<?xml version=\”1.0\” encoding=\”UTF-8\” ?>\n”;?>
<Response> <Message>Thanks <?php echo $name ?> for your response.</Message></Response>
CloneMeServices.com
Dial 1 for emergency
Dial 2 to leave a message
Image courtesy of Stuart Miles /FreeDigitalPhotos.net
When the number is called…<?php date_default_timezone_set('America/Chicago'); header("content-type: text/xml");echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";if (date("H") > '20') : // time later than 9PM? ?> <Response> <Gather action="/user-input" numDigits="1"> <Say>Welcome to Clone Me Services.</Say> <Say>If this is an emergency please press 1</Say> <Say>Otherwise, please press2</Say> </Gather> <Say>Sorry, I didn't get your response.</Say> <Redirect>/phone</Redirect></Response><?php else: ?> // time before 9PM, just forward <Response> <Dial>+12707916649</Dial> </Response><?php endif; ?>
User presses number…<?php // if the caller pressed anything but 1 or 2 send them back if($_REQUEST['Digits'] != '1' and $_REQUEST['Digits'] != '2') { header("Location: /phone"); die; } // otherwise, if 1 was pressed we Dial CloneMeServices. If 2 we make an audio recording up to 30 seconds long. header("content-type: text/xml"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n”; ?>
<Response><?php if ($_REQUEST['Digits'] == '1') { ?> <Dial>+16155551111</Dial> <Say>The call failed or the remote party hung up. Goodbye.</Say><?php } elseif ($_REQUEST['Digits'] == '2') { ?> <Say>Record your message after the tone.</Say> <Record maxLength="30" action="/after-recording" /><?php } ?></Response>
After the recording…
<?phpheader("content-type: text/xml");echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";?>
<Response> <Say>Thanks for your message. Goodbye.</Say></Response>
Image courtesy of zirconicusso / FreeDigitalPhotos.net
ApplicationsO Appointment RemindersO Call Queue’s – matching callers and
agentsO Call Screening – find a live body to
answerO Call MetricsO Click to Call – button on website
(calls to or from browsers or mobile devices $0.0025/min)
O Automated Phone System
More ApplicationsO Conference CallsO Phone PollsO Voice BroadcastO VoicemailO Voice TranscriptionO Audio Recording from your WebsiteO Browser PhoneO Browser to Browser Calls
And More!O Group ChatO Text to SpeechO SMS notificationsO SMS from a callO MMS (some may support – only on
short codes with twilio)
Who Will Want This?O DoctorsO DentistsO Hair and Nail SalonsO Massage TherapistsO Other Professional ServicesO Marketers (careful with bulk
messaging!)O Dry CleanersO Restaurants
Who Can Use this?O SchoolsO Clubs and GroupsO ChurchesO Political GroupsO Fitness Centers & Sports ClubsO Anybody!