Trigger http request to make a post request in loops

Hi All,
im trying to send all my signups to our email marketing tool loops. I hav created a function and a trigger. But the data is not landing in loops 😦
any idea why?

Here is the function:
DECLARE response TEXT; -- Use TEXT instead of JSONB payload JSON; -- Variable to hold the JSON payload BEGIN RAISE NOTICE 'Payload to Loops API:'; -- Construct the JSON payload payload := json_build_object( 'email', NEW.email ); -- Log the payload being sent RAISE NOTICE 'Payload to Loops API: %', payload; BEGIN -- Send HTTP request SELECT content INTO response FROM http(('POST', 'https://app.loops.so/api/v1/contacts/create', ARRAY[http_header('Authorization', 'Bearer <api key>')], 'application/json',payload::text)::extensions.http_request); -- Log the response received RAISE NOTICE 'Response from Loops.so: %', response; EXCEPTION WHEN OTHERS THEN RAISE NOTICE 'Failed to send data to Loops.so: %', SQLERRM; END; RETURN response; END;

And here the trigger (image)

Looking forward to any help 🙂
Bildschirmfoto_2025-01-10_um_23.20.49.png
Was this page helpful?