-->
Create a slack channel in your workspace where the notifications will be displayed (ex. “notifications”)
Visit the Slack API webpage and “Create New App”. Give the app a name and select the Slack workspace you’re working with.
Select “Incoming Webhooks” and flip the “Active Incoming Webhooks” switch on.
Add New Webhook to Workspace and select the “notifications” channel you created before.
Copy the new Webhook URL:
Instructions can be found at Edge Functions -> Deploy a new function
This creates a function in the supabase/functions/
folder.
In the supabase
folder, add a .env
file with your Slack webhook URL:
Add the following code to the new index.ts
:
To deploy the function, run Docker Desktop and then execute this command
You should now see your function in the Edge Functions section of the Supabase dashboard:
Create Supabase webhook under database -> webhooks
Select Supabase Edge Functions as the Type
and select the edge function you just created in the “Edge Function” section:
Also add an authorization header to the webhook using the dropdown under “HTTP Headers”. If you do not do this and your edge function requires JWT authentication (the default), the function will not be called.
Copyright © 2024 Code On The Rocks. All rights reserved.