Hello,
I am trying to call freshdesk APIs from my serverless app running locally.
I am not sure how I can trigger the event locally or from the freshdesk portal.
I have tried dev=true to the portal, it does not work i.e. when I create a contact in freshdesk portal, it does not trigger the “OnCreateContact” event in the locally running server less app.
I am trying to run it from test server available locally.I am not sure what would be the API Key/header for the local test server.
Here is my code -
Triggering from local server -
"https://sample.freshdesk.com/api/v2/contacts/2",
{
headers: {
},
json: {
description: 'Test Description for contact'
}
}
).then(() => {
console.info('Contact updated successfully');
}, error => {
console.error('Contact updation failed');
console.error(error);
});
I am getting an error -
response:
{ code: ‘invalid_credentials’,
message: ‘You have to be logged in to perform this action.’ },
attempts: 1,
errorSource: ‘APP’ }
For testing from portal,here is the code:
payload.iparams.freshdesk_domain + "/api/v2/contacts/"+payload.data.contact.id,
{
headers: {
Authorization: "Basic <%= encode(iparam.freshdesk_api_key) %>"
},
json: {
description: 'Test Description for contact'
}
}
).then(() => {
console.info('Contact created successfully');
}, error => {
console.error('Contact updation failed');
console.error(error);
});
But the event does not trigger.
please suggest how to connect to portal to test the event and how to test locally.Thank you