Coder Social home page Coder Social logo

demo-chat-backend's Introduction

The Demo Chat Application - Using Twilio Conversations

This is a lightweight application based on Twilio Chat and Twilio Conversations.

Getting started

This demo requires a Twilio account and a working Chat Service SID. By default these are provisioned automatically by the Conversations API (Default Conversations Service).

You'll need to collect some credentials from the Twilio Console:

  • Your Account SID (ACXXX) and Auth Token, both accessible from the Dashboard
  • Your Account's Chat Service Sid ISXXX SID which is attached to your Chat Service

All senders to be used with the app, MUST be added as Senders to the Conversations Messaging Service!

If you wish to include self-service or a bot prior to the conversation, modify Inbound Settings on the Conversations Messaging Service, When a new message arrives on a number assigned to this Service: SEND AN INCOMING_MESSAGE WEBHOOK. Associate the webhook with either AutoPilot Assistant or Studio Flow and setup a Function to move one or more participants into a New Conversation. Once added into a conversation all messages are routed by Conversations API into the Chat service.

Deploying the backend chat application (on Twilio)

  • Clone demo-chat-backend
  • copy .env.example to .env and set the following environment variables from your Twilio account:
# Twilio account master credentials
ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxx
AUTH_TOKEN=xxxxxxxxxxxxxxxxxxxx
# API key for your Twilio Account
API_KEY=SKxxxxxxxxxxxxxxxxxxxxx
# API secret for your API Key
API_SECRET=xxxxxxxxxxxxxxxxxxxxx
# SID of your Twilio Chat Service (https://www.twilio.com/docs/api/chat/rest/services)
CHAT_SERVICE_SID=ISxxxxxxxxxxxxxxxxx
# Comma seperated list of Twilio SMS capable phone numbers to use as proxies
SMS_SENDERS=<number>,<number>,<number>
# Comma seperated list of Twilio WhatsApp senders to use as proxies
WHATSAPP_SENDERS=whatsapp:<number>,whatsapp:<number>

Running the frontend application

In either case:

  • copy .env.example to .env and set the following environment variables from your Twilio account:
# set serverless-domain to your Twilio Runtime domain as reported by the API
REACT_APP_CHAT_BACKEND=https://<serverless-domain>.twil.io/

where <serverless-domain> is the runtime domain created during the deployment of the backend

To run locally (or install on your own cloud service): npm install npm run start

To deploy to Zeit, edit now.json with you chat backend URL and run: npm install -g now-cli (first time installation) now

Interacting with the Application

The application will be accessible on http://localhost:3000 or on https://demo-chat-app.<your-zeit-domain>.now.sh

It will start at a login screen. Any login ID can be used and no password is required. The login ID will be used as the Chat ID.

When starting a conversation your own Chat ID will be added automatically to the conversation, do not remove it otherwise it will not show in the list.

demo-chat-backend's People

Contributors

cwkendall avatar

Watchers

 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.