DEV Community

Alan Lee
Alan Lee

Posted on • Updated on • Originally published at

Recurring Jira tickets with Reshuffle

If you’re using Jira and have projects with repeating tickets that need to be added monthly, weekly or even daily, you know it can require painstaking manual labor to administer to all relevant projects, using up valuable time instead of solving the bigger problems. You could spend an hour or more configuring a system to automate this or even pay for a plugin on Jira, but, there is an easier way of doing this...and it's free!

How? Simply use Reshuffle connectors to easily create the integration.

How to Build It

Reshuffle makes it easy to build integrations that complete complex tasks, so you can deliver unique experiences and outcomes for the business and for customers.

Reshuffle is an open source, lightweight, and event-driven framework that helps you integrate services — these integrations and workflows are created inside a Reshuffle App. The objects that let you interact with these services are called connectors.

Imagine you want a recurring issue to remind you to check npm dependencies every week. Creating the issue manually can become tiresome. In this example, you'll see how simple it is to use the Cron connector as a scheduler to automate the creation of recurring Jira tickets every predefined period of time.

See links for full documentation:
Atlassian Jira Connector
Cron Connector

const app = new Reshuffle()
const jira = new JiraConnector(
   app, {
       host: process.env.HOST, // Your Jira instance url
       protocol: process.env.JIRA_PROTOCOL, // ‘http’ or ‘https’
       username: process.env.JIRA_USERNAME, // username or email
       password: process.env.JIRA_TOKEN,
       baseURL:  process.env.RUNTIME_BASE_URL

const cronConnector = new CronConnector(app)
Enter fullscreen mode Exit fullscreen mode

Now that we have the connectors configured, we need to find the project and issue type IDs using the Jira Connector actions. These IDs will be used later on to create the new ticket.

const project = await jira.sdk().getProject("YOUR PROJECT NAME");
const { id: projectId, issueTypeId = project.issueTypes[0].id } = project;
//issueTypes[0] are regular tasks on jira
Enter fullscreen mode Exit fullscreen mode

Next, we’ll create a function to check if the recurring ticket already exists on the board. This will ensure that there won’t be any duplicates created.

const checkIssues = async () => {
    const boardIssues = await jira.sdk().getIssuesForBoard(1);
    for (const issue of boardIssues.issues) {
      const { fields } = issue;
     if (
        fields.summary === "CHECK NPM DEPENDENCIES" && !== "Done"
      ) {
        return true;
      } else {
    return false;
Enter fullscreen mode Exit fullscreen mode

Reshuffle is an events-based system, and you develop code to handle these events. The cron connector can be used to fire an event every "x" amount of time, which lets us check the issues periodically. If you’re unfamiliar with these expressions, visit to help generate one.

//this expression is set to every minute, just to see if everything is working properly
cronConnector.on({ expression: "1 * * * * *" }, async (event, app) => {
  const foundIssue = await checkIssues();
  if (!foundIssue) {
    const recurringIssue = {
      fields: {
        project: { id: projectId },
        issuetype: { id: issueTypeId },
        summary: "CHECK NPM DEPENDENCIES",
        description: "Recurring Issue - Every 1 minute",
    await jira.sdk().addNewIssue(recurringIssue);
    console.log("Issue created");
  } else {
    console.log("Issue already exists");

Enter fullscreen mode Exit fullscreen mode

Inside the event handler, we use the function created earlier to check if the task already exists. If it doesn’t, we create a new one using the Jira connector action.

Lastly, let's initiate the integration by starting the Reshuffle App:

Enter fullscreen mode Exit fullscreen mode

See how easy it is? You can do this so quickly and really make it much easier to automate recurring Jira tickets without having to pay for plugins or searching through the community boards for hour-long solutions.

Now, Make it Happen

As your developers and project management teams experience the ease of working with integrated applications, we encourage you to consider where else integrating workflows would benefit your teams. With so many different tools, the more you can consolidate them into one common interface, the easier people can get work done.

Reshuffle is continually listening to what our customers need and desire. Don’t see a Connector to a service you’d like to integrate? Send a tweet to @ReshuffleHQ to let us know which Connector you’d like us to develop next.

Top comments (0)