We are developing an app to connect pipedrive with Freshdesk, but I am stuck with this problem: Cannot set property 'apiToken' of undefined.
Note. This is the server.js code that is running locally at server side
const pipedrive = require("pipedrive")
exports = {
getNote: async function (payload) {
try {
pipedrive.Configuration.apiToken = "XXXXXXXXXXXX"
var Personctrl = pipedrive.PersonsController
var Notasctrl = pipedrive.NotesController
const searchPerson = await Personctrl.findPersonsByName({
term: payload.email,
searchByEmail: 1
})
if (searchPerson.data && searchPerson.data.length > 0) {
for (const result of searchPerson.data) {
console.log(`${result.name} (id: ${result.id})`)
const searchResults = await Notasctrl.getAllNotes({
person_id: result.id
})
if (searchResults.data && searchResults.data.length > 0) {
const myJSON = JSON.stringify(searchResults.data)
renderData(null, myJSON)
} else {
console.log("No notes found")
}
}
} else {
console.log("No user found")
renderData(null)
}
} catch (error) {
console.log(error)
renderData(error)
}
}
}