Stored Procedure
The Stored Procedure destination needs Premium. Instead of notifying a person, Monitorial Pulse calls a procedure you write, passing it the alert. Use it to log alerts to your own tables, trigger remediation, or route events into custom logic. Everything stays inside your Snowflake account, so no connection approval is needed.
Before you start
Section titled “Before you start”Create a procedure that takes exactly one argument of type OBJECT:
CREATE OR REPLACE PROCEDURE my_db.my_schema.handle_pulse_alert(alert OBJECT) RETURNS VARCHAR LANGUAGE SQLAS$$BEGIN INSERT INTO my_db.my_schema.pulse_alerts (received_at, severity, message, alert) SELECT CURRENT_TIMESTAMP(), :alert:severity::VARCHAR, :alert:message::VARCHAR, :alert; RETURN 'ok';END;$$;Create the table the example writes to before you test the procedure, or point the INSERT at a table you already have:
CREATE TABLE IF NOT EXISTS my_db.my_schema.pulse_alerts ( received_at TIMESTAMP_NTZ, severity VARCHAR, message VARCHAR, alert OBJECT);The object has the same fields a Generic Webhook receives, without timestamp.
Set up in Pulse
Section titled “Set up in Pulse”- Open Monitoring » Destinations, select Add destination, then Stored Procedure.
- Enter a name and the Procedure Name (database.schema.name), for example
my_db.my_schema.handle_pulse_alert. - Select Next. Pulse registers the procedure’s database on Access & Budgets. A Stored Procedure destination needs no connection approval, so the wizard goes straight to the Test step. Pulse can’t call the procedure until you run its grant script, so select Done now and test once the grants are in place.
- Open the destination’s Edit view. The Database access panel shows whether Pulse can call the procedure.
- Select Show grant script, copy it and run it as
ACCOUNTADMIN. - Select Re-validate access. The panel should say Grants verified — this app can call the procedure.
The grant script gives the app only USAGE on the database, the schema and that one procedure, through a database role:
USE DATABASE my_db;CREATE DATABASE ROLE IF NOT EXISTS MONITORIAL_PROC_CALLER;GRANT USAGE ON DATABASE my_db TO DATABASE ROLE MONITORIAL_PROC_CALLER;GRANT USAGE ON SCHEMA my_db.my_schema TO DATABASE ROLE MONITORIAL_PROC_CALLER;GRANT USAGE ON PROCEDURE my_db.my_schema.handle_pulse_alert(OBJECT) TO DATABASE ROLE MONITORIAL_PROC_CALLER;GRANT DATABASE ROLE my_db.MONITORIAL_PROC_CALLER TO APPLICATION <your Pulse app name>;Use the script Pulse shows you, since it already contains your names.
The script creates MONITORIAL_PROC_CALLER only if it doesn’t exist, and it then grants the whole role to Pulse. If the database already has a role with that name, Pulse is given every privilege already on it, not only the ones above. Before you run the script, run SHOW GRANTS TO DATABASE ROLE my_db.MONITORIAL_PROC_CALLER; and check that it holds nothing else. If it does, create the role under a different name. Check what is on the role again before you remove it.
Test it
Section titled “Test it”From the row menu, select Send test, choose a severity and select Send test notification. Check that your procedure ran, for example by querying the table it writes to. If the call fails, the error from your procedure is shown.
Things to know
Section titled “Things to know”- Personas don’t apply to this destination; the procedure always receives the full alert.
- A call that raises an error counts as a failed delivery and towards the delivery pause.

