DirectMessages REST API endpoint
Disclaimer: This endpoint documentation is generated from the latest Sitevision version. It might differ from the actual Sitevision environment where your website resides.
Use the RestApi utility of the Public API for server-side access of this endpoint.
DirectMessages
Get, create, update or delete direct messages.
Applicable to: sv:directMessageConversation.
GET
Returns either a collection of messages or a single message from a sv:directMessageConversation
Requirements
- The feature "social collaboration" and that social collaboration is enabled on the sv:site.
- The caller must have a sv:userIdentity.
Permissions
- Retrieving messages requires that the caller is a member of the sv:directMessageConversation.
Get a collection
Returns an array of objects containing messages for a sv:directMessageConversation.
Parameters
| Name | Type | Default | Values | Description |
|---|---|---|---|---|
| skip | number |
0 | Any positive value | Skips leading number of messages. |
| limit | number |
10 | 1 - 50 | Limits the number of messages to return. |
| offsetEntryId | string |
420.xxx | From which point to retrieve following messages. | |
| messageFormat | string |
JSON | HTML, PLAIN, JSON, JSON_TREE, MARKDOWN | The data format for the message in the returned result (MARKDOWN since 2024.11.1). |
Example URL
432.da2469218ba911a4383/directmessages
Example response
[
{
"type": "entry",
"message": [
{
"type": "link",
"url": "https://github.com/sitevision/sitevision-apps/tree/main/packages/create-sitevision-app",
"text": "create-sitevision-app"
}
],
"id": "420.2f46d81518dd54612764",
"creationDate": 1708681747574,
"author": {
"id": "400.c9230718a03a4dee41",
"fullName": "John Doe",
"disabled": false,
"BuddyIconSize_SMALL": "/images/200.11e3482d18a4f98c8df31/1693553706231/john.webp",
"BuddyIconSize_LARGE": "/images/200.11e3482d18a4f98c8df32/1693553706282/john.webp",
"BuddyIconSize_X_LARGE": "/images/200.11e3482d18a4f98c8df30/1693553705992/john.webp"
},
"isModified": false,
"reactions": [],
"repliesCount": 0,
},
{
"type": "entry",
"message": [
{
"type": "text",
"text": "Hello, world!"
}
],
"id": "420.2f46d81518dd54612763",
"creationDate": 1708681716017,
"author": {
"id": "400.c9230718a03a4dee41",
"fullName": "John Doe",
"disabled": false,
"BuddyIconSize_SMALL": "/images/200.11e3482d18a4f98c8df31/1693553706231/john.webp",
"BuddyIconSize_LARGE": "/images/200.11e3482d18a4f98c8df32/1693553706282/john.webp",
"BuddyIconSize_X_LARGE": "/images/200.11e3482d18a4f98c8df30/1693553705992/john.webp"
},
"isModified": false,
"reactions": [],
"repliesCount": 0,
}
]
Get a single message
Returns an object containing a specific message from a sv:directMessageConversation
Example URL
432.da2469218ba911a4383/directmessages/420.2f46d81518dd54612763
Example response
{
"type": "entry",
"message": [
{
"type": "text",
"text": "Hello, world!"
}
],
"id": "420.2f46d81518dd54612763",
"creationDate": 1708681716017,
"author": {
"id": "400.c9230718a03a4dee41",
"fullName": "John Doe",
"disabled": false,
"BuddyIconSize_SMALL": "/images/200.11e3482d18a4f98c8df31/1693553706231/john.webp",
"BuddyIconSize_LARGE": "/images/200.11e3482d18a4f98c8df32/1693553706282/john.webp",
"BuddyIconSize_X_LARGE": "/images/200.11e3482d18a4f98c8df30/1693553705992/john.webp"
},
"isModified": false,
"reactions": [],
"repliesCount": 0,
}
POST
Create a message in a sv:directMessageConversation as the requesting sv:userIdentity.
Returns an object containing the newly created message.
Requirements
- The feature "social collaboration" and that social collaboration is enabled on the sv:site.
- The caller must have a sv:userIdentity.
Permissions
- Requires that the calling sv:userIdentity is a member of the sv:directMessageConversation.
Parameters
| Name | Type | Default | Values | Description |
|---|---|---|---|---|
| message | string |
The message of the entry (plain text or Markdown-formatted plain text).
The max length of the message is determined by the social collaboration max character count setting (maxEntryCharacterCount property of the sv:site). |
||
| messageFormat | string |
JSON | HTML, PLAIN, JSON, JSON_TREE, MARKDOWN | The data format for the message in the returned result (MARKDOWN since 2024.11.1). |
Example URL
432.da2469218ba911a4383/directmessages
Example input
{
"message": "Hello, friends!"
}
Example response
{
"type": "entry",
"message": [
{
"type": "text",
"text": "Hello, friends!"
}
],
"id": "420.2f46d81518dd54612765",
"creationDate": 1708682486877,
"author": {
"id": "400.c9230718a03a4dee41",
"fullName": "John Doe",
"disabled": false,
"BuddyIconSize_SMALL": "/images/200.11e3482d18a4f98c8df31/1693553706231/john.webp",
"BuddyIconSize_LARGE": "/images/200.11e3482d18a4f98c8df32/1693553706282/john.webp",
"BuddyIconSize_X_LARGE": "/images/200.11e3482d18a4f98c8df30/1693553705992/john.webp"
},
"isModified": false
}
PUT
Update a message.
Returns an object containing the updated message.
Requirements
- The feature "social collaboration" and that social collaboration is enabled on the sv:site.
- The caller must have a sv:userIdentity.
- The targeted message must belong to the targeted sv:directMessageConversation.
Permissions
- Requires that the calling sv:userIdentity is the author of the message and member of the sv:directMessageConversation.
Parameters
| Name | Type | Default | Values | Description |
|---|---|---|---|---|
| message | string |
The new message of the entry (plain text or Markdown-formatted plain text).
The max length of the message is determined by the social collaboration max character count setting (maxEntryCharacterCount property of the sv:site). |
||
| messageFormat | string |
JSON | HTML, PLAIN, JSON, JSON_TREE, MARKDOWN | The data format for the message in the returned result (MARKDOWN since 2024.11.1). |
Example URL
432.da2469218ba911a4383/directmessages/420.2f46d81518dd54612763
Example input
{
"message": "Hello!"
}
Example response
{
"type": "entry",
"message": [
{
"type": "text",
"text": "Hello!"
}
],
"id": "420.2f46d81518dd54612763",
"author": {
"id": "400.c9230718a03a4dee41"
},
"isModified": true,
"modifiedAt": 1708683104654
}
DELETE
Delete a message.
Returns an object containing status.
Requirements
- The feature "social collaboration" and that social collaboration is enabled on the sv:site.
- The caller must have a sv:userIdentity.
- The targeted message must belong to the targeted sv:directMessageConversation.
Permissions
- Requires that the calling sv:userIdentity is the author of the message and member of the sv:directMessageConversation where the message exists.
Example URL
432.da2469218ba911a4383/directmessages/420.2f46d81518dd54612763
Example response
{
"success": true
}