Message Links
Message Links contain parsed link preview data like an image and description and are embedded inside a message.
Properties
Name | Type | Description | Required |
---|---|---|---|
source | string | The href of the URL this message link represents | ✔ |
startPosition | number | The starting index of this link within the message | ✔ |
endPosition | number | The ending index of this link within the message | ✔ |
preview | MessageLinkPreview | Embedded link preview data | - |
MessageLinkPreview properties
Name | Type | Description | Required |
---|---|---|---|
title | string | The title of this link | ✔ |
image | MessageLinkPreviewImage | Image data of this link preview | ✔ |
description | string | Description of this link preview | - |
siteName | string | The name of the site linked | - |
MessageLinkPreviewImage properties
Name | Type | Description | Required |
---|---|---|---|
source | string | The url source of this image | ✔ |
Creating message links
Message links are automatically created for URLs embedded inside text messages:
const result = await kitty.sendMessage({
channel: channel,
body: "Here's a link! https://chatkitty.com"
});
if (result.succeeded) {
const links = result.message.links; // Handle message links
}
if (result.failed) {
const error = result.error; // Handle error
}