Amazon Interactive Video Service Chat

2022/04/26 - Amazon Interactive Video Service Chat - 12 new api methods

Changes  Adds new APIs for IVS Chat, a feature for building interactive chat experiences alongside an IVS broadcast.

DisconnectUser (new) Link ¶

Disconnects all connections using a specified user ID from a room. This replicates the DisconnectUser WebSocket operation in the Amazon IVS Chat Messaging API.

See also: AWS API Documentation

Request Syntax

client.disconnect_user(
    reason='string',
    roomIdentifier='string',
    userId='string'
)
type reason

string

param reason

Reason for disconnecting the user.

type roomIdentifier

string

param roomIdentifier

[REQUIRED]

Identifier of the room from which the user's clients should be disconnected. Currently this must be an ARN.

type userId

string

param userId

[REQUIRED]

ID of the user (connection) to disconnect from the room.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

CreateChatToken (new) Link ¶

Creates an encrypted token that is used to establish an individual WebSocket connection to a room. The token is valid for one minute, and a connection (session) established with the token is valid for the specified duration.

Encryption keys are owned by Amazon IVS Chat and never used directly by your application.

See also: AWS API Documentation

Request Syntax

client.create_chat_token(
    attributes={
        'string': 'string'
    },
    capabilities=[
        'SEND_MESSAGE'|'DISCONNECT_USER'|'DELETE_MESSAGE',
    ],
    roomIdentifier='string',
    sessionDurationInMinutes=123,
    userId='string'
)
type attributes

dict

param attributes

Application-provided attributes to encode into the token and attach to a chat session. Map keys and values can contain UTF-8 encoded text. The maximum length of this field is 1 KB total.

  • (string) --

    • (string) --

type capabilities

list

param capabilities

Set of capabilities that the user is allowed to perform in the room. Default: None (the capability to view messages is implicitly included in all requests).

  • (string) --

type roomIdentifier

string

param roomIdentifier

[REQUIRED]

Identifier of the room that the client is trying to access. Currently this must be an ARN.

type sessionDurationInMinutes

integer

param sessionDurationInMinutes

Session duration (in minutes), after which the session expires. Default: 60 (1 hour).

type userId

string

param userId

[REQUIRED]

Application-provided ID that uniquely identifies the user associated with this token. This can be any UTF-8 encoded text.

rtype

dict

returns

Response Syntax

