Conversations
The Conversations API has methods for creating, and managing conversations.
Create chat
Create a chat room or private chat. If member count is more than one, a chat room is created. If name is omitted, the name of the chat will be the participant(s) names.
POST /api/conversations
Body parameters
name
stringName of room to create, or
null
to auto-generate a name based on room members.
members
array of integers requiredThe members of the conversation.
Response codes
201 Created
{
"id": "integer",
"type": "string",
"uid": "string",
"display_name": "string",
"name": "string",
"description": "string",
"archive_url": "string",
"avatar_url": "string",
"metadata": "object",
"tags": [
"string"
],
"created_at": "string",
"created_by_id": "integer",
"modified_at": "string",
"modified_by_id": "integer",
"member_count": "integer",
"members": [
"object"
],
"user_id": "integer",
"last_message_id": "integer",
"is_pinned": "boolean",
"is_unread": "boolean",
"is_starred": "boolean",
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
400 Bad Request
Code sample
curl https://{WEAVY-SERVER}/api/conversations
-H "Authorization: Bearer {ACCESS-TOKEN}"
-H "Content-Type: application/json"
-d "{ 'name': 'My chat room', 'members': [1, 4, 14] }"
curl https://{WEAVY-SERVER}/api/conversations
-H "Authorization: Bearer {ACCESS-TOKEN}"
-H "Content-Type: application/json"
-d "{ 'name': 'My private chat', 'members': [ 4 ] }"
List conversations
List the conversations for the authenticated user.
GET /api/conversations
Query parameters
unread
booleantrue
lists unread conversations,false
list read conversations andnull
lists all conversations; default isnull
.
contextual
booleantrue
to lists contextual apps,false
to list non-contextual apps; when not specified both types are listed.
type
stringGuid of app type to list.
q
stringA query used to find matching items.
tag
stringList items with the specified tag.
trashed
booleanIndicates whether trashed items should be listed (default is
false
). Specifynull
to return both trashed and non-trashed items.
order_by
stringSpecifies the sort order and direction for the listing, e.g. "
name
" or "name+desc
"
top
integerMaximum number of items to return in the listing. Should be a value between
0
and100
. Default is25
.
skip
integerThe number of items to skip. Used together with
top
to return a specific range of items (for pagination).
count
booleanfalse
to skip counting the total number of matching items; default istrue
.
count_only
booleantrue
to only return the number of matching items; when this is specified the response will only contain thecount
property.
Response codes
200 Success
{
"data": [
"object"
],
"start": "integer",
"end": "integer",
"count": "integer"
}
Code sample
curl https://{WEAVY-SERVER}/api/conversations?top=20
-H "Authorization: Bearer {ACCESS-TOKEN}"
Get conversation
Get a conversation.
GET /api/conversations/{id}
Path parameters
id
integer requiredConversation (app) id.
Query parameters
trashed
booleantrue
to return conversation even if trashed, otherwisefalse
.
Response codes
200 Success
{
"id": "integer",
"type": "string",
"uid": "string",
"display_name": "string",
"name": "string",
"description": "string",
"archive_url": "string",
"avatar_url": "string",
"metadata": "object",
"tags": [
"string"
],
"created_at": "string",
"created_by_id": "integer",
"modified_at": "string",
"modified_by_id": "integer",
"member_count": "integer",
"members": [
"object"
],
"user_id": "integer",
"last_message_id": "integer",
"is_pinned": "boolean",
"is_unread": "boolean",
"is_starred": "boolean",
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
Code sample
curl https://{WEAVY-SERVER}/api/conversations/1
-H "Authorization: Bearer {ACCESS-TOKEN | API-KEY}"
Count unread conversations
Get number of unread conversations for the authenticated user (grouped by conversation type).
GET /api/conversations/badge
Response codes
200 Success
{
"private": "integer",
"rooms": "integer",
"chat": "integer"
}
Code sample
curl https://{WEAVY-SERVER}/api/conversations/badge
-H "Authorization: Bearer {ACCESS-TOKEN}"
Mark as read
Updates the conversation read marker for the authenticated user.
PUT /api/conversations/{id}/mark
Path parameters
id
integer requiredConversation (app) id.
Query parameters
message_id
integerId of last read message.
Response codes
200 Success
{
"id": "integer",
"type": "string",
"uid": "string",
"display_name": "string",
"name": "string",
"description": "string",
"archive_url": "string",
"avatar_url": "string",
"metadata": "object",
"tags": [
"string"
],
"created_at": "string",
"created_by_id": "integer",
"modified_at": "string",
"modified_by_id": "integer",
"member_count": "integer",
"members": [
"object"
],
"user_id": "integer",
"last_message_id": "integer",
"is_pinned": "boolean",
"is_unread": "boolean",
"is_starred": "boolean",
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
404 Not Found
Code sample
$ curl -X PUT {WEAVY_SERVER}/api/conversations/1/mark
-H "Authorization: Bearer {ACCESS-TOKEN}"
Mark as unread
Mark a conversation as unread, i.e remove the conversation read marker.
DELETE /api/conversations/{id}/mark
Path parameters
id
integer requiredConversation (app) id.
Response codes
200 Success
{
"id": "integer",
"type": "string",
"uid": "string",
"display_name": "string",
"name": "string",
"description": "string",
"archive_url": "string",
"avatar_url": "string",
"metadata": "object",
"tags": [
"string"
],
"created_at": "string",
"created_by_id": "integer",
"modified_at": "string",
"modified_by_id": "integer",
"member_count": "integer",
"members": [
"object"
],
"user_id": "integer",
"last_message_id": "integer",
"is_pinned": "boolean",
"is_unread": "boolean",
"is_starred": "boolean",
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
404 Not Found
Code sample
$ curl -X DELETE {WEAVY_SERVER}/api/conversations/1/mark
-H "Authorization: Bearer {ACCESS-TOKEN}"
Pin conversation
Pin a conversation.
PUT /api/conversations/{id}/pin
Path parameters
id
integer requiredConversation (app) id.
Response codes
200 Success
{
"id": "integer",
"type": "string",
"uid": "string",
"display_name": "string",
"name": "string",
"description": "string",
"archive_url": "string",
"avatar_url": "string",
"metadata": "object",
"tags": [
"string"
],
"created_at": "string",
"created_by_id": "integer",
"modified_at": "string",
"modified_by_id": "integer",
"member_count": "integer",
"members": [
"object"
],
"user_id": "integer",
"last_message_id": "integer",
"is_pinned": "boolean",
"is_unread": "boolean",
"is_starred": "boolean",
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
404 Not Found
Code sample
$ curl -X PUT {WEAVY_SERVER}/api/conversations/1/pin
-H "Authorization: Bearer {ACCESS-TOKEN}"
Unpin conversation
Unpin a conversation.
DELETE /api/conversations/{id}/pin
Path parameters
id
integer requiredConversation (app) id.
Response codes
200 Success
{
"id": "integer",
"type": "string",
"uid": "string",
"display_name": "string",
"name": "string",
"description": "string",
"archive_url": "string",
"avatar_url": "string",
"metadata": "object",
"tags": [
"string"
],
"created_at": "string",
"created_by_id": "integer",
"modified_at": "string",
"modified_by_id": "integer",
"member_count": "integer",
"members": [
"object"
],
"user_id": "integer",
"last_message_id": "integer",
"is_pinned": "boolean",
"is_unread": "boolean",
"is_starred": "boolean",
"is_subscribed": "boolean",
"is_trashed": "boolean"
}
404 Not Found
Code sample
$ curl -X DELETE {WEAVY_SERVER}/api/conversations/1/mark
-H "Authorization: Bearer {ACCESS-TOKEN}"