Skip to main content
const myHeaders = {
'Content-Type': 'application/json',
'Authorization': 'Basic XXXXXX'
};

function findGongCallByDate(when) {

const raw = JSON.stringify( {
'contentSelector': {
'context': 'None',
'exposedFields': {
'collaboration': {
'publicComments': true
},
'content': {
'pointsOfInterest': true,
'highlights': true,
'callOutcome': true,
'keyPoints': true
},
'parties': true
}
},
'filter': {
'fromDateTime': '2024-10-18T07:00:00-08:00',
'toDateTime': '2024-10-21T09:00:00-08:00'
}
} );

const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow",
muteHttpExceptions: true
};

var response = UrlFetchApp.fetch("https://api.gong.io/v2/calls/extensive", requestOptions);

console.log(response.toString());

}


function getAllGongCalls()
{
const requestOptions = {
method: "GET",
headers: myHeaders,
redirect: "follow"
};

var response = UrlFetchApp.fetch("https://api.gong.io/v2/calls", requestOptions);

console.log(response.getContentText());
}

The above code has 2 functions.

  1. getAllGongCalls - which works great.

  2. findGongCallByDate - which fails with the below error

{"requestId":"1efp7ktsac4zd2g13el","errors":["Request message not readable"]}

 

Any idea what is wrong with it?

@eran did you figure out what was going on? 

Long shot, but have you tried changing body: raw to body: json since you are passing JSON?

I verified your JSON looks good by copying and testing in Postman


This code was generated by Postman, it works just fine, only problem it’s not executing it anywhere else.

 

I even exported my posman call to curl and that worked as well as-is.

 

(I also tried your suggestion, but it had the same error message)


Reply