Skip to content

linear/linear-agent-demo

Repository files navigation

Linear Agent Demo

This is an example framework for getting started building an agent on Cloudflare that can respond to actions inside of Linear.

Getting started

  1. Clone the repo directly & install dependencies: npm install

Production

  1. Deploy to Cloudflare npm run deploy
  2. Generate a OpenAI API key and note value.
  3. 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
wrangler secret put LINEAR_CLIENT_ID
wrangler secret put LINEAR_CLIENT_SECRET
wrangler secret put LINEAR_WEBHOOK_SECRET
wrangler secret put OPENAI_API_KEY
  1. Set up a KV namespace
    • Create the KV namespace: wrangler kv:namespace create "LINEAR_TOKENS"
    • Note the ID
  2. Update the wrangler.jsonc file with the KV ID, Linear Client ID, and URL
  3. Deploy with npm run deploy

Development

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

Usage

Endpoints

  • GET /oauth/authorize triggers the OAuth flow with Linear and generates an actor=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 token
  • POST /webhook is the endpoint at which your OAuth app will receive webhooks from Linear.

Suggested flow

  • 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

About

Demo Linear agent that responds to app user webhooks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •