Connect / Client / create_rule

create_rule

Connect.Client.create_rule(**kwargs)

Creates a rule for the specified Connect Customer instance.

Use the Rules Function language to code conditions for the rule.

See also: AWS API Documentation

Request Syntax

response = client.create_rule(
    InstanceId='string',
    Name='string',
    TriggerEventSource={
        'EventSourceName': 'OnPostCallAnalysisAvailable'|'OnRealTimeCallAnalysisAvailable'|'OnRealTimeChatAnalysisAvailable'|'OnPostChatAnalysisAvailable'|'OnAfterCallWorkAvailable'|'OnAfterChatWorkAvailable'|'OnEmailAnalysisAvailable'|'OnZendeskTicketCreate'|'OnZendeskTicketStatusUpdate'|'OnSalesforceCaseCreate'|'OnContactEvaluationSubmit'|'OnMetricDataUpdate'|'OnCaseCreate'|'OnCaseUpdate'|'OnSlaBreach'|'OnAlertUpdate'|'OnSchedulePublish'|'OnScheduleUpdate'|'OnScheduleTimeOffRequestActivity',
        'IntegrationAssociationId': 'string'
    },
    Function='string',
    Actions=[
        {
            'ActionType': 'CREATE_TASK'|'ASSIGN_CONTACT_CATEGORY'|'GENERATE_EVENTBRIDGE_EVENT'|'SEND_NOTIFICATION'|'CREATE_CASE'|'UPDATE_CASE'|'ASSIGN_SLA'|'END_ASSOCIATED_TASKS'|'SUBMIT_AUTO_EVALUATION'|'EXTRACT_INFORMATION',
            'TaskAction': {
                'Name': 'string',
                'Description': 'string',
                'ContactFlowId': 'string',
                'References': {
                    'string': {
                        'Value': 'string',
                        'Type': 'URL'|'ATTACHMENT'|'CONTACT_ANALYSIS'|'NUMBER'|'STRING'|'DATE'|'EMAIL'|'EMAIL_MESSAGE'|'EMAIL_MESSAGE_PLAIN_TEXT'|'EMAIL_MESSAGE_PLAIN_TEXT_REDACTED'|'EMAIL_MESSAGE_REDACTED',
                        'Status': 'AVAILABLE'|'DELETED'|'APPROVED'|'REJECTED'|'PROCESSING'|'FAILED',
                        'Arn': 'string',
                        'StatusReason': 'string'
                    }
                }
            },
            'EventBridgeAction': {
                'Name': 'string'
            },
            'AssignContactCategoryAction': {}
            ,
            'SendNotificationAction': {
                'DeliveryMethod': 'EMAIL',
                'Subject': 'string',
                'Content': 'string',
                'ContentType': 'PLAIN_TEXT',
                'Recipient': {
                    'UserTags': {
                        'string': 'string'
                    },
                    'UserIds': [
                        'string',
                    ]
                },
                'Exclusion': {
                    'UserTags': {
                        'string': 'string'
                    },
                    'UserIds': [
                        'string',
                    ]
                }
            },
            'CreateCaseAction': {
                'Fields': [
                    {
                        'Id': 'string',
                        'Value': {
                            'BooleanValue': True|False,
                            'DoubleValue': 123.0,
                            'EmptyValue': {}
                            ,
                            'StringValue': 'string'
                        }
                    },
                ],
                'TemplateId': 'string'
            },
            'UpdateCaseAction': {
                'Fields': [
                    {
                        'Id': 'string',
                        'Value': {
                            'BooleanValue': True|False,
                            'DoubleValue': 123.0,
                            'EmptyValue': {}
                            ,
                            'StringValue': 'string'
                        }
                    },
                ]
            },
            'AssignSlaAction': {
                'SlaAssignmentType': 'CASES',
                'CaseSlaConfiguration': {
                    'Name': 'string',
                    'Type': 'CaseField',
                    'FieldId': 'string',
                    'TargetFieldValues': [
                        {
                            'BooleanValue': True|False,
                            'DoubleValue': 123.0,
                            'EmptyValue': {}
                            ,
                            'StringValue': 'string'
                        },
                    ],
                    'TargetSlaMinutes': 123
                }
            },
            'EndAssociatedTasksAction': {}
            ,
            'SubmitAutoEvaluationAction': {
                'EvaluationFormId': 'string'
            },
            'ExtractInformationAction': {
                'RulesExtractionDefinitions': [
                    {
                        'Identifier': 'string'
                    },
                ]
            }
        },
    ],
    PublishStatus='DRAFT'|'PUBLISHED',
    PreEvaluationFilters={
        'AndConditions': [
            {
                'ResourceType': 'CONTACT',
                'FilterType': 'TAG',
                'FilterKey': 'string',
                'FilterValue': 'string',
                'Operator': 'EQUALS'
            },
        ]
    },
    ClientToken='string',
    Tags={
        'string': 'string'
    }
)
Parameters:
  • InstanceId (string) –

    [REQUIRED]

    The identifier of the Connect Customer instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance.

  • Name (string) –

    [REQUIRED]

    A unique name for the rule.

  • TriggerEventSource (dict) –

    [REQUIRED]

    The event source to trigger the rule.

    • EventSourceName (string) – [REQUIRED]

      The name of the event source.

    • IntegrationAssociationId (string) –

      The identifier for the integration association.

  • Function (string) –

    [REQUIRED]

    The conditions of the rule.

  • Actions (list) –

    [REQUIRED]

    A list of actions to be run when the rule is triggered.

    • (dict) –

      Information about the action to be performed when a rule is triggered.

      • ActionType (string) – [REQUIRED]

        The type of action that creates a rule.

      • TaskAction (dict) –

        Information about the task action. This field is required if TriggerEventSource is one of the following values: OnZendeskTicketCreate | OnZendeskTicketStatusUpdate | OnSalesforceCaseCreate

        • Name (string) – [REQUIRED]

          The name. Supports variable injection. For more information, see JSONPath reference in the Connect Customer Administrators Guide.

        • Description (string) –

          The description. Supports variable injection. For more information, see JSONPath reference in the Connect Customer Administrators Guide.

        • ContactFlowId (string) – [REQUIRED]

          The identifier of the flow.

        • References (dict) –

          Information about the reference when the referenceType is URL. Otherwise, null. (Supports variable injection in the Value field.)

          • (string) –

            • (dict) –

              Well-formed data on a contact, used by agents to complete a contact request. You can have up to 4,096 UTF-8 bytes across all references for a contact.

              • Value (string) –

                A valid value for the reference. For example, for a URL reference, a formatted URL that is displayed to an agent in the Contact Control Panel (CCP).

              • Type (string) – [REQUIRED]

                The type of the reference. DATE must be of type Epoch timestamp.

              • Status (string) –

                Status of the attachment reference type.

              • Arn (string) –

                The Amazon Resource Name (ARN) of the reference

              • StatusReason (string) –

                Relevant details why the reference was not successfully created.

      • EventBridgeAction (dict) –

        Information about the EventBridge action.

        Supported only for TriggerEventSource values: OnPostCallAnalysisAvailable | OnRealTimeCallAnalysisAvailable | OnRealTimeChatAnalysisAvailable | OnPostChatAnalysisAvailable | OnContactEvaluationSubmit | OnMetricDataUpdate

        • Name (string) – [REQUIRED]

          The name.

      • AssignContactCategoryAction (dict) –

        Information about the contact category action.

        Supported only for TriggerEventSource values: OnPostCallAnalysisAvailable | OnRealTimeCallAnalysisAvailable | OnRealTimeChatAnalysisAvailable | OnPostChatAnalysisAvailable | OnZendeskTicketCreate | OnZendeskTicketStatusUpdate | OnSalesforceCaseCreate

      • SendNotificationAction (dict) –

        Information about the send notification action.

        Supported only for TriggerEventSource values: OnPostCallAnalysisAvailable | OnRealTimeCallAnalysisAvailable | OnRealTimeChatAnalysisAvailable | OnPostChatAnalysisAvailable | OnContactEvaluationSubmit | OnMetricDataUpdate

        • DeliveryMethod (string) – [REQUIRED]

          Notification delivery method.

        • Subject (string) –

          The subject of the email if the delivery method is EMAIL. Supports variable injection. For more information, see JSONPath reference in the Connect Customer Administrators Guide.

        • Content (string) – [REQUIRED]

          Notification content. Supports variable injection. For more information, see JSONPath reference in the Connect Customer Administrators Guide.

        • ContentType (string) – [REQUIRED]

          Content type format.

        • Recipient (dict) – [REQUIRED]

          Notification recipient.

          • UserTags (dict) –

            The tags used to organize, track, or control access for this resource. For example, { “Tags”: {“key1”:”value1”, “key2”:”value2”} }. Connect Customer users with the specified tags will be notified.

            • (string) –

              • (string) –

          • UserIds (list) –

            A list of user IDs. Supports variable injection of $.ContactLens.ContactEvaluation.Agent.AgentId for OnContactEvaluationSubmit event source.

            • (string) –

        • Exclusion (dict) –

          Recipients to exclude from notification.

          • UserTags (dict) –

            The tags used to organize, track, or control access for this resource. For example, { “Tags”: {“key1”:”value1”, “key2”:”value2”} }. Connect Customer users with the specified tags will be notified.

            • (string) –

              • (string) –

          • UserIds (list) –

            A list of user IDs. Supports variable injection of $.ContactLens.ContactEvaluation.Agent.AgentId for OnContactEvaluationSubmit event source.

            • (string) –

      • CreateCaseAction (dict) –

        Information about the create case action.

        Supported only for TriggerEventSource values: OnPostCallAnalysisAvailable | OnPostChatAnalysisAvailable.

        • Fields (list) – [REQUIRED]

          An array of objects with Field ID and Value data.

          • (dict) –

            Object for case field values.

            • Id (string) – [REQUIRED]

              Unique identifier of a field.

            • Value (dict) – [REQUIRED]

              Union of potential field value types.

              • BooleanValue (boolean) –

                A Boolean number value type.

              • DoubleValue (float) –

                A Double number value type.

              • EmptyValue (dict) –

                An empty value.

              • StringValue (string) –

                String value type.

        • TemplateId (string) – [REQUIRED]

          A unique identifier of a template.

      • UpdateCaseAction (dict) –

        Information about the update case action.

        Supported only for TriggerEventSource values: OnCaseCreate | OnCaseUpdate.

        • Fields (list) – [REQUIRED]

          An array of objects with Field ID and Value data.

          • (dict) –

            Object for case field values.

            • Id (string) – [REQUIRED]

              Unique identifier of a field.

            • Value (dict) – [REQUIRED]

              Union of potential field value types.

              • BooleanValue (boolean) –

                A Boolean number value type.

              • DoubleValue (float) –

                A Double number value type.

              • EmptyValue (dict) –

                An empty value.

              • StringValue (string) –

                String value type.

      • AssignSlaAction (dict) –

        Information about the assign SLA action.

        • SlaAssignmentType (string) – [REQUIRED]

          Type of SLA assignment.

        • CaseSlaConfiguration (dict) –

          The SLA configuration for Case SLA Assignment.

          • Name (string) – [REQUIRED]

            Name of an SLA.

          • Type (string) – [REQUIRED]

            Type of SLA for Case SlaAssignmentType.

          • FieldId (string) –

            Unique identifier of a Case field.

          • TargetFieldValues (list) –

            Represents a list of target field values for the fieldId specified in CaseSlaConfiguration. The SLA is considered met if any one of these target field values matches the actual field value.

            • (dict) –

              Object to store union of Field values.

              • BooleanValue (boolean) –

                A Boolean number value type.

              • DoubleValue (float) –

                A Double number value type.

              • EmptyValue (dict) –

                An empty value.

              • StringValue (string) –

                String value type.

          • TargetSlaMinutes (integer) – [REQUIRED]

            Target duration in minutes within which an SLA should be completed.

      • EndAssociatedTasksAction (dict) –

        Information about the end associated tasks action.

        Supported only for TriggerEventSource values: OnCaseUpdate.

      • SubmitAutoEvaluationAction (dict) –

        Information about the submit automated evaluation action.

        • EvaluationFormId (string) – [REQUIRED]

          The identifier of the auto-evaluation enabled form.

      • ExtractInformationAction (dict) –

        Information about the extract information action.

        • RulesExtractionDefinitions (list) – [REQUIRED]

          The list of extraction definition identifiers that specify what data to extract.

          • (dict) –

            An identifier that references an extraction definition resource.

            • Identifier (string) – [REQUIRED]

              The identifier of the extraction definition.

  • PublishStatus (string) –

    [REQUIRED]

    The publish status of the rule.

  • PreEvaluationFilters (dict) –

    The pre-evaluation filters for the rule, that restrict the rule to be applied to only certain resources based on the resource’s attributes, such as tags assigned to a contact. The pre-evaluation filters are applied even before rule conditions are evaluated and are used to enforce tag-based-access-control while applying rules.

    • AndConditions (list) –

      A list of conditions that the rule evaluates together using AND logic. All conditions must be met for the event to be evaluated by the rule.

      • (dict) –

        A single pre-evaluation filter condition. Specifies a resource type, filter type, key, value, and operator to match against a resource attribute.

        • ResourceType (string) – [REQUIRED]

          The type of resource to filter on. Valid values: CONTACT.

        • FilterType (string) – [REQUIRED]

          The type of filter to apply. Valid values: TAG.

        • FilterKey (string) – [REQUIRED]

          The key of the attribute to filter on. For tag filters, this is the tag key.

        • FilterValue (string) – [REQUIRED]

          The value to match against. For tag filters, this is the tag value.

        • Operator (string) – [REQUIRED]

          The comparison operator for the filter condition. Valid values: EQUALS.

  • ClientToken (string) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see Making retries safe with idempotent APIs.

    This field is autopopulated if not provided.

  • Tags (dict) –

    The tags used to organize, track, or control access for this resource. For example, { “Tags”: {“key1”:”value1”, “key2”:”value2”} }.

    • (string) –

      • (string) –

Return type:

dict

Returns:

Response Syntax

{
    'RuleArn': 'string',
    'RuleId': 'string'
}

Response Structure

  • (dict) –

    • RuleArn (string) –

      The Amazon Resource Name (ARN) of the rule.

    • RuleId (string) –

      A unique identifier for the rule.

Exceptions