Create a Message in the specified Channel.
Send a JSON document that matches the Message schema with an HTTP header of Content-Type: application/json
. Currently, the only keys we use from your JSON will be text
, reply_to
, annotations
, entities
, and machine_only
.
If you would like to specify your own entities, please refer to the user specified entites documentation, otherwise we will parse out links, hashtags, and mentions from the text
field.
If you want to test how your text will be processed you can use the text processor.
To create private group messages for use in net.app.core.pm
channels, you can specify the special channel_id
of pm
. With this parameter, the server will look for an extra field in the provided message object called destinations
which is a list of user ids to send this message to. If a private message channel already exists between this group of users, its channel_id
will be reused. Otherwise, a new channel will be created and the users specified in the destinations
list will be auto-subscribed (according to their subscription preferences) and able to write to that channel. Note that the destinations
value may include user ids in the form of “@username” or integer id.
This endpoint responds to general Message parameters.
Method | URL | Token |
---|---|---|
POST | https://alpha-api.app.net/stream/0/channels/{channel_id}/messages | User |
Name | Description |
---|---|
channel_id |
The id of the Channel in which to create the Message. Alternatively, you can specify pm to auto-create/reuse a net.app.core.pm private message channel. |
curl -X POST -H "Authorization: Bearer <YOUR ACCESS TOKEN>" -H "X-ADN-Pretty-JSON: 1" \
-H "Content-Type: application/json" -d "{
\"text\": \"Hello channel!\"
}" \
"https://alpha-api.app.net/stream/0/channels/1/messages"
{
"data": {
"channel_id": "1",
"created_at": "2012-12-11T00:31:49Z",
"entities": {
"hashtags": [
],
"links": [
],
"mentions": [
]
},
"html": "<span itemscope=\"https://app.net/schemas/Post\">Hello channel!</span>",
"id": "1",
"machine_only": false,
"num_replies": 0,
"source": {
"client_id": "UxUWrSdVLyCaShN62xZR5tknGvAxK93P",
"link": "https://app.net",
"name": "Test app"
},
"text": "Hello channel!",
"thread_id": "1",
"user": "...user object..."
},
"meta": {
"code": 200
}
}
curl -X POST -H "Authorization: Bearer <YOUR ACCESS TOKEN>" -H "X-ADN-Pretty-JSON: 1" \
-H "Content-Type: application/json" -d "{
\"text\": \"Hello channel!\",
\"destinations\": [
\"@berg\",
1
]
}" \
"https://alpha-api.app.net/stream/0/channels/pm/messages"
{
"data": {
"channel_id": "2",
"created_at": "2012-12-11T00:31:49Z",
"entities": {
"hashtags": [
],
"links": [
],
"mentions": [
]
},
"html": "<span itemscope=\"https://app.net/schemas/Post\">Hello channel!</span>",
"id": "105",
"machine_only": false,
"num_replies": 0,
"source": {
"client_id": "UxUWrSdVLyCaShN62xZR5tknGvAxK93P",
"link": "https://app.net",
"name": "Test app"
},
"text": "Hello channel!",
"thread_id": "105",
"user": "...user object..."
},
"meta": {
"code": 200
}
}
Delete a message. The current user must be the same user who created the Message. It returns the deleted Message on success.
You can always delete a message you created even if you are no longer able to view the rest of the Channel anymore.
Remember, access tokens can not be passed in a HTTP body for DELETE
requests. Please refer to the authentication documentation.
This endpoint responds to general Message parameters.
Method | URL | Token | Scope |
---|---|---|---|
DELETE | https://alpha-api.app.net/stream/0/channels/{channel_id}/messages/{message_id} | User |
public_messages or messages
|
Name | Description |
---|---|
channel_id |
The id of the Channel this Message belongs to. |
message_id |
The id of the Message to delete. |
curl -X DELETE -H "Authorization: Bearer <YOUR ACCESS TOKEN>" -H "X-ADN-Pretty-JSON: 1" \
"https://alpha-api.app.net/stream/0/channels/1/messages/1"
{
"data": {
"channel_id": "1",
"created_at": "2012-12-11T00:31:49Z",
"entities": {
"hashtags": [
],
"links": [
],
"mentions": [
]
},
"id": "1",
"machine_only": false,
"num_replies": 0,
"source": {
"client_id": "UxUWrSdVLyCaShN62xZR5tknGvAxK93P",
"link": "https://app.net",
"name": "Test app"
},
"thread_id": "1",
"user": "...user object...",
"is_deleted": true
},
"meta": {
"code": 200
}
}
Retrieve a stream of the Messages in a channel.
This endpoint responds to general Message parameters.
Responses from this endpoint are paginated.
Method | URL | Token | Scope |
---|---|---|---|
GET | https://alpha-api.app.net/stream/0/channels/{channel_id}/messages | User |
public_messages or messages
|
Name | Description |
---|---|
channel_id |
The id of the Channel to retrieve Messages from. |
curl -H "Authorization: Bearer <YOUR ACCESS TOKEN>" -H "X-ADN-Pretty-JSON: 1" \
"https://alpha-api.app.net/stream/0/channels/1/messages"
{
"data": [
{
"channel_id": "1",
"created_at": "2012-12-11T00:31:49Z",
"entities": {
"hashtags": [
],
"links": [
],
"mentions": [
]
},
"html": "<span itemscope=\"https://app.net/schemas/Post\">Hello channel!</span>",
"id": "1",
"machine_only": false,
"num_replies": 0,
"source": {
"client_id": "UxUWrSdVLyCaShN62xZR5tknGvAxK93P",
"link": "https://app.net",
"name": "Test app"
},
"text": "Hello channel!",
"thread_id": "1",
"user": "...user object...",
"pagination_id": "1"
}
],
"meta": {
"code": 200,
"more": false,
"marker": {
"name": "channel:1"
},
"min_id": "1",
"max_id": "1"
}
}