Hello,
I’m trying to migrate our app to platform version 2.3 and I get error
Error while substituting templates
while trying to test onAppInstall event after running fdk run command.
I’ve read all the similar topics here and tried many things considering authorization and so on but nothing helped.
Error I’m getting in the terminal is:
{
status: 400,
headers: {},
response: 'error while substituting templates.',
errors: {},
errorSource: 'APP',
attempts: 1
}
I’m also attaching screenshot and a code snippet of how this error looks in browser dev tools:
{
"requestID": "e6249a6d-cffe-4331-8521-997794b9f7a6",
"status": 400,
"message": "The error should be a JSON Object with a message or a status parameter.",
"errorSource": "APP"
}
My manifest.json is:
{
"platform-version": "2.3",
"product": {
"freshdesk": {
"events": {
"onConversationCreate": {
"handler": "onConversationCreateHandler"
},
"onAppInstall": {
"handler": "onAppInstallHandler"
},
"onAppUninstall": {
"handler": "onAppUninstallHandler"
}
},
"requests": {
"onConversationCreate":{},
"onAppInstall":{},
"onAppUninstall":{}
},
"location": {
"ticket_sidebar": {
"url": "index.html",
"icon": "logo.png"
}
}
}
},
"engines": {
"node": "18.20.4",
"fdk": "9.1.2"
}
}
My onAppInstall event part of requests.json is
"onAppInstall": {
"schema": {
"method": "POST",
"protocol": "https",
"host": "<%= iparams.url %>",
"path": "/api/v1/webhook/freshdesk",
"headers": {
"X-ACCOUNT-KEY": "<%= iparams.account_key %>",
"Authorization": "Basic <%= encode(iparams.apiKey) %>",
"Content-Type": "application/json"
}
}
}
My test data of onAppInstall.json is:
{
"iparams": {
"integrations": {
"id": "83f35397-41c9-4ee7-8545-0af663b993a8",
"name": "Redlinebrand ProdTest",
"status": "Active"
},
"account_key": "57c28612-c96d-487f-9ddd-7c9db8f3040e",
"url": "channels-staging.ocdn.cloud",
"valid": true,
"apiKey": "XXX"
},
"domain": "d3v-ontec.freshdesk.com",
"timestamp": 1721892446493,
"region": "US",
"account_id": "946460",
"event": "onAppInstall",
"headers": {
"Content-Type": "application/json"
}
}
My server.js part for this event is:
onAppInstallHandler: async function (payload) {
try {
await $request.invokeTemplate(event, {
body: JSON.stringify(payload)
});
renderData();
}
catch (e) {
console.error('EventError', e, payload);
renderData(JSON.stringify(payload));
}
},

