Search
Search for Messages
Returns Message objects which match a given search query. This endpoint responds to a list of channel IDs which can either given specifically or performed on all PM or Broadcast channels that the user is subscribed to. Searches can either be ordered by id
or score
. Searches ordered by id
require at least one query or filter to be specified; searches ordered by score
require at least one query and zero or more filters to be specified. All parameters should be passed in the query string.
All queries and filters are combined with an AND operation. Query parameters (not filter parameters) can use “quoted strings” for phrases, search syntax like +foo -bar and foo OR baz for boolean queries. Separate lists of terms by spaces.
This endpoint responds to general Message parameters.
Endpoint
Method |
URL |
Token |
GET |
https://alpha-api.app.net/stream/0/channels/messages/search |
Any |
General Parameters
Name |
Required? |
Type |
Description |
index |
Optional |
string |
Type of index to use. The default (and currently, the only) index is complete , which searches all messages. We may add additional index types later (e.g., an index only of recent messages, for speed.)
|
order |
Optional |
string |
One of: id (default), score . Searches of ordering id are returned in roughly the same order as other streams. Searches of ordering score are returned by a relevance score. |
Search Query Parameters
Name |
Required? |
Type |
Description |
query |
Optional |
string |
Automatically attempts to extract hashtags and mentions while searching text. If you do not want this behavior, you can use more specific parameters below. |
text |
Optional |
string |
Include messages containing certain text. |
channel_ids |
Required |
string |
Specifies the list of channels to search through. This must either be a list of IDs or one of `pm`, `broadcast`. Channel ACLs will be respected (read permission must be granted to the user). |
Filter Parameters
Name |
Required? |
Type |
Description |
hashtags |
Optional |
string |
Only include messages tagged with certain hashtags. Do not include # |
links |
Optional |
string |
Only include messages linking to certain URLs |
link_domains |
Optional |
string |
Only include messages linking to certain domains. Do not include "www." |
mentions |
Optional |
string |
Only include messages mentioning certain users, by username. Do not include @ |
leading_mentions |
Optional |
string |
Only include messages directed at users, by username. Do not include @ |
annotation_types |
Optional |
string |
Only include messages with a specific annotation type, e.g., net.app.core.fallback_url
|
attachment_types |
Optional |
string |
Only include messages with a specific file type attached via the net.app.core.file_list annotation |
place_id |
Optional |
string |
Only include messages which are check-ins at a specific place, via the net.app.core.checkin annotation |
is_reply |
Optional |
int (0 or 1) |
Only include replies |
is_directed |
Optional |
int (0 or 1) |
Only include messages with leading mentions, i.e., messages which were directed at other users |
has_location |
Optional |
int (0 or 1) |
Only include messages containing geo coordinates, i.e., tagged with the net.app.core.geolocation annotation |
has_checkin |
Optional |
int (0 or 1) |
Only include messages containing place IDs, i.e., tagged with the net.app.core.checkin annotation |
has_attachment |
Optional |
int (0 or 1) |
Only include messages with file attachments |
has_oembed_photo |
Optional |
int (0 or 1) |
Only include messages with photo oembed annotations |
has_oembed_video |
Optional |
int (0 or 1) |
Only include messages with video (not html5video) oembed annotations |
has_oembed_html5video |
Optional |
int (0 or 1) |
Only include messages with html5video oembed annotations |
has_oembed_rich |
Optional |
int (0 or 1) |
Only include messages with rich oembed annotations |
language |
Optional |
string |
Only include messages with a certain language tagged with the net.app.core.language annotation. |
client_id |
Optional |
string |
Only include messages created by a certain app. Use the alphanumeric client_id |
creator_id |
Optional |
string |
Only include messages created by a specific user. Use the user ID, not the username |
reply_to |
Optional |
string |
Only include immediate replies to a given message ID |
thread_id |
Optional |
string |
Only include messages on a specific thread |
Example
to see more complete examples.
curl -H "Authorization: Bearer <YOUR ACCESS TOKEN>" -H "X-ADN-Pretty-JSON: 1" \
"https://alpha-api.app.net/stream/0/channels/messages/search?query=hello&channel_ids=1&count=1"
{
"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,
"count": 1,
"min_id": "1",
"max_id": "1"
}
}