This application is ready to run. You will need a web server that can serve static files and run PHP programs.
To deploy to Heroku, an internet cloud service provider, you will need an Heroku account to host your application. Once you have an account, stay logged in for the deployment and configuration.
When you deploy to Heroku, you will be prompted for an app name. The name needs to be unique. Example, enter your name+app (example: davidapp). Click Deploy app. You will be prompted for the following environment variables:
Note, you can manage the environment variables from the Heroku dashboard project Settings, by clicking Reveal Config Vars.
Chat Client Application screen print:
index.html : Chat client HTML
custom/chat.css : Chat client styles, CSS
generateToken.php : PHP program to generate Chat access tokens
twilio-php-master : Twilio PHP helper library file directory
Following are the steps to run the Chat Web Application on your localhost computer.
Download this repository's zip into a working directory and unzip it. Create an environment variable that is your Twilio Function Runtime Domain. Example:
$ export ACCOUNT_SID ACxxx...xxx $ export CHAT_SERVICE_SID ISxxx...xxx $ export CHAT_API_KEY SKxxx...xxx $ export CHAT_API_KEY_SECRET xxx...xxx
Run the Node.JS server program, install the required packages, then run the chat server or command line program.
$ npm install twilio $ npm install twilio-chat $ npm install express $ node webserver.js
Use your browser to run the chat client: http://localhost:8000 Enter a username, example: stacy. Enter a Channel name and description, example: "mychannel" and "My test channel". In another browser tab, run another chat client using a , same channel name: http://localhost:8000 Enter a username, example: david (different username). Enter a Channel name, example: mychannel (same as the other client). Send messages between your clients.