A demo app that uses the IBM Watson Message Insights
and the IBM Watson Message Sentiment
add-ons for Twilio.
TODO
This app demonstrates how quickly you can build an app on Bluemix using the Watson Add-ons for Twilio service.
You can use this app in any browser.
You can deploy your own instance of the demo app to Bluemix.
-
Create a Bluemix Account.
Sign up for Bluemix, or use an existing account.
-
Download and install the Cloud-foundry CLI tool.
-
Clone the app to your local environment from your terminal using the following command:
git clone https://github.com/cognitive-catalyst/twilio.git
-
cd
into this newly created directory. -
Install the required npm packages using the following command:
npm install
- Build your app with the following command:
npm run build
- Edit the
manifest.yml
file and change the<uname>
and<uname>
to something unique.
applications:
- name: <uname>
host: <uname>
buildpack: python_buildpack
path: .
domain: mybluemix.net
instances: 1
memory: 256M
The host you use will determinate your application URL initially, for example, <uname>.mybluemix.net
.
- Connect to Bluemix in the command line tool and follow the prompts to log in:
cf api https://api.ng.bluemix.net
cf login
- First we need to create a MySQL Database instance. We will be using the ClearDB Spark Plan which is free and can hold up to 5 MB of data with 4 simultaneous connections. Note: You might need to target a space by selecting a space or by using the
cf target -s SPACE
command.
cf create-service cleardb spark mysql-twilio-instance
- Push the demo app to Bluemix. You need to perform additional steps when it is deployed, so you must add the option --no-start argument.
cf push --no-start
- Now, bind the service to your app. Note: The name
<uname>
must be updated to reflect the name that you chose in step 5.
cf bind-service <uname> mysql-twilio-instance
- Finally, start your app. You can also do this from the Bluemix dashboard. Note: The name
<uname>
must be updated to reflect the name that you chose in step 5.
cf start <uname>
Congratulations! You now have your very own instance of the Twilio demo app running on Bluemix.
After you connect it to your Twilio service, you can
try it out at https://<uname>.mybluemix.net
, where <uname>
is the host value that you set in your manifest.yml
file.
-
If don't have node.js already, download node.js and install it on your local machine.
-
Clone the app to your local environment from your terminal using the following command:
git clone https://github.com/cognitive-catalyst/twilio.git
-
cd
into this newly created directory. -
Install the required npm packages using the following command:
npm install
- Build your app with the following command:
npm run build
- Set the mysql database credentials in the
config.json
file:
{
"credentials": {
"name": "twilio",
"hostname": <hostname>,
"port": "3306",
"username": <username>,
"password": <password>
}
}
- Run your app with the following command:
python server.py
Now, go to localhost:PORT
in your browser (for example, PORT is 8888 in the example above).
- Create a Twilio Account
- Navigate to the Programmable SMS services page and click on "Create new Messaging Service"
- From the configure pane, put "http://<your-app-name>.mybluemix.net/api/message" as the Request Url
- Navigate to the numbers pane and Buy a Number
- Add the IBM Watson Message Insights and the IBM Watson Message Sentiment Add-ons from the Add-ons page
Now, using the number you set up in your Twilio Configuration, you can send an SMS to that number, and it will appear
on the <uname>.mybluemix.net
website with the keywords and entities highlighted, sentiment with possible
related concepts displayed on the right, and an aggregate sentiment score of the past months messages on the left. Here is an example:
We are happy to accept external contributions to this project, either in the form of issues or pull requests. If you find a bug, please report it using the Issues section or even better, fork the project and submit a pull request with your fix! Pull requests will be evaluated on an individual basis based on value added to the sample application.
The primary source of debugging information for your Bluemix app is the logs. To see them, run the following command using the Cloud Foundry CLI:
cf logs <application-name> --recent
For more detailed information on troubleshooting your application, see the Troubleshooting section in the Bluemix documentation.
IBM Bluemix
IBM Bluemix Documentation
IBM Bluemix Developers Community
Twilio Marketplace