def METHOD_NAME(self, request, pk):
    if pk != NEW_WEBHOOK_PK:
        self.get_object()  # Check webhook exists
    template_body = request.data.get("template_body", None)
    template_name = request.data.get("template_name", None)
    payload = request.data.get("payload", None)
    if not payload:
        response = {"preview": template_body}
        return Response(response, status=status.HTTP_200_OK)
    if isinstance(payload, str):
        try:
            payload = json.loads(payload)
        except json.JSONDecodeError:
            raise BadRequest(detail={"payload": "Could not parse json"})
    if template_body is None or template_name is None:
        response = {"preview": None}
        return Response(response, status=status.HTTP_200_OK)
    if template_name not in WEBHOOK_TEMPLATE_NAMES:
        raise BadRequest(detail={"template_name": "Unknown template name"})
    try:
        result = apply_jinja_template_for_json(template_body, payload)
    except (JinjaTemplateError, JinjaTemplateWarning) as e:
        return Response({"preview": e.fallback_message}, status.HTTP_200_OK)
    response = {"preview": result}
    return Response(response, status=status.HTTP_200_OK)