Skip to content

quytechabhinav/chatusingtwilio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

chatusingtwilio

Twilio One-to-One Chat with React and Node.js 🚀

Overview

This project is a one-to-one chat application built using React, Node.js, and Twilio Conversations API. It enables real-time messaging, image/document sharing, and conversation management.

Features ✅

  • 🔹 One-to-One Private Chat
  • 📩 Real-time messaging
  • 📸 Send images & documents
  • 🔄 Auto-scroll to latest messages
  • End conversation with a Stop button
  • 📌 Check if a chat exists before creating a new one
  • 🏷 SEO Optimized for better search ranking

Setup Instructions ⚙️

1️⃣ Clone the Repository

git clone https://github.com/your-repo/twilio-chat-app.git
cd twilio-chat-app

2️⃣ Install Dependencies

For Backend (Node.js)

cd server
npm install

For Frontend (React.js)

cd client
npm install

3️⃣ Configure Twilio API Keys

Create a .env file in the server directory and add:

TWILIO_ACCOUNT_SID=your_account_sid
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_SERVICE_SID=your_service_sid
API_KEY=your_api_key
API_SECRET=your_api_secret

4️⃣ Start the Backend Server

cd server
node index.js

5️⃣ Start the React Frontend

cd client
npm start

Check Twilio Credentials 🛠️

Before running the app, ensure that your Twilio API credentials are correct by running this command:

curl -X GET https://conversations.twilio.com/v1/Services \
     -u "SK**********:secret********"

Replace SK********** and secret******** with your actual Twilio API Key and Secret.

If your credentials are correct, Twilio will return a list of available services.


How One-to-One Chat Works?

  1. User1 chats with User2 → A unique Twilio Conversation SID is created for them.
  2. User3 chats with User4 → A different SID is generated.
  3. If a chat already exists, the existing SID is reused.
  4. Users can send/receive messages, images, and documents.
  5. Clicking 'Stop' removes the conversation, allowing a fresh chat next time.

Stop & Remove Conversation 🛑

To end a chat and delete the conversation, click the Stop button, or run:

curl -X DELETE https://conversations.twilio.com/v1/Conversations/CHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \
     -u "SK**********:secret********"

Replace CHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx with your Conversation SID.


SEO Keywords for Search Engine Optimization (SEO) 🏆

#Twilio Chat App

#React Twilio Chat

#NodeJS Chat App

#Twilio One-to-One Chat

#Private Chat with Twilio

#Real-Time Chat App

#Chat with Images & Documents

Contribute 🏗️

Want to improve this project? Feel free to fork and submit a pull request. 🚀

License 📜

This project is open-source and licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published