slackのfunction作成¶
-- Function to send a POST request to Slack
CREATE OR REPLACE FUNCTION notify_slack(message text) RETURNS void AS $$
DECLARE
response json;
BEGIN
response := http_post(
'https://hooks.slack.com/services/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',
'{"text": "' || message || '"}',
'application/json'
);
-- Optionally, log the response
RAISE NOTICE 'Slack response: %', response;
END;
$$ LANGUAGE plpgsql;