Chat Flat API

GET /conversations

List all conversations.

curl https://chatflat.smooch.rocks/conversations

Response

[
    {
        _id: "NJLXkmu",
        createdAt: "2015-03-22T21:11:33.915Z",
        messages: []
    }
]

POST /conversations

Create a new conversation. Accepts an empty body. Returns 201 upon success.

curl -X POST https://chatflat.smooch.rocks/conversations

Response

{
    _id: "NJLXkmu",
    createdAt: "2015-03-22T21:11:33.915Z",
    messages: []
}

GET /conversations/:id

Get a conversation.

curl https://chatflat.smooch.rocks/conversations/NJLXkmu

Response

{
    _id: "NJLXkmu",
    createdAt: "2015-03-22T21:11:33.915Z",
    messages: []
}

GET /conversations/:id/messages

List messages in a conversation.

curl https://chatflat.smooch.rocks/conversations/NJLXkmu/messages

Response

[
    {
        _id: "VJczemO",
        createdAt: "2015-03-22T21:15:37.325Z",
        name: "Andrew",
        text: "Hi there",
    }
]

POST /conversations/:id/messages

Post a message. Returns 201 upon success.

curl -X POST -H "Content-Type: application/json" \
    -d '{"name": "Andrew", "text": "Hi there"}' \
    https://chatflat.smooch.rocks/conversations/4yYVu3j/messages

Response

{
    _id: "VJczemO",
    createdAt: "2015-03-22T21:15:37.325Z",
    name: "Andrew",
    text: "Hi there",
}

GET /conversations/reset

Reset conversation state. Deletes all conversations and creates a new empty conversation.