Skip to content

create_notification

create_notification(
    instance_id: InstanceId,
    recipients: RecipientList,
    content: NotificationContent,
    *,
    config_overrides: Optional[ConnectClientConfig] = None,
    expires_at: Optional[Timestamp] = None,
    priority: Optional[ConfigurableNotificationPriority] = None,
    tags: Optional[TagMap] = None,
    predefined_notification_id: Optional[NotificationId] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateNotificationResponse

Creates a new notification to be delivered to specified recipients. Notifications can include localized content with links, and an optional expiration time. Recipients can be specified as individual user ARNs or instance ARNs to target all users in an instance.

Parameters:

  • instance_id (InstanceId) –

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

  • expires_at (Optional[Timestamp], default: None ) –

    The timestamp when the notification should expire and no longer be displayed to users. If not specified, defaults to one week from creation.

  • recipients (RecipientList) –

    A list of Amazon Resource Names (ARNs) identifying the recipients of the notification. Can include user ARNs or instance ARNs to target all users in an instance. Maximum of 200 recipients.

  • priority (Optional[ConfigurableNotificationPriority], default: None ) –

    The priority level of the notification. Valid values are HIGH and LOW. High priority notifications are displayed above low priority notifications.

  • content (NotificationContent) –

    The localized content of the notification. A map where keys are locale codes and values are the notification text in that locale. Content supports links. Maximum 250 characters per locale.

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

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

  • client_token (Optional[ClientToken], default: None ) –

    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.

Raises:

Source code in docs_src/capo_connect/_services/connect.py
def create_notification(
    self,
    instance_id: "capo_connect.types.instance_id.InstanceId",
    recipients: "capo_connect.types.recipient_list.RecipientList",
    content: "capo_connect.types.notification_content.NotificationContent",
    *,
    config_overrides: Optional[ConnectClientConfig] = None,
    expires_at: Optional["capo_connect.types.timestamp.Timestamp"] = None,
    priority: Optional[
        "capo_connect.types.configurable_notification_priority.ConfigurableNotificationPriority"
    ] = None,
    tags: Optional["capo_connect.types.tag_map.TagMap"] = None,
    predefined_notification_id: Optional[
        "capo_connect.types.notification_id.NotificationId"
    ] = None,
    client_token: Optional["capo_connect.types.client_token.ClientToken"] = None,
) -> "capo_connect.types.create_notification_response.CreateNotificationResponse":
    """<p>Creates a new notification to be delivered to specified recipients. Notifications can include localized content with links, and an optional expiration time. Recipients can be specified as individual user ARNs or instance ARNs to target all users in an instance.</p>

    Args:
        instance_id: <p>The identifier of the Amazon Connect instance. You can <a href="https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html">find the instance ID</a> in the Amazon Resource Name (ARN) of the instance.</p>
        expires_at: <p>The timestamp when the notification should expire and no longer be displayed to users. If not specified, defaults to one week from creation.</p>
        recipients: <p>A list of Amazon Resource Names (ARNs) identifying the recipients of the notification. Can include user ARNs or instance ARNs to target all users in an instance. Maximum of 200 recipients.</p>
        priority: <p>The priority level of the notification. Valid values are HIGH and LOW. High priority notifications are displayed above low priority notifications.</p>
        content: <p>The localized content of the notification. A map where keys are locale codes and values are the notification text in that locale. Content supports links. Maximum 250 characters per locale.</p>
        tags: <p>The tags used to organize, track, or control access for this resource. For example, <code>{ "Tags": {"key1":"value1", "key2":"value2"} }</code>.</p>
        client_token: <p>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 <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p>

    Raises:
        capo_connect.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permissions to perform this action.</p>
        capo_connect.errors.duplicate_resource_exception.DuplicateResourceException: <p>A resource with the specified name already exists.</p>
        capo_connect.errors.internal_service_exception.InternalServiceException: <p>Request processing failed because of an error or failure with the service.</p>
        capo_connect.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more of the specified parameters are not valid.</p>
        capo_connect.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_connect.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_connect.errors.throttling_exception.ThrottlingException: <p>The throttling limit has been exceeded.</p>
        capo_connect.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_connect.types.create_notification_request.CreateNotificationRequest]",
    ) -> OperationResponse[
        "capo_connect.types.create_notification_response.CreateNotificationResponse"
    ]:
        import capo_connect._operations.amazon_connect_service.create_notification

        output, http_response = (
            capo_connect._operations.amazon_connect_service.create_notification.create_notification(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateNotification")
    )
    input_: capo_connect.types.create_notification_request.CreateNotificationRequest = {
        "instance_id": instance_id,
        "recipients": recipients,
        "content": content,
    }
    if expires_at is not None:
        input_["expires_at"] = expires_at
    if priority is not None:
        input_["priority"] = priority
    if tags is not None:
        input_["tags"] = tags
    if predefined_notification_id is not None:
        input_["predefined_notification_id"] = predefined_notification_id
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output