Skip to content

create_slack_channel_configuration async

create_slack_channel_configuration(
    slack_team_id: SlackTeamId,
    slack_channel_id: SlackChannelId,
    iam_role_arn: Arn,
    configuration_name: ConfigurationName,
    *,
    config_overrides: Optional[AsyncchatbotClientConfig] = None,
    slack_channel_name: Optional[SlackChannelDisplayName] = None,
    sns_topic_arns: Optional[SnsTopicArnList] = None,
    logging_level: Optional[CustomerCwLogLevel] = None,
    guardrail_policy_arns: Optional[GuardrailPolicyArnList] = None,
    user_authorization_required: Optional[BooleanAccountPreference] = None,
    tags: Optional[Tags] = None,
) -> CreateSlackChannelConfigurationResult

Creates an AWS Chatbot confugration for Slack.

Parameters:

  • slack_team_id (SlackTeamId) –

    The ID of the Slack workspace authorized with AWS Chatbot.

  • slack_channel_id (SlackChannelId) –

    The ID of the Slack channel.

    To get this ID, open Slack, right click on the channel name in the left pane, then choose Copy Link. The channel ID is the 9-character string at the end of the URL. For example, ABCBBLZZZ.

  • slack_channel_name (Optional[SlackChannelDisplayName], default: None ) –

    The name of the Slack channel.

  • sns_topic_arns (Optional[SnsTopicArnList], default: None ) –

    The Amazon Resource Names (ARNs) of the SNS topics that deliver notifications to AWS Chatbot.

  • iam_role_arn (Arn) –

    A user-defined role that AWS Chatbot assumes. This is not the service-linked role.

    For more information, see IAM policies for AWS Chatbot in the AWS Chatbot Administrator Guide.

  • configuration_name (ConfigurationName) –

    The name of the configuration.

  • logging_level (Optional[CustomerCwLogLevel], default: None ) –

    Logging levels include ERROR, INFO, or NONE.

  • guardrail_policy_arns (Optional[GuardrailPolicyArnList], default: None ) –

    The list of IAM policy ARNs that are applied as channel guardrails. The AWS managed AdministratorAccess policy is applied by default if this is not set.

  • user_authorization_required (Optional[BooleanAccountPreference], default: None ) –

    Enables use of a user role requirement in your chat configuration.

  • tags (Optional[Tags], default: None ) –

    A map of tags assigned to a resource. A tag is a string-to-string map of key-value pairs.

Raises:

