I want to install TextBelt, an open source cURL SMS API, to my own Amazon EC2 web server and use it to send text messages. However, I'm unsure about how to properly go about this.
I used git
to clone all the files to a directory called /var/www/textbelt
. I then used npm
to install all of the dependencies listed in package.json
file and created the symlink, as per the directions provided in this answer. I saw that there's a bash script start.sh
in the "scripts" folder, so i cd'ed into it and ran sh start.sh
. I then got the following message:
nohup: appending output to ‘/home/ec2-user/nohup.out’
Naturally, I checked the log, and saw this:
^[[0;31mError: Cannot find module '/var/www/textbelt/scripts/app.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
For some reason start.sh
references the app.js
path incorrectly. I fixed this by changing app.js
to ../app.js
, and tried again. This is my complete output:
^[[0;42m hotnode ^[[m ^[[0;32mnode process restarted^[[m
^[[0;31mconnect.multipart() will be removed in connect 3.0
^[[m
^[[0;31mvisit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
^[[m
^[[0;31mconnect.limit() will be removed in connect 3.0
^[[m
Listening on 9090
^[[0;31m
^[[m
^[[0;31mevents.js:72
^[[m
^[[0;31m throw er; // Unhandled 'error' event
^[[m
^[[0;31m ^[[m
^[[0;31m ^[[m
^[[0;31m ^[[m
^[[0;31m ^[[m
^[[0;31m ^[[m
^[[0;31m ^[[m
^[[0;31m ^[[m
^[[0;31m ^[[m
^[[0;31m ^[[m
^[[0;31m ^[[m
^[[0;31m ^[[m
^[[0;31m ^[[m
^[[0;31m ^[[m
^[[0;31m ^[[m
^[[0;31m^^[[m
^[[0;31m
^[[m
^[[0;31mError: Redis connection to localhost:6379 failed - connect ECONNREFUSED
at RedisClient.on_error (/var/www/textbelt/node_modules/redis-url/node_modules/redis/index.js:196:24)
at Socket.<anonymous> (/var/www/textbelt/node_modules/redis-url/node_modules/redis/index.js:106:14)
at Socket.emit (events.js:95:17)
at net.js:440:14
at process._tickCallback (node.js:419:13)
^[[m
After Googling "Redis connection to..failed", I found this answer which suggested that the solution was to start the Redis server by typing redis-server
. However, I get the following error:
-bash: redis-server: command not found
This suggests that redis was not installed properly. However, after looking at my node_modules
folder, I see that there is indeed a redis-url
folder inside, which (I'm assuming) means that the dependency was properly installed? Do I have to do a server-wide install or something?
I'm kinda stuck here.
Overall, I am not sure if I am proceeding in the right direction. What is the proper way to install and start up the TextBelt API to get it running properly.
Update: Alright, so I figured out that I had to also install the redis
server separately. Restarted everything, the logs look good now:
^[[0;42m hotnode ^[[m ^[[0;32mnode process restarted^[[m
^[[0;31mconnect.multipart() will be removed in connect 3.0
^[[m
^[[0;31mvisit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
^[[m
^[[0;31mconnect.limit() will be removed in connect 3.0
^[[m
Listening on 9090
However, I believe that further configuration is required to actually send a text message. For example, I tried using cURL to send a message using my server, just as I would to http://textbelt.com:
$ curl http://my.ip/text \
-d number=5551234567 \
-d "message=I sent this message for free with textbelt.com"
But this did not work (all I got was the HTML of my 404 not found page). One thing to note is that I currently have the textbelt
folder in /var/www/
, but the web document root is in /var/www/html/
. I don't think that I have to actually move the folder to the document root, is this correct? How do I need to proceed?