Conversations
The Conversations API has methods for creating, and managing converations.
Create chat
POST /api/conversations
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.
Sample request
$ curl {WEAVY_SERVER}/api/conversations
-H "Authorization: Bearer {ACCESS_TOKEN}"
-H "Content-Type: application/json"
-d "{ 'name': 'My chat room', 'members': [1, 4, 14] }"
$ curl {WEAVY_SERVER}/api/conversations
-H "Authorization: Bearer {ACCESS_TOKEN}"
-H "Content-Type: application/json"
-d "{ 'name': 'My private chat', 'members': [ 4 ] }"
Request body
application/json
{
"name?": "string",
"members": [
"integer"
]
}
Note. Properties marked with ? are optional.
Responses
Status code 201
application/json
{
"id": "integer",
"type": "string",
"uid": "string",
"display_name": "string",
"name": "string",
"description": "string",
"archive_url": "string",
"avatar_url": "string",
"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"
}
Status code 400
application/json
{
"type": "string",
"title": "string",
"status": "integer",
"detail": "string",
"instance": "string"
}
List conversations
GET /api/conversations
List the conversations for the authenticated user.
Sample request
$ curl {WEAVY_SERVER}/api/conversations?top=20
-H "Authorization: Bearer {ACCESS_TOKEN}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
unread | boolean | False | |
contextual | boolean | False | |
type | string | False | |
q | string | False | |
tag | string | False | |
trashed | boolean | False | |
order_by | string | False | |
top | integer | False | |
skip | integer | False | |
count | boolean | False | |
count_only | boolean | False |
Responses
Status code 200
application/json
{
"data": [
"object"
],
"start": "integer",
"end": "integer",
"count": "integer"
}
Get conversation
GET /api/conversations/{id}
Get a conversation.
Sample request
$ curl {WEAVY_SERVER}/api/conversations/1
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True | |
trashed | boolean | False |
Responses
Status code 200
application/json
{
"id": "integer",
"type": "string",
"uid": "string",
"display_name": "string",
"name": "string",
"description": "string",
"archive_url": "string",
"avatar_url": "string",
"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"
}
Get unread conversations
GET /api/conversations/badge
Get number of unread conversations for the authenticated user (grouped by conversation type).
Sample request
$ curl {WEAVY_SERVER}/api/conversations/badge
-H "Authorization: Bearer {ACCESS_TOKEN}"
Responses
Status code 200
application/json
{
"private": "integer",
"rooms": "integer",
"chat": "integer"
}
Mark as read
PUT /api/conversations/{id}/mark
Mark a conversation as read.
Sample request
$ curl -X PUT {WEAVY_SERVER}/api/conversations/1/mark
-H "Authorization: Bearer {ACCESS_TOKEN}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True | |
message_id | integer | False | Id of last read message. |
Responses
Status code 200
application/json
{
"id": "integer",
"type": "string",
"uid": "string",
"display_name": "string",
"name": "string",
"description": "string",
"archive_url": "string",
"avatar_url": "string",
"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"
}
Status code 404
application/json
{
"type": "string",
"title": "string",
"status": "integer",
"detail": "string",
"instance": "string"
}
Mark as unread
DELETE /api/conversations/{id}/mark
Mark a conversation as unread.
Sample request
$ curl -X DELETE {WEAVY_SERVER}/api/conversations/1/mark
-H "Authorization: Bearer {ACCESS_TOKEN}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True |
Responses
Status code 200
application/json
{
"id": "integer",
"type": "string",
"uid": "string",
"display_name": "string",
"name": "string",
"description": "string",
"archive_url": "string",
"avatar_url": "string",
"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"
}
Status code 404
application/json
{
"type": "string",
"title": "string",
"status": "integer",
"detail": "string",
"instance": "string"
}
Pin conversation
PUT /api/conversations/{id}/pin
Pin a conversation.
Sample request
$ curl -X PUT {WEAVY_SERVER}/api/conversations/1/pin
-H "Authorization: Bearer {ACCESS_TOKEN}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True |
Responses
Status code 200
application/json
{
"id": "integer",
"type": "string",
"uid": "string",
"display_name": "string",
"name": "string",
"description": "string",
"archive_url": "string",
"avatar_url": "string",
"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"
}
Status code 404
application/json
{
"type": "string",
"title": "string",
"status": "integer",
"detail": "string",
"instance": "string"
}
Unpin conversation
DELETE /api/conversations/{id}/pin
Unpin a conversation.
Sample request
$ curl -X DELETE {WEAVY_SERVER}/api/conversations/1/mark
-H "Authorization: Bearer {ACCESS_TOKEN}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True |
Responses
Status code 200
application/json
{
"id": "integer",
"type": "string",
"uid": "string",
"display_name": "string",
"name": "string",
"description": "string",
"archive_url": "string",
"avatar_url": "string",
"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"
}
Status code 404
application/json
{
"type": "string",
"title": "string",
"status": "integer",
"detail": "string",
"instance": "string"
}