Get data submitted by POST

Hi everyone! I’m new to using http-functions and am unable to figure out how to get the data submitted by a third party.

Here’s my code (http-functions.js)

//Truecaller
export function use_TruecallerAuth ( request ) {
console . log ( request ) //Not getting what I should be getting
console . log ( response ) //[null]
let options = {

    "headers" : { 

        "Content-Type" :  "application/json" 

    } 
} 
**return**  ok ( options ) 

}

The data is submitted by POST on https://www.syllabuzz.in/_functions/TruecallerAuth

I see something in Logs when the data is submitted but am unable to get what I expect.

The expected response I need (below the para.):

FROM THE DOCS OF 3rd PARTY-------
Once the user approves the verification on your app with their Truecaller profile ( by clicking the ‘Continue’ button on the dialog ), we will immediately post the user’s accessToken and the requestID to your Callback endpoint. The sample response format would look like below :

{"requestId":"RL8YZ41FQMt5Jiak2sc_Ys0OgQA=","accessToken":"a1asX--8_yw-OF--E6Gj_DPyKelJIGUUeYB9U9MJhyeu4hOCbrl","endpoint":"https://profile4-noneu.truecaller.com/v1/default"}

More info on how it’s submitted and the expected response is here (docs of 3rd party)

Thanks in advance!
Happy 2023!!

Try:

export function use_TruecallerAuth(request) {
    let options = {
        "headers": {
           "Content-Type": "application/json"
           "Access-Control-Allow-Methods": "POST"
        }
    }
return request.body.json()
.then(body => {
console.log("request_body", body);
// do whatever you want with the body, for example insert it to the database. then:
  return ok(options)
})
  .catch(err => {
options.body = {"error": err};
return badRequest(options);
})
}

It worked! Thankyou so much!! @J.D.

Same issue I have, not able to store the response, as i am using react js. pleaes help