Skip to main content

Hey all. We have a custom installation page in which we first retreive the ticket fields for some settings. I’ve been trying to pass the Api Key as an param with invoking the template but I can’t get it to work.

 

My code now looks like this:

 

let subdomain = domain.replace(".freshdesk.com", "");
let apiKey = jQuery("#api-key").val().trim();

client.request.invokeTemplate('getTicketFields', {
body: JSON.stringify({
subdomain: subdomain,
apiKey: apiKey,
}),
})

 

And the request.json looks like this:

 

{
"getTicketFields": {
"schema": {
"protocol": "https",
"host": "<%= subdomain %>.freshdesk.com",
"path": "/api/v2/tickets",
"method": "GET",
"headers": {
"Authorization": "Basic <%= encode(apiKey) %>"
}
}
}
}

 

But I unfortunately keep receiving the error: error while substituting templates

Anybody got any idea? I already checked if subdomain and apiKey have value and they do.

Join the Community or User Group to Participate in this Discussion

Reply