- Production:
http://ec2-13-200-15-25.ap-south-1.compute.amazonaws.com - Localhost:
http://localhost:3000
Endpoint:
POST /api/chatRequest Body:
{
"character": "MARK",
"userMessage": "You're going to introduce me, right?",
"movieName": "The Social Network"
}Response:
{
"success": true,
"message": "Chat generated successfully",
"result": {
"response": "Yeah, I mean, I want to be clear that I think it's important for you to meet these people. It’ll open up so many doors. So, yeah, I’ll introduce you. Just trust me on this."
}
}Endpoint:
GET /api/chat/:userIdRequest Example:
GET {{base_url}}/api/chat/1Response:
{
"success": true,
"message": "Chats retrieved successfully",
"result": {
"chats": [
{
"movieName": "The Social Network",
"characterName": "MARK",
"messages": [
{
"sender": "user",
"message": "what should we do?",
"_id": "67b1955a6dec03fe9dca707d",
"timestamp": "2025-02-16T07:35:54.543Z"
},
{
"sender": "ai",
"message": "I mean, what do you want to do? Right now. Think about it. I mean, what's the plan? Why not just settle on something?",
"_id": "67b1955c6dec03fe9dca707f",
"timestamp": "2025-02-16T07:35:56.371Z"
}
],
"_id": "67b194e36dec03fe9dca705a"
}
]
}
}Notes:
- Retrieves all past chat conversations for a given
userId. - Each conversation contains messages exchanged between the user and AI.
- WebSocket URL:
http://ec2-13-200-15-25.ap-south-1.compute.amazonaws.com/
| Event Name | Direction | Description |
|---|---|---|
userMessage |
Client → Server | Send a chat message |
chatResponse |
Server → Client | Receive chatbot response |
Event: userMessage
Request Format:
{
"userId": 1,
"character": "MARK",
"userMessage": "You're going to introduce me, right?",
"movieName": "The Social Network"
}Event: chatResponse
Response Format:
{
"message": "Well, of course! I've always got your back, buddy. Just let me take the lead, and we’ll make a grand entrance. You ready? Let’s do this!"
}- Open Postman and select New WebSocket Request.
- Enter the WebSocket URL:
http://ec2-13-200-15-25.ap-south-1.compute.amazonaws.com/ - Click Connect.
- In the Messages section, send a message in the following format:
{ "userId": 1, "character": "MARK", "userMessage": "You're going to introduce me, right?", "movieName": "The Social Network" } - Press Send.
- Wait for a response on the
chatResponseevent.