2023/03/23 - Amazon Chime SDK Messaging - 1 new 7 updated api methods
Changes ExpirationSettings provides automatic resource deletion for Channels.
Sets the number of days before the channel is automatically deleted.
Note
A background process deletes expired channels within 6 hours of expiration. Actual deletion times may vary.
Expired channels that have not yet been deleted appear as active, and you can update their expiration settings. The system honors the new settings.
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.
See also: AWS API Documentation
Request Syntax
client.put_channel_expiration_settings( ChannelArn='string', ChimeBearer='string', ExpirationSettings={ 'ExpirationDays': 123, 'ExpirationCriterion': 'CREATED_TIMESTAMP'|'LAST_MESSAGE_TIMESTAMP' } )
string
[REQUIRED]
The ARN of the channel.
string
The ARN of the AppInstanceUser or AppInstanceBot that makes the API call.
dict
Settings that control the interval after which a channel is deleted.
ExpirationDays (integer) -- [REQUIRED]
The period in days after which the system automatically deletes a channel.
ExpirationCriterion (string) -- [REQUIRED]
The conditions that must be met for a channel to expire.
dict
Response Syntax
{ 'ChannelArn': 'string', 'ExpirationSettings': { 'ExpirationDays': 123, 'ExpirationCriterion': 'CREATED_TIMESTAMP'|'LAST_MESSAGE_TIMESTAMP' } }
Response Structure
(dict) --
ChannelArn (string) --
The channel ARN.
ExpirationSettings (dict) --
Settings that control the interval after which a channel is deleted.
ExpirationDays (integer) --
The period in days after which the system automatically deletes a channel.
ExpirationCriterion (string) --
The conditions that must be met for a channel to expire.
{'ChannelMessage': {'ContentType': 'string'}}
Calls back Chime SDK Messaging with a processing response message. This should be invoked from the processor Lambda. This is a developer API.
You can return one of the following processing responses:
Update message content or metadata
Deny a message
Make no changes to the message
See also: AWS API Documentation
Request Syntax
client.channel_flow_callback( CallbackId='string', ChannelArn='string', DeleteResource=True|False, ChannelMessage={ 'MessageId': 'string', 'Content': 'string', 'Metadata': 'string', 'PushNotification': { 'Title': 'string', 'Body': 'string', 'Type': 'DEFAULT'|'VOIP' }, 'MessageAttributes': { 'string': { 'StringValues': [ 'string', ] } }, 'SubChannelId': 'string', 'ContentType': 'string' } )
string
[REQUIRED]
The identifier passed to the processor by the service when invoked. Use the identifier to call back the service.
This field is autopopulated if not provided.
string
[REQUIRED]
The ARN of the channel.
boolean
When a processor determines that a message needs to be DENIED , pass this parameter with a value of true.
dict
[REQUIRED]
Stores information about the processed message.
MessageId (string) -- [REQUIRED]
The message ID.
Content (string) --
The message content.
Metadata (string) --
The message metadata.
PushNotification (dict) --
The push notification configuration of the message.
Title (string) --
The title of the push notification.
Body (string) --
The body of the push notification.
Type (string) --
Enum value that indicates the type of the push notification for a message. DEFAULT : Normal mobile push notification. VOIP : VOIP mobile push notification.
MessageAttributes (dict) --
The attributes for the message, used for message filtering along with a FilterRule defined in the PushNotificationPreferences .
(string) --
(dict) --
A list of message attribute values.
StringValues (list) --
The strings in a message attribute value.
(string) --
SubChannelId (string) --
The ID of the SubChannel.
ContentType (string) --
The content type of the call-back message.
dict
Response Syntax
{ 'ChannelArn': 'string', 'CallbackId': 'string' }
Response Structure
(dict) --
ChannelArn (string) --
The ARN of the channel.
CallbackId (string) --
The call back ID passed in the request.
{'ExpirationSettings': {'ExpirationCriterion': 'CREATED_TIMESTAMP | ' 'LAST_MESSAGE_TIMESTAMP', 'ExpirationDays': 'integer'}}
Creates a channel to which you can add users and send messages.
Restriction : You can't change a channel's privacy.
Note
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.
See also: AWS API Documentation
Request Syntax
client.create_channel( AppInstanceArn='string', Name='string', Mode='UNRESTRICTED'|'RESTRICTED', Privacy='PUBLIC'|'PRIVATE', Metadata='string', ClientRequestToken='string', Tags=[ { 'Key': 'string', 'Value': 'string' }, ], ChimeBearer='string', ChannelId='string', MemberArns=[ 'string', ], ModeratorArns=[ 'string', ], ElasticChannelConfiguration={ 'MaximumSubChannels': 123, 'TargetMembershipsPerSubChannel': 123, 'MinimumMembershipPercentage': 123 }, ExpirationSettings={ 'ExpirationDays': 123, 'ExpirationCriterion': 'CREATED_TIMESTAMP'|'LAST_MESSAGE_TIMESTAMP' } )
string
[REQUIRED]
The ARN of the channel request.
string
[REQUIRED]
The name of the channel.
string
The channel mode: UNRESTRICTED or RESTRICTED . Administrators, moderators, and channel members can add themselves and other members to unrestricted channels. Only administrators and moderators can add members to restricted channels.
string
The channel's privacy level: PUBLIC or PRIVATE . Private channels aren't discoverable by users outside the channel. Public channels are discoverable by anyone in the AppInstance .
string
The metadata of the creation request. Limited to 1KB and UTF-8.
string
[REQUIRED]
The client token for the request. An Idempotency token.
This field is autopopulated if not provided.
list
The tags for the creation request.
(dict) --
A tag object containing a key-value pair.
Key (string) -- [REQUIRED]
The key in a tag.
Value (string) -- [REQUIRED]
The value in a tag.
string
[REQUIRED]
The ARN of the AppInstanceUser or AppInstanceBot that makes the API call.
string
The ID of the channel in the request.
list
The ARNs of the channel members in the request.
(string) --
list
The ARNs of the channel moderators in the request.
(string) --
dict
The attributes required to configure and create an elastic channel. An elastic channel can support a maximum of 1-million users, excluding moderators.
MaximumSubChannels (integer) -- [REQUIRED]
The maximum number of SubChannels that you want to allow in the elastic channel.
TargetMembershipsPerSubChannel (integer) -- [REQUIRED]
The maximum number of members allowed in a SubChannel.
MinimumMembershipPercentage (integer) -- [REQUIRED]
The minimum allowed percentage of TargetMembershipsPerSubChannel users. Ceil of the calculated value is used in balancing members among SubChannels of the elastic channel.
dict
Settings that control the interval after which the channel is automatically deleted.
ExpirationDays (integer) -- [REQUIRED]
The period in days after which the system automatically deletes a channel.
ExpirationCriterion (string) -- [REQUIRED]
The conditions that must be met for a channel to expire.
dict
Response Syntax
{ 'ChannelArn': 'string' }
Response Structure
(dict) --
ChannelArn (string) --
The ARN of the channel.
{'Channel': {'ExpirationSettings': {'ExpirationCriterion': 'CREATED_TIMESTAMP ' '| ' 'LAST_MESSAGE_TIMESTAMP', 'ExpirationDays': 'integer'}}}
Returns the full details of a channel in an Amazon Chime AppInstance .
Note
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.
See also: AWS API Documentation
Request Syntax
client.describe_channel( ChannelArn='string', ChimeBearer='string' )
string
[REQUIRED]
The ARN of the channel.
string
[REQUIRED]
The ARN of the AppInstanceUser or AppInstanceBot that makes the API call.
dict
Response Syntax
{ 'Channel': { 'Name': 'string', 'ChannelArn': 'string', 'Mode': 'UNRESTRICTED'|'RESTRICTED', 'Privacy': 'PUBLIC'|'PRIVATE', 'Metadata': 'string', 'CreatedBy': { 'Arn': 'string', 'Name': 'string' }, 'CreatedTimestamp': datetime(2015, 1, 1), 'LastMessageTimestamp': datetime(2015, 1, 1), 'LastUpdatedTimestamp': datetime(2015, 1, 1), 'ChannelFlowArn': 'string', 'ElasticChannelConfiguration': { 'MaximumSubChannels': 123, 'TargetMembershipsPerSubChannel': 123, 'MinimumMembershipPercentage': 123 }, 'ExpirationSettings': { 'ExpirationDays': 123, 'ExpirationCriterion': 'CREATED_TIMESTAMP'|'LAST_MESSAGE_TIMESTAMP' } } }
Response Structure
(dict) --
Channel (dict) --
The channel details.
Name (string) --
The name of a channel.
ChannelArn (string) --
The ARN of a channel.
Mode (string) --
The mode of the channel.
Privacy (string) --
The channel's privacy setting.
Metadata (string) --
The channel's metadata.
CreatedBy (dict) --
The AppInstanceUser who created the channel.
Arn (string) --
The ARN in an Identity.
Name (string) --
The name in an Identity.
CreatedTimestamp (datetime) --
The time at which the AppInstanceUser created the channel.
LastMessageTimestamp (datetime) --
The time at which a member sent the last message in the channel.
LastUpdatedTimestamp (datetime) --
The time at which a channel was last updated.
ChannelFlowArn (string) --
The ARN of the channel flow.
ElasticChannelConfiguration (dict) --
The attributes required to configure and create an elastic channel. An elastic channel can support a maximum of 1-million members.
MaximumSubChannels (integer) --
The maximum number of SubChannels that you want to allow in the elastic channel.
TargetMembershipsPerSubChannel (integer) --
The maximum number of members allowed in a SubChannel.
MinimumMembershipPercentage (integer) --
The minimum allowed percentage of TargetMembershipsPerSubChannel users. Ceil of the calculated value is used in balancing members among SubChannels of the elastic channel.
ExpirationSettings (dict) --
Settings that control when a channel expires.
ExpirationDays (integer) --
The period in days after which the system automatically deletes a channel.
ExpirationCriterion (string) --
The conditions that must be met for a channel to expire.
{'ChannelMessage': {'ContentType': 'string'}}
Gets the full details of a channel message.
Note
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.
See also: AWS API Documentation
Request Syntax
client.get_channel_message( ChannelArn='string', MessageId='string', ChimeBearer='string', SubChannelId='string' )
string
[REQUIRED]
The ARN of the channel.
string
[REQUIRED]
The ID of the message.
string
[REQUIRED]
The ARN of the AppInstanceUser or AppInstanceBot that makes the API call.
string
The ID of the SubChannel in the request.
Note
Only required when getting messages in a SubChannel that the user belongs to.
dict
Response Syntax
{ 'ChannelMessage': { 'ChannelArn': 'string', 'MessageId': 'string', 'Content': 'string', 'Metadata': 'string', 'Type': 'STANDARD'|'CONTROL', 'CreatedTimestamp': datetime(2015, 1, 1), 'LastEditedTimestamp': datetime(2015, 1, 1), 'LastUpdatedTimestamp': datetime(2015, 1, 1), 'Sender': { 'Arn': 'string', 'Name': 'string' }, 'Redacted': True|False, 'Persistence': 'PERSISTENT'|'NON_PERSISTENT', 'Status': { 'Value': 'SENT'|'PENDING'|'FAILED'|'DENIED', 'Detail': 'string' }, 'MessageAttributes': { 'string': { 'StringValues': [ 'string', ] } }, 'SubChannelId': 'string', 'ContentType': 'string' } }
Response Structure
(dict) --
ChannelMessage (dict) --
The details of and content in the message.
ChannelArn (string) --
The ARN of the channel.
MessageId (string) --
The ID of a message.
Content (string) --
The message content.
Metadata (string) --
The message metadata.
Type (string) --
The message type.
CreatedTimestamp (datetime) --
The time at which the message was created.
LastEditedTimestamp (datetime) --
The time at which a message was edited.
LastUpdatedTimestamp (datetime) --
The time at which a message was updated.
Sender (dict) --
The message sender.
Arn (string) --
The ARN in an Identity.
Name (string) --
The name in an Identity.
Redacted (boolean) --
Hides the content of a message.
Persistence (string) --
The persistence setting for a channel message.
Status (dict) --
The status of the channel message.
Value (string) --
The message status value.
Detail (string) --
Contains more details about the messasge status.
MessageAttributes (dict) --
The attributes for the message, used for message filtering along with a FilterRule defined in the PushNotificationPreferences .
(string) --
(dict) --
A list of message attribute values.
StringValues (list) --
The strings in a message attribute value.
(string) --
SubChannelId (string) --
The ID of the SubChannel.
ContentType (string) --
The content type of the channel message.
{'ChannelMessages': {'ContentType': 'string'}}
List all the messages in a channel. Returns a paginated list of ChannelMessages . By default, sorted by creation timestamp in descending order.
Note
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.
See also: AWS API Documentation
Request Syntax
client.list_channel_messages( ChannelArn='string', SortOrder='ASCENDING'|'DESCENDING', NotBefore=datetime(2015, 1, 1), NotAfter=datetime(2015, 1, 1), MaxResults=123, NextToken='string', ChimeBearer='string', SubChannelId='string' )
string
[REQUIRED]
The ARN of the channel.
string
The order in which you want messages sorted. Default is Descending, based on time created.
datetime
The initial or starting time stamp for your requested messages.
datetime
The final or ending time stamp for your requested messages.
integer
The maximum number of messages that you want returned.
string
The token passed by previous API calls until all requested messages are returned.
string
[REQUIRED]
The ARN of the AppInstanceUser or AppInstanceBot that makes the API call.
string
The ID of the SubChannel in the request.
Note
Only required when listing the messages in a SubChannel that the user belongs to.
dict
Response Syntax
{ 'ChannelArn': 'string', 'NextToken': 'string', 'ChannelMessages': [ { 'MessageId': 'string', 'Content': 'string', 'Metadata': 'string', 'Type': 'STANDARD'|'CONTROL', 'CreatedTimestamp': datetime(2015, 1, 1), 'LastUpdatedTimestamp': datetime(2015, 1, 1), 'LastEditedTimestamp': datetime(2015, 1, 1), 'Sender': { 'Arn': 'string', 'Name': 'string' }, 'Redacted': True|False, 'Status': { 'Value': 'SENT'|'PENDING'|'FAILED'|'DENIED', 'Detail': 'string' }, 'MessageAttributes': { 'string': { 'StringValues': [ 'string', ] } }, 'ContentType': 'string' }, ], 'SubChannelId': 'string' }
Response Structure
(dict) --
ChannelArn (string) --
The ARN of the channel containing the requested messages.
NextToken (string) --
The token passed by previous API calls until all requested messages are returned.
ChannelMessages (list) --
The information about, and content of, each requested message.
(dict) --
Summary of the messages in a Channel .
MessageId (string) --
The ID of the message.
Content (string) --
The content of the message.
Metadata (string) --
The metadata of the message.
Type (string) --
The type of message.
CreatedTimestamp (datetime) --
The time at which the message summary was created.
LastUpdatedTimestamp (datetime) --
The time at which a message was last updated.
LastEditedTimestamp (datetime) --
The time at which a message was last edited.
Sender (dict) --
The message sender.
Arn (string) --
The ARN in an Identity.
Name (string) --
The name in an Identity.
Redacted (boolean) --
Indicates whether a message was redacted.
Status (dict) --
The message status. The status value is SENT for messages sent to a channel without a channel flow. For channels associated with channel flow, the value determines the processing stage.
Value (string) --
The message status value.
Detail (string) --
Contains more details about the messasge status.
MessageAttributes (dict) --
The message attribues listed in a the summary of a channel message.
(string) --
(dict) --
A list of message attribute values.
StringValues (list) --
The strings in a message attribute value.
(string) --
ContentType (string) --
The content type of the channel messsage listed in the summary.
SubChannelId (string) --
The ID of the SubChannel in the response.
{'ContentType': 'string'}
Sends a message to a particular channel that the member is a part of.
Note
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.
Also, STANDARD messages can contain 4KB of data and the 1KB of metadata. CONTROL messages can contain 30 bytes of data and no metadata.
See also: AWS API Documentation
Request Syntax
client.send_channel_message( ChannelArn='string', Content='string', Type='STANDARD'|'CONTROL', Persistence='PERSISTENT'|'NON_PERSISTENT', Metadata='string', ClientRequestToken='string', ChimeBearer='string', PushNotification={ 'Title': 'string', 'Body': 'string', 'Type': 'DEFAULT'|'VOIP' }, MessageAttributes={ 'string': { 'StringValues': [ 'string', ] } }, SubChannelId='string', ContentType='string' )
string
[REQUIRED]
The ARN of the channel.
string
[REQUIRED]
The content of the message.
string
[REQUIRED]
The type of message, STANDARD or CONTROL .
string
[REQUIRED]
Boolean that controls whether the message is persisted on the back end. Required.
string
The optional metadata for each message.
string
[REQUIRED]
The Idempotency token for each client request.
This field is autopopulated if not provided.
string
[REQUIRED]
The ARN of the AppInstanceUser or AppInstanceBot that makes the API call.
dict
The push notification configuration of the message.
Title (string) --
The title of the push notification.
Body (string) --
The body of the push notification.
Type (string) --
Enum value that indicates the type of the push notification for a message. DEFAULT : Normal mobile push notification. VOIP : VOIP mobile push notification.
dict
The attributes for the message, used for message filtering along with a FilterRule defined in the PushNotificationPreferences .
(string) --
(dict) --
A list of message attribute values.
StringValues (list) --
The strings in a message attribute value.
(string) --
string
The ID of the SubChannel in the request.
string
The content type of the channel message.
dict
Response Syntax
{ 'ChannelArn': 'string', 'MessageId': 'string', 'Status': { 'Value': 'SENT'|'PENDING'|'FAILED'|'DENIED', 'Detail': 'string' }, 'SubChannelId': 'string' }
Response Structure
(dict) --
ChannelArn (string) --
The ARN of the channel.
MessageId (string) --
The ID string assigned to each message.
Status (dict) --
The status of the channel message.
Value (string) --
The message status value.
Detail (string) --
Contains more details about the messasge status.
SubChannelId (string) --
The ID of the SubChannel in the response.
{'ContentType': 'string'}
Updates the content of a message.
Note
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.
See also: AWS API Documentation
Request Syntax
client.update_channel_message( ChannelArn='string', MessageId='string', Content='string', Metadata='string', ChimeBearer='string', SubChannelId='string', ContentType='string' )
string
[REQUIRED]
The ARN of the channel.
string
[REQUIRED]
The ID string of the message being updated.
string
[REQUIRED]
The content of the message being updated.
string
The metadata of the message being updated.
string
[REQUIRED]
The ARN of the AppInstanceUser or AppInstanceBot that makes the API call.
string
The ID of the SubChannel in the request.
Note
Only required when updating messages in a SubChannel that the user belongs to.
string
The content type of the channel message.
dict
Response Syntax
{ 'ChannelArn': 'string', 'MessageId': 'string', 'Status': { 'Value': 'SENT'|'PENDING'|'FAILED'|'DENIED', 'Detail': 'string' }, 'SubChannelId': 'string' }
Response Structure
(dict) --
ChannelArn (string) --
The ARN of the channel.
MessageId (string) --
The ID string of the message being updated.
Status (dict) --
The status of the message update.
Value (string) --
The message status value.
Detail (string) --
Contains more details about the messasge status.
SubChannelId (string) --
The ID of the SubChannel in the response.