Messages Lookup

Endpoints:

GET /channels/{channel_id}/messages/{message_id}

Scope: messages

Retrieve a message from a channel. The requesting user must have access to the channel or have created the message.

URL Parameters

Name Description
channel_id ID of the channel to retrieve a message from.
message_id ID of the message to retrieve.
Example
curl "https://api.pnut.io/v1/channels/5/messages/11" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H "X-Pretty-Json: 1"

Returns the requested message.

{
    "meta": {
        "code": 200
    },
    "data": {"...Message Object..."}
}

GET /channels/{channel_id}/messages/{message_id}/thread

Token: user

Scope: messages

Retrieve messages in the same thread of a channel. All messages will have the same thread_id (they are all replies to the same message, or is not a reply to any message). The requesting user must have access to the channel.

URL Parameters

Name Description
channel_id ID of the channel to retrieve messages from.
message_id ID of the message whose thread to retrieve.
Example
curl "https://api.pnut.io/v1/channels/5/messages/13/thread" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H "X-Pretty-Json: 1"

Returns a list of messages.

{
    "meta": {
        "more": false,
        "max_id": "0",
        "min_id": "0",
        "code": 200
    },
    "data": [
        {"...Message Object..."}
    ]
}

GET /channels/messages

Scope: messages

Retrieve a list of specified messages. Will only return the first 200 found.

Query String Parameters

Name Description
ids Comma-separated list of message IDs.
Example
curl "https://api.pnut.io/v1/channels/messages?ids=4,11,12" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H "X-Pretty-Json: 1"

Returns a list of the messages found.

{
    "meta": {
        "code": 200
    },
    "data": [
        {"...Message Object..."},
        {"...Message Object..."},
        {"...Message Object..."}
    ]
}

GET /channels/{channel_id}/messages

Scope: messages

Retrieve paginated messages from a channel.

URL Parameters

Name Description
channel_id ID of the channel to retrieve messages from
Example
curl "https://api.pnut.io/v1/channels/2/messages" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H "X-Pretty-Json: 1"

Returns a list of messages from the channel.

{
    "meta": {
        "more": false,
        "max_id": "0",
        "min_id": "0",
        "marker": {
            "name": "channel:0"
        },
        "code": 200
    },
    "data": [
        {"...Message Object..."}
    ]
}

GET /users/me/messages

Scope: messages

Retrieve a paginated list of messages created by the authenticated user.

Example
curl "https://api.pnut.io/v1/users/me/messages" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H "X-Pretty-Json: 1"

Returns a list of messages.

{
    "meta": {
        "more": true,
        "max_id": "0",
        "min_id": "0",
        "code": 200
    },
    "data": [
        {"...Message Object..."}
    ]
}