Trigger strapi ui toast notification (alert) from backend(lifecycle hooks, controllers)

System Information
  • Strapi Version:4.14.2
  • Operating System: windows
  • Database: postgress
  • Node Version: v20.9.0
  • NPM Version: 10.1.0
  • Yarn Version: 1.22.19

I am writing some custom code in the backend of my strapi app. Lifecycle hook to be specific and i want to trigger notifications and show it to user. Basically i have an afterCreate lifecycle hook that gets triggered when i create a post and after creating a post I am doing some work lets say i am calling another api when i get the response i want to show it to user on the admin ui and want to show the default alert of strapi but with my message. here is the code for reference

afterCreate: async ({ result }) => {
    //gets triggered when the post is created
    //I perform an action here
    //if the action succeeds i want to show the default strapi success alert with my message
    //if the action fails i want to show the default strapi error alert with my message
  },

throw an application error Error handling | Strapi Documentation

hey @Boegie19 thanks for replying. I get that about the error alert. how to show a success message which is green that appears when you create a post. Do i use the same Application Error to show the success message?

only custom messages you can show to the user are application error messages