How trigger/append POST api after 'save&approve"?

It’s possibile to trigger a function (to send POST api to outside server), automatically after I “save and approve” a NEWS content by admin console ??

I create a specific widget (js class routine) insert into web page with admin rule …it’s run very well but I need to insert news content twice…in admin console and reply it manually in frontend page…

mny tnks
gpaolo

Hi @ggrisandi
thank you for reaching us, I’m checking with the team about how we can help you to achieve your goal. But first, let me have a better understanding.

If I understood well, you want to trigger a function (send a POST request) when any new content is updated and approved.

However, could you please clarify the last part of the message, because I’m not sure to understand well the issue here. It will help me also to ensure I can answer you without forgetting information.

Thank you,

Anthony

Mny tnks Anthony for quick replay…and sorry for my poor english…

about your clarify request:

my goal is send out last news to broadcast channel when i approve new content…or build a procedure to select and send out my news by admin console…

my temporary solution by front-end (i’m admin user without access to server side)…was to create a web page with admin rule …not freeaccess…and use my widget with html form for paste title+msg+url and javascript code for send a POST request to outside server…it works but is not friendly usable…
after insert and approve news content in back-end, I need to go in front-end page for paste news content into the form for POST request

thank you
gpaolo

hey @ggrisandi
thanks for the further details.
I have a better understanding now. The best solution would be to have a microservice that can automatically check for recently created and validated news and then send them automatically.

Does having no server-side access mean you can’t deploy microservices with bundles?

I’m checking with the team about what can solutions we can suggest to you. Stay tuned.

Anthony

mny tnks Anthony for your attention…

yes, I cannot deploy microservice…my site is provided by an external supplier and I haven’t access to server…
in the meantime I continue my experimentation…

Gpaolo

So, considering the context (no access to the server and not on Entando v7+), I can suggest still using a widget and trying to reduce the manual steps.

The idea is to build one or two widgets to:
1/ retrieve the latest approved news
2/ Select the one you want to broadcast to an external API

Instead of having a form that is used to copy ad past content to then send it.
This is not exactly a fully automated solution but I’m not sure we can do it without any backend service.

The steps you need to execute are:
1/ ensure you can have access to the Entando APIs: https://developer.entando.com/v7.1/docs/consume/entando-apis.html#overview
2/ invoke the Entando Core APIs: https://developer.entando.com/v7.1/tutorials/devops/invoking-api.html#prerequisites

I suggest using Postman for testing because it can help you to save time, then when you know how to proceed you can migrate that calling process to a JS widget and deploy it to your application.

Finally, you will have a behavior close to your actual implementation but with one call to get the content from Entando APIs and another one to send it to your targetted API but a better user experience by using a one-click implementation.

I hope that solution could help you solve your issue.

Hi Anthony, thanks for the reply

my final solution is as you suggested…
I wrote a widget that lists the latest news and if I select one with a click … will sends the API directly to the telegram channel …

the only drawback is an internal page of the site and not a page inside back office admin console menu…

Merry Christmas to Entando forum
GPaolo