There is a console.log on onAppInstall function that I can know if the URL has been generated and saved in Data Storage. But I also can’t see the serverless logs:
Can you confirm if this data is being accessed within the application other than installation screen?
If yes, then try to use SMI to get this data in installation screen.
Actually it seems like generateTargetUrl() function doesn’t work on Freshservice. I say it because I made an example here. I just tried to get the URL and send to Request Bin, but I don’t receive any response there:
@omarcelo, Thanks for checking this. I will try to reproduce the issue and work with app platform or Freshservice team to understand if needed to post my learnings on this thread.
Hi @omarcelo,
We found new points by debugging this topic
In frontend iparams page, the app cannot access data storage
In backend app install handler, data storage feature can be used.
Until the app install handler’s execution is done, the app is not considered as installed since the installation will be cancelled if renderData returned error.
Hope these points help you in debugging the issue.
Adding to my previous message, I had tried the following snippet which had stored the webhook ( this data cannot be accessed from the installation params page )
onAppInstallHandler: function(payload) {
console.log('DADOS DA INSTALAÇÃO >>> ', payload);
generateTargetUrl().then(function(url) {
$db.set('webhook', {'url': url}).then(function(data) {
if(data.Created) {
console.log('GRAVOU NO DATASTORAGE!!!');
renderData();
}
}, function(err) {
console.log('NÃO FOI POSSÍVEL SALVAR A URL DE WEBHOOK >>> ', err);
renderData();
});
}).fail(function(err) {
console.log('ERRO AO GERAR URL >>> ', err);
renderData();
});
}
I’ve made some tests here. I could generate, save and get the URL but I had to create a serverless app (I was trying to do it on a hybrid app, with front and back-end).
Like I said, it works fine on a hybrid app for Freshdesk. If you can make some tests on these conditions it would be nice.
Otherwise I think we can close this topic for now.