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.
- 🔹 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
git clone https://github.com/your-repo/twilio-chat-app.git
cd twilio-chat-app
cd server
npm install
cd client
npm install
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
cd server
node index.js
cd client
npm start
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.
- User1 chats with User2 → A unique Twilio Conversation SID is created for them.
- User3 chats with User4 → A different SID is generated.
- If a chat already exists, the existing SID is reused.
- Users can send/receive messages, images, and documents.
- Clicking 'Stop' removes the conversation, allowing a fresh chat next time.
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.
Want to improve this project? Feel free to fork and submit a pull request. 🚀
This project is open-source and licensed under the MIT License.