Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/darrenhaken/twilio-conversation
Created with CodeSandbox
https://github.com/darrenhaken/twilio-conversation
Last synced: about 2 months ago
JSON representation
Created with CodeSandbox
- Host: GitHub
- URL: https://github.com/darrenhaken/twilio-conversation
- Owner: darrenhaken
- Created: 2022-04-02T10:16:20.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-04-28T15:10:02.000Z (over 2 years ago)
- Last Synced: 2024-10-15T11:39:02.906Z (3 months ago)
- Language: JavaScript
- Homepage: https://codesandbox.io/s/github/darrenhaken/twilio-conversation
- Size: 119 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# The Demo Conversations App
This is a lightweight application based on [Twilio Conversations](https://www.twilio.com/docs/conversations).
Please follow the directions for the [Twilio Conversations Quickstart](https://www.twilio.com/docs/conversations/quickstart) for a complete demo of this application with both SMS and chat participants.
# Configuring and getting started
This demo requires a Twilio account and a working Conversations Service SID.
You'll need to collect some credentials from the [Twilio Console](https://www.twilio.com/console):
* Your Account SID (`ACXXX`) and Auth Token, both accessible from the [Dashboard](https://twilio.com/console/dashboard)
* Your Account's Conversations Service Sid `ISXXX` SID which is attached to your Conversations Service# Testing
The demo application can be configured and run in two ways:
* Forking [the demo-conversations-application on CodeSandbox.io](https://codesandbox.io/s/github/TwilioDevEd/conversations-demo) (recommended)
* Cloning this repo and running locally
* Remember to copy the `.env.example` file to `.env` and replace the variables values with
the ones from your account. By default `NODE_ENV` is set to `production`.
# Replacing the Access Token
The Conversations API uses an Access Token with a Chat Grant for client-side applications such as this one to authenticate themselves with Conversations Services in your Twilio Account.
In order for your Conversations Application to work, we need to authenticate a Conversations user by retrieving a short-lived token attached to your API Key. The `getToken` function in `ConversationsApp.js` has a placeholder for your chat token.
You can generate a token in a few ways:
* Using the [twilio-cli](https://www.twilio.com/docs/twilio-cli/quickstart) and [twilio token plugin](https://github.com/twilio-labs/plugin-token) (Recommended)
* Using [Twilio Runtime Function](https://www.twilio.com/docs/runtime/functions)For the twilio-cli option, run the following command and enter the resulting token into the placeholder:
`twilio token:chat --identity --chat-service-sid `After generating a token manually, it will expire after a timeout period, so you will need to replace the token. To use this in production software, you would typically create a token endpoint in your back end application that uses your existing user authentication strategy.