-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.rb
62 lines (51 loc) · 1.38 KB
/
main.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
require 'rapgenius'
require 'pp'
require 'json'
require 'soundcloud'
require 'twilio-ruby'
require 'youtube_search'
require 'sinatra'
get '/' do
'Nothing here'
end
def make_call(video_id, video, number)
# put your own credentials here
account_sid = 'AC39cfed8c7714f14d7d48e462fa809a20'
auth_token = '835f421ebd9035525705eb827d2a9935'
# set up a client to talk to the Twilio REST API
@client = Twilio::REST::Client.new account_sid, auth_token
@client.account.calls.create({
:to => number,
:from => '+19182129899',
:url => "http://54.149.169.73:3000/tmp/" + video_id + "/music.mp3",
:method => 'GET',
:fallback_method => 'GET',
:status_callback_method => 'GET',
:record => 'false'
})
video
end
def say_message(body, number)
# put your own credentials here
account_sid = 'AC39cfed8c7714f14d7d48e462fa809a20'
auth_token = '835f421ebd9035525705eb827d2a9935'
content_type "text/xml"
"<Response>
<Say voice=\"alice\">hello there</Say>
<Dial callerId=\"\">
<Client>jenny</Client>
</Dial>
</Response>"
end
def send_message(body, number)
account_sid = 'AC39cfed8c7714f14d7d48e462fa809a20'
auth_token = '835f421ebd9035525705eb827d2a9935'
body.slice! "video"
# set up a client to talk to the Twilio REST API
@client = Twilio::REST::Client.new account_sid, auth_token
@client.messages.create(
from: '+19182129899',
to: number,
body: body
)
end