A simple app built with Roda that allows basic integration between Sentry and Notion.
Once deployed and configured, each new Sentry issue will trigger a page insertion in the Notion database of your choice, while solving an issue will mark the ticket as done. Properly scheduled through an available rake task, tickets marked as done inside of Notion will sync back to Sentry to mark the corresponding issues as solved.
- In Sentry, inside
Settings
, head toDeveloper Settings
. You can then add aNew Internal Integration
. Leave the webhook URL empty for now (it will be your future production URL), but fill out a name, allowIssues and Events
withRead and Write
and check theissues
in the webhooks section. Grab your token and your client secret - Head to https://www.notion.so/my-integrations
- Add your new (internal) integration and note your Client secret.
- Now in Notion, go to your target database. Hit the
Share
button, click on the field to add someone, and you'll see your integration appear in the list. - Now, click on the
Copy link
button, paste the link somewhere and extract the database id like so :
https://www.notion.so/myworkspace/a8aec43384f447ed84390e8e42c2e089?v=...
|--------- Database ID --------|
- Now if you haven't done so already, fork this repo. Open the
create_page.rb
and theupdate_page.rb
files, and change the value of the variables accprding to the fields you actually use in your database. By default, these are set to what I personally use in my backlog DB that looks like this :
- Back to Sentry, go to your integration and set the Webhook URL to
https://your-app.com/issues
. - Create an alert rule in Sentry's Alerts section, choosing your own integration, and leaving filters blank
- Check out your bugs appear and disappear 🦟
- In Sentry, still in
Settings
, create anAuth token
in the API section and add it as an environment variable in production asSENTRY_API
- The task is available through the command
rake resolve_issues
. Just a use any scheduler/cron job to launch it as often as you wish. Basically, this will look at the issues marked as done in the last 24 hours and will mark them asresolved
in Sentry.
To run the server, run rerun rackup
To be able to route Sentry's webhook to your localhost, you'll need something like https://webhookrelay.com/ to run alongside your server. You'll also have to either add a new Sentry Integration with the webhookrelay URL as Webhook URL
, or temporarily change the one in your current integration.
Add your environment variables in a .env.rb
file like so :
ENV["SENTRY_TOKEN"] = "YOUR_TOKEN_HERE"
ENV["SENTRY_SECRET"] = "YOUR_SECRET_HERE"
ENV["NOTION_SECRET"] = "NOTION_SUPER_SECRET_TOKEN"
ENV["NOTION_DB"] = "NOTION_DB_ID"