Giter VIP home page Giter VIP logo

stitch-demo's Introduction

Nexmo Stitch Demo

An API server and client app to demo how to use Nexmo Stitch applications. For more info visit our developer site.

remix button

Prerequisites

Install the Nexmo CLI

  • Ensure you have Node.JS installed
  • Create a free Nexmo account - signup
  • Install the Nexmo CLI:
$ npm install -g nexmo-cli@beta

Setup the CLI to use your Nexmo API Key and API Secret. You can get these from the setting page in the Nexmo Dashboard.

$ nexmo setup api_key api_secret

Create an Application

Create an application named My Conversation Application and store the returned private key as private.key within your current working directory.

$ nexmo app:create "My Stitch Application" http://example.com http://example.com --type=rtc --keyfile=private.key

Running the demo

  1. Clone or download this repo
  2. Create a .env file using the example.env template (The file name has to be .env, it is not just the filename extension)
  3. Input your API Key, API Secret, and application ID
  4. Ensure the private.key file from the "Create an Application" is in your current working directory (See private.key.example)
  5. Install the node modules $ npm install
  6. Start the app: $ npm start
  7. The app should be running on localhost:3000

Start chatting!

  1. Create a user or two
curl --request POST \
  --url http://localhost:3000/api/users \
  --header 'content-type: application/json' \
  --data '{
	"username": "user2",
	"admin": true
}'
  1. Create a conversation via the demo API
curl --request POST \
  --url http://localhost:3000/api/conversations \
  --header 'content-type: application/json' \
  --data '{"displayName": "My Chat"}'
  1. Join the user to the conversation. Remember to replace the conversationId and userId with IDs from the two previous steps.
curl --request PUT \
  --url http://localhost:3000/api/conversations \
  --header 'content-type: application/json' \
  --data '{
	"conversationId": "CON-7cda3a42-8f7f-44c6-a4ba-aa23be506397",
	"userId": "USR-ca160eee-836a-4ec7-8ac4-317aefe8d5d3",
	"action": "join"
}'
  1. Verify the app is running by visiting localhost:3000/ and login with the username you created in step 1.

What's Next

Use the Android Messaging Demo app to try out Nexmo Stitch across web and Android platforms.

stitch-demo's People

Contributors

alexlakatos avatar angular-cli avatar chrisguzman avatar shams-ahmed avatar varpie avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.