This is an example framework for getting started building an agent on Cloudflare that can respond to actions inside of Linear.
- Clone the repo directly & install dependencies:
npm install
- Deploy to Cloudflare
npm run deploy
- Generate a OpenAI API key and note value.
- Create a new Linear OAuth app (admin role required)
- For the Authorization callback URL, specify
https://linear-agent-demo.<your-subdomain>.workers.dev/oauth/callback
- Enable webhooks and the category
App notifications
- Note your Client ID, Client Secret, and Webhook Secret
- Set secrets via Wrangler
- For the Authorization callback URL, specify
wrangler secret put LINEAR_CLIENT_ID
wrangler secret put LINEAR_CLIENT_SECRET
wrangler secret put LINEAR_WEBHOOK_SECRET
wrangler secret put OPENAI_API_KEY
- Set up a KV namespace
- Create the KV namespace:
wrangler kv:namespace create "LINEAR_TOKENS"
- Note the ID
- Create the KV namespace:
- Update the
wrangler.jsonc
file with the KV ID, Linear Client ID, and URL - Deploy with
npm run deploy
Create a .dev.vars
file in your project root with with the secrets. Note that to receive webhooks from Linear you will need to use a tunnel such as ngrok.
npm install
npm run dev
GET /oauth/authorize
triggers the OAuth flow with Linear and generates anactor=app
token for your app. This token is used to interact with the Linear SDK when responding to OAuth app webhooks.GET /oauth/revoke
revokes your stored OAuth tokenPOST /webhook
is the endpoint at which your OAuth app will receive webhooks from Linear.
- Visit https://linear-agent-demo..workers.dev/oauth/authorize in a browser to go through the OAuth flow
- Once you've successfully completed OAuth, your app will begin receiving the webhooks it requested in Linear
- We've included a few simple interactions involving an agent in response to specific mention and assignment notification webhooks to get you started