SlideShare a Scribd company logo
1 of 38
Download to read offline
POROZMAWIAJ
ZE SWOJĄ APLIKACJĄ
Kamil Kujawiński, Marcin Najtkowski
PyConPL2015,16-18.10.2015
WPROWADZENIE
Co to jest twilio?
O konkurencyjnych rozwiązaniach, przeciętnym Kowalskim,
klientach i dlaczego twilio jest fajne.
CO TO JEST TWILIO?
“Enabling phones, VoIP,
and messaging to be
embedded into web,
desktop, and mobile
software.”
ALTERNATYWY 4
ALBO 2
Plivo Tropo Twilio
Serwery dedykowane Voxeo AWS
On premises tak tak nie
Zasięg 55 krajów 28 krajów 44 kraje
Obsługiwane języki 16 25 26
przeciętny KOWALSKI
numer telefonu 1 $
minuta połączenia 0,065 $
sms 0,034 $
Czy
może?
przeciętny KOWALSKI
Z obliczeń wynika,
że owszem.
Czy
może?
NAJWIĘKSI KLIENCI
Coca-Cola
UBER
i inni
DLACZEGO twilio
jest FAJNE
dostępne
przystępne
przyjazne
numerek
czyli nowy numer telefonu w kilku krokach
APLIKACJA
W
MINUT (+30 na drobiazgi)
CO BĘDZIEMY ROBIĆ?
zarejestruje
uczestników
zada
mnóstwo
głupich
pytań
wyłoni
zwycięzców
aplikacja do przeprowadzenia prostego konkursu, która
słowoklucz;)
implementacja
w pięciu krokach
REJESTRACJA
UCZESTNIKA
odbieranie wiadomości sms
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Message>
<Body>
Zarejestrowano Twój numer telefonu
w konkursie pod nazwą JANUSZ.
</Body>
</Message>
</Response>
def register(request):
data = request.POST
try:
phone_number = data['From']
name = data['Body']
except KeyError:
return HttpResponseBadRequest()
Participant(phone_number, name).save()
msg = "Zarejestrowano Twój numer telefonu " +
"w konkursie pod nazwą %s." % name
resp = twilio.twiml.Response()
resp.message(msg)
return HttpResponse(resp)
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Message>
<Body>
Zarejestrowano Twój numer telefonu
w konkursie pod nazwą JANUSZ.
</Body>
</Message>
</Response>
+48 123 456 789
wyślij
na numer
w treści podaj swoje imię
INICJOWANIE
POŁĄCZENIA
telefon do uczestnika
client = TwilioRestClient(
settings.TWILIO_ACCOUNT_SID,
settings.TWILIO_AUTH_TOKEN
)
url = 'https://xyz.ngrok.io/welcome/%s' 
% participant.id
status_url = 'https://xyz.ngrok.io/call_ended'
client.calls.create(
url=url,
status_callback=status_url,
to=participant.phone_number,
from_=settings.TWILIO_CALLING_NUMBER
)
PROWADZENIE
ROZMOWY
obsługa dzwoniącego
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Pause length="2"/>
<Say language="pl-PL" voice="alice">
Witaj JANUSZ. Czas na pytania!
</Say>
<Redirect>/question/42/</Redirect>
</Response>
def welcome(request, participant_id):
participant = Participant.objects.get(
id=participant_id)
resp = twiml.Response()
resp.pause(length=2)
resp.say(
'Witaj %s. Czas na pytania!' %
participant.name,
voice='alice', language='pl-PL')
resp.redirect(
'/question/%s/' % participant.id)
return HttpResponse(resp)
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Pause length="2"/>
<Say language="pl-PL" voice="alice">
Witaj JANUSZ. Czas na pytania!
</Say>
<Redirect>/question/42/</Redirect>
</Response>
ZADAWANIE
PYTAŃ
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Gather action="/answer/42/" method="POST"
numDigits="2" timeout="30">
<Say language="pl-PL" loop="5"
voice="alice">
Ile bramek strzelił Robert w 9 minut?
1) 5. 2) 7. 3) 13.
</Say>
</Gather>
<Say language="pl-PL" voice="alice">
Za wolno...
</Say>
<Redirect>/fail/42/</Redirect>
</Response>
VOICE = {'voice': 'alice', 'language': 'pl-PL'}
def question(request, participant_id):
participant = Participant.objects.get(id=participant_id)
resp = twiml.Response()
q = participant.next_question()
txt = q.prepare_question_and_answers()
answer_url = '/answer/%s/%s/' % (
participant.id, q.id)
ask = resp.gather(
numDigits=1,
action=answer_url,
method='POST',
timeout=30,
)
ask.say(txt, loop=5, **VOICE )
resp.say('Za wolno...', **VOICE )
resp.redirect('/fail/%s/' % participant.id )
return HttpResponse(resp)
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Gather action="/answer/42/" method="POST"
numDigits="2" timeout="30">
<Say language="pl-PL" loop="5"
voice="alice">
Ile bramek strzelił Robert w 9 minut?
1) 5. 2) 7. 3) 13.
</Say>
</Gather>
<Say language="pl-PL" voice="alice">
Za wolno...
</Say>
<Redirect>/fail/42/</Redirect>
</Response>
jeszcze trochę cierpliwości...
ZBIERANIE
ODPOWIEDZI
def answer(request, participant_id, question_id):
participant = Participant.objects.get(
id=participant_id)
question = Question.objects.get(
id=question_id)
choice = request.POST.get('Digits')
if choice:
choice = int(choice)
answer = question.answers()[choice - 1]
participant.save_answer(answer)
resp = twiml.Response()
resp.redirect(
'/question/%s/' % participant.id)
return HttpResponse(resp)
Czego nie pokazaliśmy, a na co jeszcze
WARTO ZWRÓCIĆ UWAGĘ
Dane o rozmowach
Możliwy wgląd w informacje o
połączeniu (trwającym lub
zakończonym).
Zestawianie połączeń
Opcja przekierowania połączenia na
inny numer.
Nagrywanie
Archiwizowanie przeprowadzonych
rozmów.
Własne komunikaty
Możliwość nagrania własnego głosu
i odtworzenia go podczas połączeń -
alternatywa dla syntezatora.
Kolejki
Opcja kolejkowania dzwoniących.
Twilio Client
Telefon w przeglądarce.
BEZPIECZEŃSTWO
BEZPIECZEŃSTWO
HTTPS
weryfikacja requestów z Twilio
przechowywanie auth token
weryfikacja użytkownika po numerze telefonu
copyrights
W prezentacji wykorzystano:
API docs - http://twilio.com
Zdjęcia:
dziecko https://www.flickr.com/photos/makelessnoise/195088755/
CocaCola https://www.flickr.com/photos/28481088@N00/2889066721/
Uber https://www.flickr.com/photos/aaronpk/15655460313/
kawa https://www.flickr.com/photos/kplanz/6855919503/
droga https://www.flickr.com/photos/chartno3/8164881237/
Kowalski, Pingwiny z Madagaskaru - bez wiedzy i zgody DreamWorks Pictures
Szablon prezentacji: http://www.slidescarnival.com
KONTAKT
Skargi, zażalenia, wnioski
Feedback dotyczący prezentacji i omawianych zagadnień mile widziany. :)
Kamil KUJAWIŃSKI
kamil@kujawinski.net
Marcin NAJTKOWSKI
marcin.najtkowski@gmail.com
http://talktoyourapp.herokuapp.com
https://github.com/kkujawinski/talktoyourapp
Dziękujemy za uwagę.
Szerokiej drogi!

More Related Content

Featured

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 

Featured (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

Porozmawiaj ze swoją aplikacją, PyCon PL 2015