Class: SmsServer

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/incognito/sms_server.rb

Constant Summary collapse

PORT =
ENV.fetch("PORT", 4567)

Class Method Summary collapse

Class Method Details

.boot_up!Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/incognito/sms_server.rb', line 31

def self.boot_up!
  Ngrok::Tunnel.start(addr: "localhost:#{PORT}")
  puts "***" * 10
  banner = <<-BANNER
Configure your webhook URL
For Twilio to know where to look, you need to configure your Twilio phone number
to call your webhook URL whenever a new message comes in.

1. Log into twilio.com and go to the Numbers page in the Console.
(https://www.twilio.com/console/phone-numbers/incoming)
2. Click on your SMS-enabled phone number.
3. Find the Messaging section. The default “CONFIGURE WITH” is what you’ll need: "Webhooks/TwiML."
4. In the “A MESSAGE COMES IN” section, select "Webhook" and paste in the URL you want to use:
#{Ngrok::Tunnel.ngrok_url_https}
5. Set the HTTP verb to GET.


  BANNER
  puts banner
  puts "***" * 10
  run!
end