Skip to content

create_whats_app_message_template_from_library

create_whats_app_message_template_from_library(
    meta_library_template: MetaLibraryTemplate,
    id: LinkedWhatsAppBusinessAccountId,
    *,
    config_overrides: Optional[SocialMessagingClientConfig] = None,
) -> CreateWhatsAppMessageTemplateFromLibraryOutput

Creates a new WhatsApp message template using a template from Meta's template library.

Parameters:

  • meta_library_template (MetaLibraryTemplate) –

    The template configuration from Meta's library, including customizations for buttons and body text.

  • id (LinkedWhatsAppBusinessAccountId) –

    The ID of the WhatsApp Business Account to associate with this template.

Raises:

Source code in docs_src/capo_socialmessaging/_services/social_messaging.py
def create_whats_app_message_template_from_library(
    self,
    meta_library_template: "capo_socialmessaging.types.meta_library_template.MetaLibraryTemplate",
    id: "capo_socialmessaging.types.linked_whats_app_business_account_id.LinkedWhatsAppBusinessAccountId",
    *,
    config_overrides: Optional[SocialMessagingClientConfig] = None,
) -> "capo_socialmessaging.types.create_whats_app_message_template_from_library_output.CreateWhatsAppMessageTemplateFromLibraryOutput":
    """<p>Creates a new WhatsApp message template using a template from Meta's template library.</p>

    Args:
        meta_library_template: <p>The template configuration from Meta's library, including customizations for buttons and body text.</p>
        id: <p>The ID of the WhatsApp Business Account to associate with this template.</p>

    Raises:
        capo_socialmessaging.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_socialmessaging.errors.validation_exception.ValidationException: <p>The request contains an invalid parameter value. </p>
        capo_socialmessaging.errors.access_denied_by_meta_exception.AccessDeniedByMetaException: <p>You do not have sufficient access to perform this action.</p>
        capo_socialmessaging.errors.dependency_exception.DependencyException: <p>Thrown when performing an action because a dependency would be broken.</p>
        capo_socialmessaging.errors.internal_service_exception.InternalServiceException: <p>The request processing has failed because of an unknown error, exception, or failure.</p>
        capo_socialmessaging.errors.invalid_parameters_exception.InvalidParametersException: <p>One or more parameters provided to the action are not valid.</p>
        capo_socialmessaging.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource was not found.</p>
        capo_socialmessaging.errors.throttled_request_exception.ThrottledRequestException: <p>The request was denied due to request throttling.</p>
        capo_socialmessaging.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_socialmessaging.types.create_whats_app_message_template_from_library_input.CreateWhatsAppMessageTemplateFromLibraryInput]",
    ) -> OperationResponse[
        "capo_socialmessaging.types.create_whats_app_message_template_from_library_output.CreateWhatsAppMessageTemplateFromLibraryOutput"
    ]:
        import capo_socialmessaging._operations.social_messaging.create_whats_app_message_template_from_library

        output, http_response = (
            capo_socialmessaging._operations.social_messaging.create_whats_app_message_template_from_library.create_whats_app_message_template_from_library(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateWhatsAppMessageTemplateFromLibrary"),
    )
    input_: capo_socialmessaging.types.create_whats_app_message_template_from_library_input.CreateWhatsAppMessageTemplateFromLibraryInput = {
        "meta_library_template": meta_library_template,
        "id": id,
    }

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