{
    'sessionExpirationTime': datetime(2015, 1, 1),
    'token': 'string',
    'tokenExpirationTime': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • sessionExpirationTime (datetime) --

      Time after which an end user's session is no longer valid. This is an ISO 8601 timestamp; note that this is returned as a string .

    • token (string) --

      The issued client token, encrypted.

    • tokenExpirationTime (datetime) --

      Time after which the token is no longer valid and cannot be used to connect to a room. This is an ISO 8601 timestamp; note that this is returned as a string .

DeleteRoom (new) Link ¶

Deletes the specified room.

See also: AWS API Documentation

Request Syntax

client.delete_room(
    identifier='string'
)
type identifier

string

param identifier

[REQUIRED]

Identifier of the room to be deleted. Currently this must be an ARN.

returns

None

CreateRoom (new) Link ¶

Creates a room that allows clients to connect and pass messages.

See also: AWS API Documentation

Request Syntax

client.create_room(
    maximumMessageLength=123,
    maximumMessageRatePerSecond=123,
    messageReviewHandler={
        'fallbackResult': 'ALLOW'|'DENY',
        'uri': 'string'
    },
    name='string',
    tags={
        'string': 'string'
    }
)
type maximumMessageLength

integer

param maximumMessageLength

Maximum number of characters in a single message. Messages are expected to be UTF-8 encoded and this limit applies specifically to rune/code-point count, not number of bytes. Default: 500.

type maximumMessageRatePerSecond

integer

param maximumMessageRatePerSecond

Maximum number of messages per second that a client can send to the room. Default: 10.

type messageReviewHandler

dict

param messageReviewHandler

Configuration information for optional review of messages.

  • fallbackResult (string) --

    Specifies the fallback behavior (whether the message is allowed or denied) if the handler does not return a valid response, encounters an error or times out. If allowed, the message is delivered with returned content to all users connected to the room. If denied, the message is not delivered to any user. Default: ALLOW .

  • uri (string) --

    Identifier of the message review handler. Currently this must be an ARN of a lambda function.

type name

string

param name

Room name. The value does not need to be unique.

type tags

dict

param tags

Tags to attach to the resource. Array of maps, each of the form string:string (key:value) .

  • (string) --

    • (string) --

rtype

dict

returns

Response Syntax

{
    'arn': 'string',
    'createTime': datetime(2015, 1, 1),
    'id': 'string',
    'maximumMessageLength': 123,
    'maximumMessageRatePerSecond': 123,
    'messageReviewHandler': {
        'fallbackResult': 'ALLOW'|'DENY',
        'uri': 'string'
    },
    'name': 'string',
    'tags': {
        'string': 'string'
    },
    'updateTime': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • arn (string) --

      Room ARN, assigned by the system.

    • createTime (datetime) --

      Time when the room was created. This is an ISO 8601 timestamp; note that this is returned as a string .

    • id (string) --

      Room ID, generated by the system. This is a relative identifier, the part of the ARN that uniquely identifies the room.

    • maximumMessageLength (integer) --

      Maximum number of characters in a single message, from the request.

    • maximumMessageRatePerSecond (integer) --

      Maximum number of messages per second that a client can send to the room, from the request.

    • messageReviewHandler (dict) --

      Configuration information for optional review of messages.

      • fallbackResult (string) --

        Specifies the fallback behavior (whether the message is allowed or denied) if the handler does not return a valid response, encounters an error or times out. If allowed, the message is delivered with returned content to all users connected to the room. If denied, the message is not delivered to any user. Default: ALLOW .

      • uri (string) --

        Identifier of the message review handler. Currently this must be an ARN of a lambda function.

    • name (string) --

      Room name, from the request (if specified).

    • tags (dict) --

      Tags attached to the resource, from the request.

      • (string) --

        • (string) --

    • updateTime (datetime) --

      Time of the room’s last update. This is an ISO 8601 timestamp; note that this is returned as a string .

SendEvent (new) Link ¶

Sends an event to a room. Use this within your application’s business logic to send events to clients of a room; e.g., to notify clients to change the way the chat UI is rendered.

See also: AWS API Documentation

Request Syntax

client.send_event(
    attributes={
        'string': 'string'
    },
    eventName='string',
    roomIdentifier='string'
)
type attributes

dict

param attributes

Application-defined metadata to attach to the event sent to clients. The maximum length of the metadata is 1 KB total.

  • (string) --

    • (string) --

type eventName

string

param eventName

[REQUIRED]

Application-defined name of the event to send to clients.

type roomIdentifier

string

param roomIdentifier

[REQUIRED]

Identifier of the room to which the event will be sent. Currently this must be an ARN.

rtype

dict

returns

Response Syntax

{
    'id': 'string'
}

Response Structure

  • (dict) --

    • id (string) --

      An identifier generated by Amazon IVS Chat. This identifier must be used in subsequent operations for this message, such as DeleteMessage.

TagResource (new) Link ¶

Adds or updates tags for the AWS resource with the specified ARN.

See also: AWS API Documentation

Request Syntax

client.tag_resource(
    resourceArn='string',
    tags={
        'string': 'string'
    }
)
type resourceArn

string

param resourceArn

[REQUIRED]

The ARN of the resource to be tagged. The ARN must be URL-encoded.

type tags

dict

param tags

[REQUIRED]

Array of tags to be added or updated.

  • (string) --

    • (string) --

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

UpdateRoom (new) Link ¶

Updates a room’s configuration.

See also: AWS API Documentation

Request Syntax

client.update_room(
    identifier='string',
    maximumMessageLength=123,
    maximumMessageRatePerSecond=123,
    messageReviewHandler={
        'fallbackResult': 'ALLOW'|'DENY',
        'uri': 'string'
    },
    name='string'
)
type identifier

string

param identifier

[REQUIRED]

Identifier of the room to be updated. Currently this must be an ARN.

type maximumMessageLength

integer

param maximumMessageLength

The maximum number of characters in a single message. Messages are expected to be UTF-8 encoded and this limit applies specifically to rune/code-point count, not number of bytes. Default: 500.

type maximumMessageRatePerSecond

integer

param maximumMessageRatePerSecond

The maximum number of messages per second that a client can send to the room. Default: 10.

type messageReviewHandler

dict

param messageReviewHandler

Configuration information for optional review of messages. Specify an empty uri string to disassociate a message review handler from the specified room.

  • fallbackResult (string) --

    Specifies the fallback behavior (whether the message is allowed or denied) if the handler does not return a valid response, encounters an error or times out. If allowed, the message is delivered with returned content to all users connected to the room. If denied, the message is not delivered to any user. Default: ALLOW .

  • uri (string) --

    Identifier of the message review handler. Currently this must be an ARN of a lambda function.

type name

string

param name

Room name. The value does not need to be unique.

rtype

dict

returns

Response Syntax

{
    'arn': 'string',
    'createTime': datetime(2015, 1, 1),
    'id': 'string',
    'maximumMessageLength': 123,
    'maximumMessageRatePerSecond': 123,
    'messageReviewHandler': {
        'fallbackResult': 'ALLOW'|'DENY',
        'uri': 'string'
    },
    'name': 'string',
    'tags': {
        'string': 'string'
    },
    'updateTime': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • arn (string) --

      Room ARN, from the request (if identifier was an ARN).

    • createTime (datetime) --

      Time when the room was created. This is an ISO 8601 timestamp; note that this is returned as a string .

    • id (string) --

      Room ID, generated by the system. This is a relative identifier, the part of the ARN that uniquely identifies the room.

    • maximumMessageLength (integer) --

      Maximum number of characters in a single message, from the request.

    • maximumMessageRatePerSecond (integer) --

      Maximum number of messages per second that a client can send to the room, from the request.

    • messageReviewHandler (dict) --

      Configuration information for optional review of messages.

      • fallbackResult (string) --

        Specifies the fallback behavior (whether the message is allowed or denied) if the handler does not return a valid response, encounters an error or times out. If allowed, the message is delivered with returned content to all users connected to the room. If denied, the message is not delivered to any user. Default: ALLOW .

      • uri (string) --

        Identifier of the message review handler. Currently this must be an ARN of a lambda function.

    • name (string) --

      Room name, from the request.

    • tags (dict) --

      Tags attached to the resource.

      • (string) --

        • (string) --

    • updateTime (datetime) --

      Time of the room’s last update. This is an ISO 8601 timestamp; note that this is returned as a string .

GetRoom (new) Link ¶

Gets the specified room.

See also: AWS API Documentation

Request Syntax

client.get_room(
    identifier='string'
)
type identifier

string

param identifier

[REQUIRED]

Identifier of the room for which the configuration is to be retrieved. Currently this must be an ARN.

rtype

dict

returns

Response Syntax

{
    'arn': 'string',
    'createTime': datetime(2015, 1, 1),
    'id': 'string',
    'maximumMessageLength': 123,
    'maximumMessageRatePerSecond': 123,
    'messageReviewHandler': {
        'fallbackResult': 'ALLOW'|'DENY',
        'uri': 'string'
    },
    'name': 'string',
    'tags': {
        'string': 'string'
    },
    'updateTime': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • arn (string) --

      Room ARN, from the request (if identifier was an ARN).

    • createTime (datetime) --

      Time when the room was created. This is an ISO 8601 timestamp; note that this is returned as a string .

    • id (string) --

      Room ID, generated by the system. This is a relative identifier, the part of the ARN that uniquely identifies the room.

    • maximumMessageLength (integer) --

      Maximum number of characters in a single message. Messages are expected to be UTF-8 encoded and this limit applies specifically to rune/code-point count, not number of bytes. Default: 500.

    • maximumMessageRatePerSecond (integer) --

      Maximum number of messages per second that a client can send to the room. Default: 10.

    • messageReviewHandler (dict) --

      Configuration information for optional review of messages.

      • fallbackResult (string) --

        Specifies the fallback behavior (whether the message is allowed or denied) if the handler does not return a valid response, encounters an error or times out. If allowed, the message is delivered with returned content to all users connected to the room. If denied, the message is not delivered to any user. Default: ALLOW .

      • uri (string) --

        Identifier of the message review handler. Currently this must be an ARN of a lambda function.

    • name (string) --

      Room name. The value does not need to be unique.

    • tags (dict) --

      Tags attached to the resource. Array of maps, each of the form string:string (key:value) .

      • (string) --

        • (string) --

    • updateTime (datetime) --

      Time of the room’s last update. This is an ISO 8601 timestamp; note that this is returned as a string .

ListRooms (new) Link ¶

Gets summary information about all your rooms in the AWS region where the API request is processed. Results are sorted in descending order of updateTime .

See also: AWS API Documentation

Request Syntax

client.list_rooms(
    maxResults=123,
    messageReviewHandlerUri='string',
    name='string',
    nextToken='string'
)
type maxResults

integer

param maxResults

Maximum number of rooms to return. Default: 50.

type messageReviewHandlerUri

string

param messageReviewHandlerUri

Filters the list to match the specified message review handler URI.

type name

string

param name

Filters the list to match the specified room name.

type nextToken

string

param nextToken

The first room to retrieve. This is used for pagination; see the nextToken response field.

rtype

dict

returns

Response Syntax

{
    'nextToken': 'string',
    'rooms': [
        {
            'arn': 'string',
            'createTime': datetime(2015, 1, 1),
            'id': 'string',
            'messageReviewHandler': {
                'fallbackResult': 'ALLOW'|'DENY',
                'uri': 'string'
            },
            'name': 'string',
            'tags': {
                'string': 'string'
            },
            'updateTime': datetime(2015, 1, 1)
        },
    ]
}

Response Structure

  • (dict) --

    • nextToken (string) --

      If there are more rooms than maxResults , use nextToken in the request to get the next set.

    • rooms (list) --

      List of the matching rooms (summary information only).

      • (dict) --

        Summary information about a room.

        • arn (string) --

          Room ARN.

        • createTime (datetime) --

          Time when the room was created. This is an ISO 8601 timestamp; note that this is returned as a string .

        • id (string) --

          Room ID, generated by the system. This is a relative identifier, the part of the ARN that uniquely identifies the room.

        • messageReviewHandler (dict) --

          Configuration information for optional review of messages.

          • fallbackResult (string) --

            Specifies the fallback behavior (whether the message is allowed or denied) if the handler does not return a valid response, encounters an error or times out. If allowed, the message is delivered with returned content to all users connected to the room. If denied, the message is not delivered to any user. Default: ALLOW .

          • uri (string) --

            Identifier of the message review handler. Currently this must be an ARN of a lambda function.

        • name (string) --

          Room name. The value does not need to be unique.

        • tags (dict) --

          Tags attached to the resource.

          • (string) --

            • (string) --

        • updateTime (datetime) --

          Time of the room’s last update. This is an ISO 8601 timestamp; note that this is returned as a string .

ListTagsForResource (new) Link ¶

Gets information about AWS tags for the specified ARN.

See also: AWS API Documentation

Request Syntax

client.list_tags_for_resource(
    resourceArn='string'
)
type resourceArn

string

param resourceArn

[REQUIRED]

The ARN of the resource to be retrieved. The ARN must be URL-encoded.

rtype

dict

returns

Response Syntax

{
    'tags': {
        'string': 'string'
    }
}

Response Structure

  • (dict) --

    • tags (dict) --

      Tags to attach to the resource. Array of maps, each of the form string:string (key:value) .

      • (string) --

        • (string) --

UntagResource (new) Link ¶

Removes tags from the resource with the specified ARN.

See also: AWS API Documentation

Request Syntax

client.untag_resource(
    resourceArn='string',
    tagKeys=[
        'string',
    ]
)
type resourceArn

string

param resourceArn

[REQUIRED]

The ARN of the resource to be untagged. The ARN must be URL-encoded.

type tagKeys

list

param tagKeys

[REQUIRED]

Array of tags to be removed.

  • (string) --

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

DeleteMessage (new) Link ¶

Sends an event to a specific room which directs clients to delete a specific message; that is, unrender it from view and delete it from the client’s chat history. This event’s EventName is aws:DELETE_MESSAGE . This replicates the DeleteMessage WebSocket operation in the Amazon IVS Chat Messaging API.

See also: AWS API Documentation

Request Syntax

client.delete_message(
    id='string',
    reason='string',
    roomIdentifier='string'
)
type id

string

param id

[REQUIRED]

ID of the message to be deleted. This is the Id field in the received message (see Message (Subscribe) in the Chat Messaging API).

type reason

string

param reason

Reason for deleting the message.

type roomIdentifier

string

param roomIdentifier

[REQUIRED]

Identifier of the room where the message should be deleted. Currently this must be an ARN.

rtype

dict

returns

Response Syntax

{
    'id': 'string'
}

Response Structure

  • (dict) --

    • id (string) --

      Operation identifier, generated by Amazon IVS Chat.