Skip to main content

channel_messages

Creates, updates, deletes, gets or lists a channel_messages resource.

Overview

Namechannel_messages
TypeResource
Idaws.chime_sdk_messaging.channel_messages

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
channel_arnstringThe 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>)
contentstringThe 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_typestringThe 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_timestampstring (date-time)The time at which the message was created.
last_edited_timestampstring (date-time)The time at which a message was edited.
last_updated_timestampstring (date-time)The time at which a message was updated.
message_attributesobjectThe 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_idstringThe ID of a message. (pattern: <code>[-_a-zA-Z0-9]*</code>)
metadatastringThe message metadata. (pattern: <code>.*</code>)
persistencestringThe persistence setting for a channel message. (PERSISTENT, NON_PERSISTENT)
redactedbooleanHides the content of a message.
senderobjectThe details of a user or bot.
statusobjectThe status of the channel message.
sub_channel_idstringThe ID of the SubChannel. (pattern: <code>[-_a-zA-Z0-9]*</code>)
targetarrayThe 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.
typestringThe message type. (STANDARD, CONTROL)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_channel_messageselectchannel_arn, message_id, x-amz-chime-bearer, regionsub-channel-idGets 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_messagesselectchannel_arn, x-amz-chime-bearer, regionsort-order, not-before, not-after, max-results, next-token, sub-channel-idList 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_messageupdatechannel_arn, message_id, x-amz-chime-bearer, region, ContentUpdates 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_messagedeletechannel_arn, message_id, x-amz-chime-bearer, regionsub-channel-idDeletes 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.

NameDatatypeDescription
channel_arnstringThe ARN of the channel.
message_idstringThe ID of the message being deleted.
regionstringAWS region (default: us-east-1)
x-amz-chime-bearerstringThe ARN of the AppInstanceUser or AppInstanceBot that makes the API call.
max-resultsintegerThe maximum number of messages that you want returned.
next-tokenstringThe token passed by previous API calls until all requested messages are returned.
not-afterstring (date-time)The final or ending time stamp for your requested messages.
not-beforestring (date-time)The initial or starting time stamp for your requested messages.
sort-orderstringThe order in which you want messages sorted. Default is Descending, based on time created.
sub-channel-idstringThe ID of the SubChannel in the request. Only required when deleting messages in a SubChannel that the user belongs to.

SELECT examples

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 }}'
;

UPDATE examples

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

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 }}'
;