Skip to content

notify_workers

notify_workers(
    subject: String,
    message_text: String,
    worker_ids: CustomerIdList,
    *,
    config_overrides: Optional[MTurkClientConfig] = None,
) -> NotifyWorkersResponse

The NotifyWorkers operation sends an email to one or more Workers that you specify with the Worker ID. You can specify up to 100 Worker IDs to send the same message with a single call to the NotifyWorkers operation. The NotifyWorkers operation will send a notification email to a Worker only if you have previously approved or rejected work from the Worker.

Parameters:

  • subject (String) –

    The subject line of the email message to send. Can include up to 200 characters.

  • message_text (String) –

    The text of the email message to send. Can include up to 4,096 characters

  • worker_ids (CustomerIdList) –

    A list of Worker IDs you wish to notify. You can notify upto 100 Workers at a time.

Raises:

  • RequestError –

    Your request is invalid.

  • ServiceFault –

    Amazon Mechanical Turk is temporarily unable to process your request. Try your call again.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_mturk/_services/m_turk.py
def notify_workers(
    self,
    subject: "capo_mturk.types.string.String",
    message_text: "capo_mturk.types.string.String",
    worker_ids: "capo_mturk.types.customer_id_list.CustomerIdList",
    *,
    config_overrides: Optional[MTurkClientConfig] = None,
) -> "capo_mturk.types.notify_workers_response.NotifyWorkersResponse":
    """<p> The <code>NotifyWorkers</code> operation sends an email to one or more Workers that you specify with the Worker ID. You can specify up to 100 Worker IDs to send the same message with a single call to the NotifyWorkers operation. The NotifyWorkers operation will send a notification email to a Worker only if you have previously approved or rejected work from the Worker. </p>

    Args:
        subject: <p>The subject line of the email message to send. Can include up to 200 characters.</p>
        message_text: <p>The text of the email message to send. Can include up to 4,096 characters</p>
        worker_ids: <p>A list of Worker IDs you wish to notify. You can notify upto 100 Workers at a time.</p>

    Raises:
        capo_mturk.errors.request_error.RequestError: <p>Your request is invalid.</p>
        capo_mturk.errors.service_fault.ServiceFault: <p>Amazon Mechanical Turk is temporarily unable to process your request. Try your call again.</p>
        capo_mturk.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_mturk.types.notify_workers_request.NotifyWorkersRequest]",
    ) -> OperationResponse[
        "capo_mturk.types.notify_workers_response.NotifyWorkersResponse"
    ]:
        import capo_mturk._operations.m_turk_requester_service_v20170117.notify_workers

        output, http_response = (
            capo_mturk._operations.m_turk_requester_service_v20170117.notify_workers.notify_workers(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("NotifyWorkers")
    )
    input_: capo_mturk.types.notify_workers_request.NotifyWorkersRequest = {
        "subject": subject,
        "message_text": message_text,
        "worker_ids": worker_ids,
    }

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