This is a sample internal integration for Sentry that assigns new issues to users, round-robin style -- based on the users attached to a project at the time you start the server, this app will cycle through the users, assigning each new issue to a different user until everyone has been assigned. After each cycle, the list of users is reset and repeats again in the same order.
Note: This first version currently works for only one project at a time. You'll need to copy the project ID into your .env
to configure (see setup steps below).
Local setup:
-
Set up and run ngrok. (Note: This of course works best with a stable ngrok URL! Otherwise, you'll need to update the Sentry integration's webhook each time you restart ngrok.)
-
Clone this repository.
-
Run
yarn install
ornpm install
to install the dependencies. -
In the folder for this repo, change the name of the
.env-sample
file to.env
.
Create a new internal integration in your Sentry organization:
-
In the Sentry UI for your account, navigate to
Settings > Developer Settings > New Internal Integration
. -
Give the integration a title (for example, Round Robin Issue Assignment).
-
Copy your ngrok URL into the "Webhook URL" field.
-
Set the required permissions: "Issue & Event" requires
Read & Write
, and "Organization" requiresRead
. -
Check the box for "issue" under the "Webhooks" section to be notified when issued are created, resolved, or assigned.
-
Press "Save Changes" on the bottom right
-
From the bottom of the "Internal Integrations" page in the Sentry UI, under the "Tokens" section, copy the integration's token -- you'll need to paste this into your
.env
file next.
Set environment variables in the .env
file:
Note: remember to change the name of the .env-sample
file to .env
.
-
SENTRY_TOKEN=yourtokenhere
-- Paste your integration's token (see previous step above). -
SENTRY_ORG
-- Copy your organization name from the Sentry UI underSettings > General
under "Name". -
SENTRY_DSN
-- Copy the DSN for your chosen project fromSettings > Projects > Your Project > Client Keys (DSN)
. -
SENTRY_PROJECT_ID
-- You can get your project ID by going toProjects
in the Sentry UI, clicking on your chosen project, and copying the ID from the end of the URL; for example,sentry.io/organizations/yourorg/issues/?project=1234567
. -
PORT
-- Enter the port number for your local Node.js server (for example,8000
).
Run it!
-
Make sure ngrok is running (and that it matches the webhook URL you entered for your internal integration in the Sentry UI).
-
Run
yarn start
ornpm start
to start the server. Create a brand new issue in your chosen Sentry project to test it out; within a couple minutes, the issue should be assigned to one of that project's users!
This app uses Jest for tests. Run the tests via the console with yarn test
or npm run test
.