Source code in docs_src/capo_chatbot/_services/async_chatbot.py
async def create_slack_channel_configuration(
    self,
    slack_team_id: "capo_chatbot.types.slack_team_id.SlackTeamId",
    slack_channel_id: "capo_chatbot.types.slack_channel_id.SlackChannelId",
    iam_role_arn: "capo_chatbot.types.arn.Arn",
    configuration_name: "capo_chatbot.types.configuration_name.ConfigurationName",
    *,
    config_overrides: Optional[AsyncchatbotClientConfig] = None,
    slack_channel_name: Optional[
        "capo_chatbot.types.slack_channel_display_name.SlackChannelDisplayName"
    ] = None,
    sns_topic_arns: Optional[
        "capo_chatbot.types.sns_topic_arn_list.SnsTopicArnList"
    ] = None,
    logging_level: Optional[
        "capo_chatbot.types.customer_cw_log_level.CustomerCwLogLevel"
    ] = None,
    guardrail_policy_arns: Optional[
        "capo_chatbot.types.guardrail_policy_arn_list.GuardrailPolicyArnList"
    ] = None,
    user_authorization_required: Optional[
        "capo_chatbot.types.boolean_account_preference.BooleanAccountPreference"
    ] = None,
    tags: Optional["capo_chatbot.types.tags.Tags"] = None,
) -> "capo_chatbot.types.create_slack_channel_configuration_result.CreateSlackChannelConfigurationResult":
    """<p>Creates an AWS Chatbot confugration for Slack.</p>

    Args:
        slack_team_id: <p>The ID of the Slack workspace authorized with AWS Chatbot.</p>
        slack_channel_id: <p>The ID of the Slack channel.</p> <p>To get this ID, open Slack, right click on the channel name in the left pane, then choose Copy Link. The channel ID is the 9-character string at the end of the URL. For example, ABCBBLZZZ. </p>
        slack_channel_name: <p>The name of the Slack channel.</p>
        sns_topic_arns: <p>The Amazon Resource Names (ARNs) of the SNS topics that deliver notifications to AWS Chatbot.</p>
        iam_role_arn: <p>A user-defined role that AWS Chatbot assumes. This is not the service-linked role.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/chatbot/latest/adminguide/chatbot-iam-policies.html">IAM policies for AWS Chatbot</a> in the <i> AWS Chatbot Administrator Guide</i>. </p>
        configuration_name: <p>The name of the configuration.</p>
        logging_level: <p>Logging levels include <code>ERROR</code>, <code>INFO</code>, or <code>NONE</code>.</p>
        guardrail_policy_arns: <p>The list of IAM policy ARNs that are applied as channel guardrails. The AWS managed <code>AdministratorAccess</code> policy is applied by default if this is not set. </p>
        user_authorization_required: <p>Enables use of a user role requirement in your chat configuration.</p>
        tags: <p>A map of tags assigned to a resource. A tag is a string-to-string map of key-value pairs.</p>

    Raises:
        capo_chatbot.errors.conflict_exception.ConflictException: <p>There was an issue processing your request.</p>
        capo_chatbot.errors.create_slack_channel_configuration_exception.CreateSlackChannelConfigurationException: <p>We can’t process your request right now because of a server issue. Try again later.</p>
        capo_chatbot.errors.invalid_parameter_exception.InvalidParameterException: <p>Your request input doesn't meet the constraints required by AWS Chatbot.</p>
        capo_chatbot.errors.invalid_request_exception.InvalidRequestException: <p>Your request input doesn't meet the constraints required by AWS Chatbot.</p>
        capo_chatbot.errors.limit_exceeded_exception.LimitExceededException: <p>You have exceeded a service limit for AWS Chatbot.</p>
        capo_chatbot.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_chatbot.types.create_slack_channel_configuration_request.CreateSlackChannelConfigurationRequest]",
    ) -> AsyncOperationResponse[
        "capo_chatbot.types.create_slack_channel_configuration_result.CreateSlackChannelConfigurationResult"
    ]:
        import capo_chatbot._operations.wheatley_orchestration_20171011.create_slack_channel_configuration

        (
            output,
            http_response,
        ) = await capo_chatbot._operations.wheatley_orchestration_20171011.create_slack_channel_configuration.async_create_slack_channel_configuration(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_chatbot.types.create_slack_channel_configuration_request.CreateSlackChannelConfigurationRequest",
    ) -> dict[str, Any]:
        import capo_chatbot.types.create_slack_channel_configuration_request

        return capo_chatbot.types.create_slack_channel_configuration_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_chatbot.types.create_slack_channel_configuration_result.CreateSlackChannelConfigurationResult",
    ) -> dict[str, Any]:
        import capo_chatbot.types.create_slack_channel_configuration_result

        return capo_chatbot.types.create_slack_channel_configuration_result.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateSlackChannelConfiguration",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_chatbot.types.create_slack_channel_configuration_request.CreateSlackChannelConfigurationRequest = {
        "slack_team_id": slack_team_id,
        "slack_channel_id": slack_channel_id,
        "iam_role_arn": iam_role_arn,
        "configuration_name": configuration_name,
    }
    if slack_channel_name is not None:
        input_["slack_channel_name"] = slack_channel_name
    if sns_topic_arns is not None:
        input_["sns_topic_arns"] = sns_topic_arns
    if logging_level is not None:
        input_["logging_level"] = logging_level
    if guardrail_policy_arns is not None:
        input_["guardrail_policy_arns"] = guardrail_policy_arns
    if user_authorization_required is not None:
        input_["user_authorization_required"] = user_authorization_required
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output