Skip to content

Work-in-progress quick start sample app for IP Messaging

License

Notifications You must be signed in to change notification settings

dotunodumosu/ipm-quickstart-node

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IP Messaging Quickstart for Node.js

This application should give you a ready-made starting point for writing your own messaging apps with Twilio IP Messaging. Before we begin, we need to collect all the credentials we need to run the application:

Credential Description
Twilio Account SID Your main Twilio account identifier - find it on your dashboard.
IP Messaging Service SID Like a database ID for all your messaging app's data. Info on how to create one below.
API Key Used to authenticate - generate one here.
API Secret Used to authenticate - just like the above, you'll get one here.

A Note on API Keys

When you generate an API key pair at the URLs above, your API Secret will only be shown once - make sure to save this in a secure location, or possibly your ~/.bash_profile.

Creating a Service SID

A service instance provides a shared scope for all the messages, users, and data in our IP Messaging application. It's like a new database for all your app's data.

To create one, we can use the REST API - execute the following curl command in your terminal to create a service instance, whose SID you can use in your application. Replace YourAppName with an identifier you would like to use, and {api key} and {api secret} with the values you got from the step above.

curl -XPOST https://ip-messaging.twilio.com/v1/Services \
    -d "FriendlyName=YourAppName" \
    -u '{api key}:{api secret}'

Your new service SID will be prefixed with an IS in the JSON data you get back.

Setting Up The Node.js Application

Create a configuration file for your application:

cp .env.example .env

Edit .env with the four configuration parameters we gathered from above.

Next, we need to install our depenedencies from npm:

npm install

Now we should be all set! Run the application using the node command.

node .

Your application should now be running at http://localhost:3000. Open this page in a couple browsers or tabs, and start chatting!

screenshot of chat app

License

MIT

About

Work-in-progress quick start sample app for IP Messaging

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 76.4%
  • CSS 13.3%
  • HTML 10.3%