Create a page in Confluence Cloud when an issue is created in Jira Cloud


Get Started

Not the template you're looking for? Browse more.

About the template


This template demonstrates how to create a page in Confluence Cloud when an issue is created in Jira Cloud. Summary, issue type, status, reporter, assignee, created date and description field values are copied over to Confluence page. Get started to learn more.

About ScriptRunner Connect


What is ScriptRunner Connect?

ScriptRunner Connect is an AI assisted code-first (JavaScript/TypeScript) integration platform (iPaaS) for building complex integrations and automations.

Can I try it out for free?

Yes. ScriptRunner Connect comes with a forever free tier.

Can I customize the integration logic?

Absolutely. The main value proposition of ScriptRunner Connect is that you'll get full access to the code that is powering the integration, which means you can make any changes to the the integration logic yourself.

Can I change the integration to communicate with additional apps?

Yes. Since ScriptRunner Connect specializes in enabling complex integrations, you can easily change the integration logic to connect to as many additional apps as you need, no limitations.

What if I don't feel comfortable making changes to the code?

First you can try out our AI assistant which can help you understand what the code does, and also help you make changes to the code. Alternatively you can hire our professionals to make the changes you need or build new integrations from scratch.

Do I have to host it myself?

No. ScriptRunner Connect is a fully managed SaaS (Software-as-a-Service) product.

What about security?

ScriptRunner Connect is ISO 27001 and SOC 2 certified. Learn more about our security.

Template Content


README

Scripts

TypeScriptOnJiraCloudIssueCreated
Issue Created

README


๐Ÿ“‹ Overview

This template automatically creates a new page in Confluence Cloud whenever a new issue is created in Jira Cloud.

๐Ÿ–Š๏ธ Setup

  • Configure API connections and event listeners


Set up the API connection and event listener for Confluence Cloud and Jira Cloud. You can either create new connectors or use existing ones.

  • Adjust parameters


Go to the Parameters section and configure the parameters according to your needs.

๐Ÿš€ Usage

After setup is complete, create a new issue in your Jira Cloud instance. Once the event is processed, a new page will be created under the root of the specified space key in your Confluence Cloud instance.

API Connections


TypeScriptOnJiraCloudIssueCreated

import ConfluenceCloud from './api/confluence/cloud';
import { IssueCreatedEvent } from '@sr-connect/jira-cloud/events';

/**
 * This function creates a new page in Confluence Cloud when Issue Created event is received from Jira Cloud
 *
 * @param event Object that holds Issue Created event data
 * @param context Object that holds function invocation context data
 */
export default async function (event: IssueCreatedEvent, context: Context): Promise<void> {
    if (context.triggerType === 'MANUAL') {
        console.error('This script is designed to be triggered externally or manually from the Event Listener. Please consider using Event Listener Test Event Payload if you need to trigger this script manually.');
        return;
    }

    const { SPACE_KEY } = getEnvVars(context);

    // Create a new page in confluence with a content constructed from the Issue Created event
    const page = await ConfluenceCloud.Content.createContent({
        body: {
            type: 'page',
            space: {
                key: SPACE_KEY
            },
            title: event.issue.key,
            body: {
                wiki: {
                    representation: 'wiki', // Using wiki representation because the description from Jira Cloud side comes through as wiki markup so it doesn't require any further transformation
                    value: `*Summary:* ${event.issue.fields.summary}\n*Issue Type:* ${event.issue.fields.issuetype?.name}\n*Status:* ${event.issue.fields.status?.name}\n*Reporter:* ${event.issue.fields.reporter?.displayName}\n*Assignee*: ${event.issue.fields.assignee?.displayName ?? 'Unassigned'}\n*Created Date:* ${new Date(event.issue.fields.created ?? 0).toUTCString()}\n*Description:*\n${event.issue.fields.description ?? ''}`
                }
            }
        }
    });

    // Print out the ID of the newly created page
    console.log(`Name page created: ${event.issue.key} (${page.id})`);
}

interface EnvVars {
    SPACE_KEY: string;
}

export function getEnvVars(context: Context) {
    return context.environment.vars as EnvVars;
}
Documentation ยท Support ยท Suggestions & feature requests