On insert -> send http request to discord webhook

I created a function send_feedback_to_discord:
declare
  username text;
begin
  SELECT public.users.username INTO username FROM public.users WHERE id = user_uuid;
  perform net.http_post(
        url:='https://discord.com/api/webhooks/.../...',
        headers:='{"Content-Type": "application/json"}'::jsonb,
        body:=json_build_object('content', '**' || username || '**: ' || feedback)::jsonb
    );
  return;
end;


and a trigger that listens to INSERT events on feedback table.
My problem is that I am unable to choose send_feedback_to_discord as a function to call in the trigger. "Only functions that return a trigger will be displayed below".

How to proceed?

I wish to call send_feedback_to_discord function with user_id value from the new row as a parameter, when the row is inserted.
Was this page helpful?