channel_messages
Creates, updates, deletes, gets or lists a channel_messages resource.
Overview
| Name | channel_messages |
| Type | Resource |
| Id | aws.chime_sdk_messaging.channel_messages |
Fields
The following fields are returned by SELECT queries:
- get_channel_message
- list_channel_messages
| Name | Datatype | Description |
|---|---|---|
channel_arn | string | The ARN of the channel. (pattern: <code>arn:[a-z0-9-.]{1,63}:[a-z0-9-.]{0,63}:[a-z0-9-.]{0,63}:[a-z0-9-.]{0,63}:[^/].{0,1023}</code>) |
content | string | The content of the channel message. For Amazon Lex V2 bot responses, this field holds a list of messages originating from the bot. For more information, refer to Processing responses from an AppInstanceBot in the Amazon Chime SDK Messaging Developer Guide. (pattern: <code>[\s\S]*</code>) |
content_type | string | The content type of the channel message. For Amazon Lex V2 bot responses, the content type is application/amz-chime-lex-msgs for success responses and application/amz-chime-lex-error for failure responses. For more information, refer to Processing responses from an AppInstanceBot in the Amazon Chime SDK Messaging Developer Guide. (pattern: <code>[\s\S]*</code>) |
created_timestamp | string (date-time) | The time at which the message was created. |
last_edited_timestamp | string (date-time) | The time at which a message was edited. |
last_updated_timestamp | string (date-time) | The time at which a message was updated. |
message_attributes | object | The attributes for the channel message. For Amazon Lex V2 bot responses, the attributes are mapped to specific fields from the bot. For more information, refer to Processing responses from an AppInstanceBot in the Amazon Chime SDK Messaging Developer Guide. |
message_id | string | The ID of a message. (pattern: <code>[-_a-zA-Z0-9]*</code>) |
metadata | string | The message metadata. (pattern: <code>.*</code>) |
persistence | string | The persistence setting for a channel message. (PERSISTENT, NON_PERSISTENT) |
redacted | boolean | Hides the content of a message. |
sender | object | The details of a user or bot. |
status | object | The status of the channel message. |
sub_channel_id | string | The ID of the SubChannel. (pattern: <code>[-_a-zA-Z0-9]*</code>) |
target | array | The target of a message, a sender, a user, or a bot. Only the target and the sender can view targeted messages. Only users who can see targeted messages can take actions on them. However, administrators can delete targeted messages that they can’t see. |
type | string | The message type. (STANDARD, CONTROL) |
| Name | Datatype | Description |
|---|---|---|
channel_arn | string | The ARN of the channel containing the requested messages. (pattern: <code>arn:[a-z0-9-.]{1,63}:[a-z0-9-.]{0,63}:[a-z0-9-.]{0,63}:[a-z0-9-.]{0,63}:[^/].{0,1023}</code>) |
channel_messages | array | The information about, and content of, each requested message. |
next_token | string | The token passed by previous API calls until all requested messages are returned. (pattern: <code>.*</code>) |
sub_channel_id | string | The ID of the SubChannel in the response. (pattern: <code>[-_a-zA-Z0-9]*</code>) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_channel_message | select | channel_arn, message_id, x-amz-chime-bearer, region | sub-channel-id | Gets the full details of a channel message. The x-amz-chime-bearer request header is mandatory. Use the ARN of the AppInstanceUser or AppInstanceBot that makes the API call as the value in the header. |
list_channel_messages | select | channel_arn, x-amz-chime-bearer, region | sort-order, not-before, not-after, max-results, next-token, sub-channel-id | List all the messages in a channel. Returns a paginated list of ChannelMessages. By default, sorted by creation timestamp in descending order. Redacted messages appear in the results as empty, since they are only redacted, not deleted. Deleted messages do not appear in the results. This action always returns the latest version of an edited message. Also, the x-amz-chime-bearer request header is mandatory. Use the ARN of the AppInstanceUser or AppInstanceBot that makes the API call as the value in the header. |
update_channel_message | update | channel_arn, message_id, x-amz-chime-bearer, region, Content | Updates the content of a message. The x-amz-chime-bearer request header is mandatory. Use the ARN of the AppInstanceUser or AppInstanceBot that makes the API call as the value in the header. | |
delete_channel_message | delete | channel_arn, message_id, x-amz-chime-bearer, region | sub-channel-id | Deletes a channel message. Only admins can perform this action. Deletion makes messages inaccessible immediately. A background process deletes any revisions created by UpdateChannelMessage. The x-amz-chime-bearer request header is mandatory. Use the ARN of the AppInstanceUser or AppInstanceBot that makes the API call as the value in the header. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
channel_arn | string | The ARN of the channel. |
message_id | string | The ID of the message being deleted. |
region | string | AWS region (default: us-east-1) |
x-amz-chime-bearer | string | The ARN of the AppInstanceUser or AppInstanceBot that makes the API call. |
max-results | integer | The maximum number of messages that you want returned. |
next-token | string | The token passed by previous API calls until all requested messages are returned. |
not-after | string (date-time) | The final or ending time stamp for your requested messages. |
not-before | string (date-time) | The initial or starting time stamp for your requested messages. |
sort-order | string | The order in which you want messages sorted. Default is Descending, based on time created. |
sub-channel-id | string | The ID of the SubChannel in the request. Only required when deleting messages in a SubChannel that the user belongs to. |
SELECT examples
- get_channel_message
- list_channel_messages
Gets the full details of a channel message. The x-amz-chime-bearer request header is mandatory. Use the ARN of the AppInstanceUser or AppInstanceBot that makes the API call as the value in the header.
SELECT
channel_arn,
content,
content_type,
created_timestamp,
last_edited_timestamp,
last_updated_timestamp,
message_attributes,
message_id,
metadata,
persistence,
redacted,
sender,
status,
sub_channel_id,
target,
type
FROM aws.chime_sdk_messaging.channel_messages
WHERE channel_arn = '{{ channel_arn }}' -- required
AND message_id = '{{ message_id }}' -- required
AND `x-amz-chime-bearer` = '{{ x-amz-chime-bearer }}' -- required
AND region = '{{ region }}' -- required
AND `sub-channel-id` = '{{ sub-channel-id }}'
;
List all the messages in a channel. Returns a paginated list of ChannelMessages. By default, sorted by creation timestamp in descending order. Redacted messages appear in the results as empty, since they are only redacted, not deleted. Deleted messages do not appear in the results. This action always returns the latest version of an edited message. Also, the x-amz-chime-bearer request header is mandatory. Use the ARN of the AppInstanceUser or AppInstanceBot that makes the API call as the value in the header.
SELECT
channel_arn,
channel_messages,
next_token,
sub_channel_id
FROM aws.chime_sdk_messaging.channel_messages
WHERE channel_arn = '{{ channel_arn }}' -- required
AND `x-amz-chime-bearer` = '{{ x-amz-chime-bearer }}' -- required
AND region = '{{ region }}' -- required
AND `sort-order` = '{{ sort-order }}'
AND `not-before` = '{{ not-before }}'
AND `not-after` = '{{ not-after }}'
AND `max-results` = '{{ max-results }}'
AND `next-token` = '{{ next-token }}'
AND `sub-channel-id` = '{{ sub-channel-id }}'
;
UPDATE examples
- update_channel_message
Updates the content of a message. The x-amz-chime-bearer request header is mandatory. Use the ARN of the AppInstanceUser or AppInstanceBot that makes the API call as the value in the header.
UPDATE aws.chime_sdk_messaging.channel_messages
SET
Content = '{{ Content }}',
Metadata = '{{ Metadata }}',
SubChannelId = '{{ SubChannelId }}',
ContentType = '{{ ContentType }}'
WHERE
channel_arn = '{{ channel_arn }}' --required
AND message_id = '{{ message_id }}' --required
AND `x-amz-chime-bearer` = '{{ x-amz-chime-bearer }}' --required
AND region = '{{ region }}' --required
AND Content = '{{ Content }}' --required
RETURNING
channel_arn,
message_id,
status,
sub_channel_id;
DELETE examples
- delete_channel_message
Deletes a channel message. Only admins can perform this action. Deletion makes messages inaccessible immediately. A background process deletes any revisions created by UpdateChannelMessage. The x-amz-chime-bearer request header is mandatory. Use the ARN of the AppInstanceUser or AppInstanceBot that makes the API call as the value in the header.
DELETE FROM aws.chime_sdk_messaging.channel_messages
WHERE channel_arn = '{{ channel_arn }}' --required
AND message_id = '{{ message_id }}' --required
AND `x-amz-chime-bearer` = '{{ x-amz-chime-bearer }}' --required
AND region = '{{ region }}' --required
AND `sub-channel-id` = '{{ sub-channel-id }}'
;