Message Lifecycle

Endpoints:

POST /channels/{channel_id}/messages

Token: user

Scope: messages

Create a message in a channel.

On creation, you can automatically update the stream marker to the most recent ID in the channel (marking the channel "read") by including update_marker=1 in the query string.

For details on how to use channels for private messaging, look at How To Private Message.

Can be application/json Content-Type.

URL Parameters

Name Description
channel_id ID of the channel to create a message in.
Example
curl "https://api.pnut.io/v0/channels/5/messages" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}"
    -d "text=This is a message!"
    -X POST \
    -H "X-Pretty-Json: 1"

Returns the message created.

"call for example 1"

DELETE /channels/{channel_id}/messages/{message_id}

Token: user

Scope: messages

Delete a message in a channel. Creators of messages can delete their messages even if they no longer have access to the channel.

Owners and full-access users may also delete others' messages in non-private message channels, which will also create a deleted_by field on those deleted messages.

URL Parameters

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

Returns the deleted message.

"call for example 2"