Install Recase

Install Recase in your project by running the following command:

npx recaseai init

A workflow.ts file will be created in your project. This is where we’ll write our workflow.

Defining inputs

Inputs are the fields that are required to run your workflow. In this case, we’ll need:

  1. A feature request to summarize
  2. A priority value.
export default recase.workflow({
  id: "Summarize and send issue to linear",
  inputs: {
    featureRequest: {
      name: "Feature Request", 
      type: "string",
    },
    priority: {
      name: "Priority",
      type: "string", 
    }
  }
});

Building the workflow

Now we’ll write our script to summarize the feature request and create an issue in Linear. You can use any LLM and API service you like, and store your API keys in environment variables. Here we’ll use Anthropic and Linear.

import recase from "recaseai";
import { LinearClient } from "@linear/sdk";

// Initialize Linear client
const linearClient = new LinearClient({
  apiKey: process.env.LINEAR_API_KEY
});


export default recase.workflow({
  //Workflow name and inputs as defined above
  id: "Create a Linear issue",
  inputs: {
    featureRequest: {
      name: "Feature Request",
      type: "string",
    },
    priority: {
      name: "Priority",
      type: "string",
    },
  },

  run: async ({ inputs }: any) => {
    // Summarise the feature request into a brief, clear issue title
    const issueTitle = await recase.llm({
      message: `Summarize this feature request into a brief, clear issue title (max 10 words): "${inputs.featureRequest}"`,
      model: 'claude-3-5'
    })
    recase.log("Summarised title: ", issueTitle)

    // Create the issue in Linear
    await linearClient.createIssue({
      title: issueTitle,
      description: inputs.featureRequest,
      priority: parseInt(inputs.priority),
      teamId: process.env.LINEAR_TEAM_ID || ''
    });

    // Log a success message
    recase.log('Issue created!')    
  },
});

Deploying

To deploy our workflow, we’ll use the recase deploy command in your terminal.

npx recase deploy --file workflow.ts

You can create and deploy multiple workflow files in your project.

Running your workflow

Workflows can be run via the Recase UI, via API or invoked via natural language on Slack. Here we’ll connect to Slack and run the workflow from there.

1

Connect to Slack

Go to your Recase dashboard and click “Connect to Slack”. Follow the prompts to authorize Recase in your workspace.

2

Run workflow with slash command

In any Slack channel, type /rc followed by your request. Recase will search for a matching workflow and execute it. For example: /rc add to backlog feature request to export data to CSV for our testing product--p1.

3

View workflow results

Recase will confirm the workflow has started. View the workflow logs in the Recase Dashboard, and the issue in Linear.

Questions? Chat to us about anything at founders@recaseai.com 😄