Returning plain text from whitelisted method

Continuing the discussion from POST parameters with dots:

Just want to share this small tip

This function:

import frappe

@frappe.whitelist(allow_guest=True)
def ping():
    return "pong"

Would return {"message":"pong"}

If you just want pong do this:

import frappe
from werkzeug.wrappers import Response


@frappe.whitelist(allow_guest=True)
def ping():
    return Response('pong')

Hope this will help someone else. It has been annoying me for a year now while trying to build a Facebook Bot with frappe as backend, which expects a text as response

11 Likes

@RWEMA_Aimable thanks for the post, it helped :pray:

1 Like

You have saved my day. Thank you

Thanks for providing the details for getting the response without wrapping it around ‘message’.