Skip to content

get_whats_app_call_permission

get_whats_app_call_permission(
    origination_phone_number_id: WhatsAppPhoneNumberId,
    *,
    config_overrides: Optional[SocialMessagingClientConfig] = None,
    destination_phone_number: Optional[WhatsAppDestinationPhoneNumber] = None,
    end_user_bsuid: Optional[WhatsAppBusinessScopedUserId] = None,
) -> GetWhatsAppCallPermissionOutput

Retrieves the current calling permission for a WhatsApp end user, along with the calling actions the business is allowed to take with that user. Provide the destination phone number or the business-scoped user ID to identify the end user.

Parameters:

  • origination_phone_number_id (WhatsAppPhoneNumberId) –

    The unique identifier of the business phone number for which to retrieve the calling permission. The phone number identifiers are formatted as phone-number-id-01234567890123456789012345678901.

  • destination_phone_number (Optional[WhatsAppDestinationPhoneNumber], default: None ) –

    The end user's phone number, in E.164 format, for which to retrieve the calling permission.

  • end_user_bsuid (Optional[WhatsAppBusinessScopedUserId], default: None ) –

    The business-scoped user identifier (BSUID) of the end user for which to retrieve the calling permission.

Raises:

Source code in docs_src/capo_socialmessaging/_services/social_messaging.py
def get_whats_app_call_permission(
    self,
    origination_phone_number_id: "capo_socialmessaging.types.whats_app_phone_number_id.WhatsAppPhoneNumberId",
    *,
    config_overrides: Optional[SocialMessagingClientConfig] = None,
    destination_phone_number: Optional[
        "capo_socialmessaging.types.whats_app_destination_phone_number.WhatsAppDestinationPhoneNumber"
    ] = None,
    end_user_bsuid: Optional[
        "capo_socialmessaging.types.whats_app_business_scoped_user_id.WhatsAppBusinessScopedUserId"
    ] = None,
) -> "capo_socialmessaging.types.get_whats_app_call_permission_output.GetWhatsAppCallPermissionOutput":
    """<p>Retrieves the current calling permission for a WhatsApp end user, along with the calling actions the business is allowed to take with that user. Provide the destination phone number or the business-scoped user ID to identify the end user.</p>

    Args:
        origination_phone_number_id: <p>The unique identifier of the business phone number for which to retrieve the calling permission. The phone number identifiers are formatted as <code>phone-number-id-01234567890123456789012345678901</code>.</p>
        destination_phone_number: <p>The end user's phone number, in E.164 format, for which to retrieve the calling permission.</p>
        end_user_bsuid: <p>The business-scoped user identifier (BSUID) of the end user for which to retrieve the calling permission.</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.get_whats_app_call_permission_input.GetWhatsAppCallPermissionInput]",
    ) -> OperationResponse[
        "capo_socialmessaging.types.get_whats_app_call_permission_output.GetWhatsAppCallPermissionOutput"
    ]:
        import capo_socialmessaging._operations.social_messaging.get_whats_app_call_permission

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

    def _redact_input(
        input_: "capo_socialmessaging.types.get_whats_app_call_permission_input.GetWhatsAppCallPermissionInput",
    ) -> dict[str, Any]:
        import capo_socialmessaging.types.get_whats_app_call_permission_input

        return capo_socialmessaging.types.get_whats_app_call_permission_input.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("GetWhatsAppCallPermission", redact_input=_redact_input),
    )
    input_: capo_socialmessaging.types.get_whats_app_call_permission_input.GetWhatsAppCallPermissionInput = {
        "origination_phone_number_id": origination_phone_number_id
    }
    if destination_phone_number is not None:
        input_["destination_phone_number"] = destination_phone_number
    if end_user_bsuid is not None:
        input_["end_user_bsuid"] = end_user_bsuid

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