AWS::IVSChat::Room MessageReviewHandler - AWS CloudFormation

AWS::IVSChat::Room MessageReviewHandler

The MessageReviewHandler property type specifies configuration information for optional message review.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "FallbackResult" : String, "Uri" : String }

YAML

FallbackResult: String Uri: String

Properties

FallbackResult

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. (For the timeout period, see Service Quotas.) 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

Required: No

Type: String

Allowed values: ALLOW | DENY

Update requires: No interruption

Uri

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

Required: No

Type: String

Pattern: ^$|^arn:aws:lambda:[a-z0-9-]+:[0-9]{12}:function:.+

Minimum: 0

Maximum: 170

Update requires: No interruption

Examples

Room Message Review Handler Template Examples

The following examples specify an Amazon IVS Chat Room with message review.

JSON

{ "AWSTemplateFormatVersion": "2010-09-09", "Resources": { "MessageReviewHandlerRole": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { "Version": "2012-10-17", "Statement": { "Effect": "Allow", "Principal": { "Service": "lambda.amazonaws.com" }, "Action": "sts:AssumeRole" } } } }, "MessageReviewHandler": { "Type": "AWS::Lambda::Function", "Properties": { "Handler": "index.handler", "Role": { "Fn::GetAtt": [ "MessageReviewHandlerRole", "Arn" ] }, "Runtime": "nodejs12.x", "Code": { "S3Bucket":"my-bucket", "S3Key": "function.zip" } } }, "MessageReviewHandlerPermission": { "Type": "AWS::Lambda::Permission", "Properties": { "Principal": "ivschat.amazonaws.com", "Action": "lambda:InvokeFunction", "FunctionName": { "Ref": "MessageReviewHandler" }, "SourceAccount": { "Ref": "AWS::AccountId" }, "SourceArn": { "Fn::Sub": "arn:${AWS::Partition}:ivschat:${AWS::Region}:${AWS::AccountId}:room/*" } } }, "Room": { "Type": "AWS::IVSChat::Room", "Properties": { "Name": "MyRoom", "MessageReviewHandler": { "FallbackResult": "ALLOW", "Uri": { "Fn::GetAtt": [ "MessageReviewHandler", "Arn" ] } } }, "DependsOn": "MessageReviewHandlerPermission" } } }

YAML

AWSTemplateFormatVersion: 2010-09-09 Resources: MessageReviewHandlerRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Version: 2012-10-17 Statement: Effect: Allow Principal: Service: lambda.amazonaws.com Action: sts:AssumeRole MessageReviewHandler: Type: AWS::Lambda::Function Properties: Handler: index.handler Role: !GetAtt MessageReviewHandlerRole.Arn Runtime: nodejs12.x Code: S3Bucket: my-bucket S3Key: function.zip MessageReviewHandlerPermission: Type: AWS::Lambda::Permission Properties: Principal: ivschat.amazonaws.com Action: lambda:InvokeFunction FunctionName: !Ref MessageReviewHandler SourceAccount: !Ref AWS::AccountId SourceArn: !Sub arn:${AWS::Partition}:ivschat:${AWS::Region}:${AWS::AccountId}:room/* Room: Type: AWS::IVSChat::Room Properties: Name: MyRoom MessageReviewHandler: FallbackResult: ALLOW Uri: !GetAtt MessageReviewHandler.Arn DependsOn: MessageReviewHandlerPermission