Hello!
Currently, I’m developing an custom app that will perform a simple task:
Inside freshdesk instance A, there will be an input box to write an ID. The app must simply take this ID and retrieve the ticket informations from freshdesk instance B (both are freshdesk instances).
This is the current setup:
→ app.js
client.request.invokeTemplate("ticketsById", {
context: {
"ticket_id": text
}
})
.then((res) => console.log(res.response))
.catch((err) => console.log(err));
→ iparams.json
{
"url": {
"display_name": "URL Destino",
"description": "Please enter your URL Destino",
"type": "text",
"required": true
},
"apikey": {
"display_name": "API Key",
"description": "Please enter your API Key",
"type": "api_key",
"required": true,
"type_attributes": {
"product": "name of the product"
},
"secure": true
}
}
→ requests.json
{
"ticketsById": {
"schema": {
"method": "GET",
"host": "<%= iparam.url %>",
"path": "/api/v2/tickets/<%= context.ticket_id %>",
"headers": {
"Authorization": "Basic <%= encode(iparam.apikey) %>",
"Content-Type": "application/json"
}
},
"options": {}
}
}
Whenever I try to run the app, I get the error “error while substituting templates.”.
The files are named correctly and the iparams are set using the /custom_configs
The fdk.log result is simply:
2024-03-18 16:38:48.578 +0000 [debug] (e[34mdata.jse[0m) e[31mRead {"fw_101_101_freshdesk":{"fw_101_101_custom_iparams":{"__meta":{"secure":["apikey"]},"url":"appteste.freshdesk.com","apikey":"********(redacted)**********"}}}e[0m
2024-03-18 16:38:48.579 +0000 [debug] (e[34mrequest.jse[0m) e[31merror while validating schema for ticketsByIde[0m
2024-03-18 16:38:50.174 +0000 [debug] (e[34mcoverage.jse[0m) e[31mWriting coverage.e[0m
But in the response, I get:
Any help would be appreciated, it seems like it might be a simple fix, however I cannot pinpoint the issue, as I am a pretty new Freshworks Developer.
Thanks!