【发布时间】:2016-11-15 05:09:50
【问题描述】:
应用程序使用 REST API 发送消息,但就目前而言,“收件人”号码已硬编码到应用程序中。我希望该数字是用户输入的值。
HTML:
<!DOCTYPE html>
<head>
<title>Joe's Web App</title>
<link rel="stylesheet" type="text/css" href="index.css" media="screen"/>
</head>
<body>
<div class="content">
<div class="words">
<h1>My Name</h1>
<p>
Insert your number below to recieve a text!
</p>
</div>
<input type="tel" placeholder="Phone Number" name="number">
<input type="submit">
</div>
</body>
鲁比:
require 'rubygems'
require 'twilio-ruby'
account_sid = 'AC26b29f734e8145f6df3497eb6ca50205'
auth_token = 'my auth token'
@client = Twilio::REST::Client.new account_sid, auth_token
@client.account.messages.create({
:from => 'Twilio Number',
:to => 'phone number',
:body => 'Hey this is Joe!',
})
【问题讨论】:
-
我认为如果您使用机架构建会很简单。更多详情..codenoble.com/blog/ruby-web-applications-without-rails
-
所以你的意思是,你想在 sinatra 中实现这个还是什么?
-
欢迎来到 Stack Overflow。你想要什么并不完全清楚。
标签: ruby sinatra twilio twilio-api