|
- Create a webform page with 2 input fields, one for a name and one for a message and a “Send” button.”
- Add a function that runs when you click the input field.
Have it send parameters in a GET URL query to a web script. This looks something like:
window.location="http://youraccount.webscript.io/showmessage?name=value1&message=value2"
- Setup a WebScript account on www.webscript.io.
- Create a new Lua script, called something like showmessage. This script should grab the query URL parameters. Here is an example:
output = "Hello "..request.query.name.." your message is "..request.query.message
return output.
Save your script.
- Go back to the textbot.html page and modify the URL query to match your twlio account. Test the page to make sure its sending properly. Here is a working example.
- Next, setup a twilio account on www.twilio.com.
- Get an ACCOUNT SID, and AUTH TOKEN.
Buy a Phone Number you can send from. Send a test text message from the twilo dashboard.
- Authorize phones that can receive test SMS messages under "Verified Caller IDs"
- Go back to WebScript and create a new script called sendtwilio, or similar. Include:
local twilio = require('twilio')
local ACCOUNTSID = xxxx
local AUTHTOKEN = yyyy
local response = twilio.sms(. . .)
Look up Lua Twilio script for details.
- Update your textbot.html page to send a GET URL query to the new sendtwilio script, with the parameters needed to send a text - number and message.
- Test and finish the project till it looks perfect to you.
Have fun and good luck!
|
|