Twilreapi is an Open Source implementation of Twilio's REST API written in Rails. You can use Twilreapi as a drop-in replacement for Twilio and enqueue calls, send SMS etc.
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
Check the output of bin/setup
and note down the Account SID and Auth Token.
To seed the database run ./bin/rails db:seed
. To create an admin account specify the admin account permissions with ADMIN_ACCOUNT_PERMISSIONS
. E.g.
$ ADMIN_ACCOUNT_PERMISSIONS=comma_separated_list_of_permissions ./bin/rails db:seed
Configuration is done using environment variables. See .env
Start the web server using foreman. Note this will read the environment variables from .env
$ bundle exec foreman start web
Twilreapi is queue agnostic. By default it will enqueue jobs using ActiveJob. The following background processing libraries are also supported and can be configured using environment variables.
- active-elastic-job (Default. Recommended for AWS deployment)
- twilreapi-sidekiq (Recommended for Heroku deployment)
- shoryuken
In order to trigger outbound calls you can connect Twilreapi to Somleng.
See DEPLOYMENT
$ curl -XPOST https://your-host-name/api/2010-04-01/Accounts/{AccountSID}/Calls.json \
-d "Method=GET" \
-d "Url=http://demo.twilio.com/docs/voice.xml" \
-d "To=%2B85512345678" \
-d "From=%2B85512345679" \
-u 'your_account_sid:your_auth_token'
$ curl https://your-host-name/api/2010-04-01/Accounts/{AccountSID}/Calls/{CallSID}.json \
-u 'your_account_sid:your_auth_token'
$ curl https://your-host-name/api/2010-04-01/Accounts/{AccountSID}/IncomingPhoneNumbers/{IncomingPhoneNumberSID}.json \
-u 'your_account_sid:your_auth_token'
The software is available as open source under the terms of the MIT License.