Messages

The Messages API supports managing chat messages.

Create message

POST /api/apps/{id}/messages

Creates a new message in the specified Conversation (Chat, ChatRoom or PrivateChat).

Sample request

$ curl {WEAVY_SERVER}/api/apps/1/messages
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"
-H "Content-Type: application/json"
-d "{ 'text': 'This is a message' }"

Parameters

Name Type Required Description
id integer True Conversation id

Request body

application/json

{
  "blobs?": [
    "integer"
  ],
  "embed_id?": "integer",
  "meeting_id?": "integer",
  "options?": [
    {
      "text": "string"
    }
  ],
  "text?": "string",
  "metadata?": {},
  "tags?": [
    "string"
  ]
}

Note. Properties marked with ? are optional.

Responses

Status code 200

application/json

{
  "id": "integer",
  "app_id": "integer",
  "text": "string",
  "html": "string",
  "plain": "string",
  "attachment_count": "integer",
  "attachments": [
    "object"
  ],
  "embed_id": "integer",
  "meeting_id": "integer",
  "option_count": "integer",
  "options": [
    "object"
  ],
  "reactions": [
    "object"
  ],
  "tags": [
    "string"
  ],
  "created_at": "string",
  "created_by_id": "integer",
  "modified_at": "string",
  "modified_by_id": "integer",
  "is_trashed": "boolean"
}

List messages

GET /api/apps/{id}/messages

List messages in the specified Conversation (Chat, ChatRoom or PrivateChat).

Sample request

$ curl {WEAVY_SERVER}/api/apps/1/messages?top=50
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"

Parameters

Name Type Required Description
id integer True Conversation id.
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 message

GET /api/messages/{id}

Gets a message by id.

Sample request

$ curl {WEAVY_SERVER}/api/messages/1
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"

Parameters

Name Type Required Description
id integer True Id of the message.
trashed boolean False

Responses

Status code 200

application/json

{
  "id": "integer",
  "app_id": "integer",
  "text": "string",
  "html": "string",
  "plain": "string",
  "attachment_count": "integer",
  "attachments": [
    "object"
  ],
  "embed_id": "integer",
  "meeting_id": "integer",
  "option_count": "integer",
  "options": [
    "object"
  ],
  "reactions": [
    "object"
  ],
  "tags": [
    "string"
  ],
  "created_at": "string",
  "created_by_id": "integer",
  "modified_at": "string",
  "modified_by_id": "integer",
  "is_trashed": "boolean"
}
Status code 404

application/json

{
  "type": "string",
  "title": "string",
  "status": "integer",
  "detail": "string",
  "instance": "string"
}

Update message

PATCH /api/messages/{id}

Updates a message.

Sample request

$ curl -X PATCH {WEAVY_SERVER}/api/messages/1
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"
-H "Content-Type: application/json"
-d "{ 'text': 'This is an updated message' }"

Parameters

Name Type Required Description
id integer True Id of the message.

Request body

application/json

{
  "attachments?": [
    "integer"
  ],
  "blobs?": [
    "integer"
  ],
  "embed_id?": "integer",
  "meeting_id?": "integer",
  "options?": [
    {
      "id?": "integer",
      "text": "string"
    }
  ],
  "text?": "string",
  "metadata?": {},
  "tags?": [
    "string"
  ]
}

Note. Properties marked with ? are optional.

Responses

Status code 200

application/json

{
  "id": "integer",
  "app_id": "integer",
  "text": "string",
  "html": "string",
  "plain": "string",
  "attachment_count": "integer",
  "attachments": [
    "object"
  ],
  "embed_id": "integer",
  "meeting_id": "integer",
  "option_count": "integer",
  "options": [
    "object"
  ],
  "reactions": [
    "object"
  ],
  "tags": [
    "string"
  ],
  "created_at": "string",
  "created_by_id": "integer",
  "modified_at": "string",
  "modified_by_id": "integer",
  "is_trashed": "boolean"
}
Status code 404

application/json

{
  "type": "string",
  "title": "string",
  "status": "integer",
  "detail": "string",
  "instance": "string"
}

Delete message

DELETE /api/messages/{id}

Delete a message.

Sample request

$ curl -X DELETE {WEAVY_SERVER}/api/messages/1
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"

Parameters

Name Type Required Description
id integer True Id of the message.

Responses

Status code 204

No Content


Trash message

POST /api/messages/{id}/trash

Move a message to the trash.

Sample request

$ curl -X POST {WEAVY_SERVER}/api/messages/1/trash
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"

Parameters

Name Type Required Description
id integer True Id of the message to trash.

Responses

Status code 200

application/json

{
  "id": "integer",
  "app_id": "integer",
  "text": "string",
  "html": "string",
  "plain": "string",
  "attachment_count": "integer",
  "attachments": [
    "object"
  ],
  "embed_id": "integer",
  "meeting_id": "integer",
  "option_count": "integer",
  "options": [
    "object"
  ],
  "reactions": [
    "object"
  ],
  "tags": [
    "string"
  ],
  "created_at": "string",
  "created_by_id": "integer",
  "modified_at": "string",
  "modified_by_id": "integer",
  "is_trashed": "boolean"
}
Status code 404

application/json

{
  "type": "string",
  "title": "string",
  "status": "integer",
  "detail": "string",
  "instance": "string"
}
Status code 400

application/json

{
  "type": "string",
  "title": "string",
  "status": "integer",
  "detail": "string",
  "instance": "string"
}

Restore message

POST /api/messages/{id}/restore

Restore a message from the trash.

Sample request

$ curl -X POST {WEAVY_SERVER}/api/messages/1/restore
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"

Parameters

Name Type Required Description
id integer True Id of the message to restore.

Responses

Status code 200

application/json

{
  "id": "integer",
  "app_id": "integer",
  "text": "string",
  "html": "string",
  "plain": "string",
  "attachment_count": "integer",
  "attachments": [
    "object"
  ],
  "embed_id": "integer",
  "meeting_id": "integer",
  "option_count": "integer",
  "options": [
    "object"
  ],
  "reactions": [
    "object"
  ],
  "tags": [
    "string"
  ],
  "created_at": "string",
  "created_by_id": "integer",
  "modified_at": "string",
  "modified_by_id": "integer",
  "is_trashed": "boolean"
}

Indicate typing message

PUT /api/apps/{id}/messages/typing

Indicate that the authenticated user is typing a message.

Sample request

$ curl -X PUT {WEAVY_SERVER}/api/apps/1/messages/typing
-H "Authorization: Bearer {ACCESS_TOKEN}"

Parameters

Name Type Required Description
id integer True Conversation id.

Responses

Status code 204

No Content


Weavy Docs