Skip to main content
How to connect Jira to anything
Share on socials

How to connect Jira to anything

Discover how to use ScriptRunner Connect to integrate Jira with a third-party tool.
Integrating your entire system landscape is complex, but it doesn’t have to be difficult. ScriptRunner Connect brings all your integration, migration and syncs into one place.
We are proudly code first, and help you tackle the most complex integration challenges. Using a JavaScript / TypeScript code editor, you can integrate any application with a HTTP-based API.
In this tutorial, we will guide you through how to use ScriptRunner Connect’s Generic connector, so you can connect anything to, well, anything!

How to use the Generic connector

For the most popular Atlassian and non-Atlassian apps, ScriptRunner Connect offers built-in connectors.
For every other connection not covered by the built-in connectors, there’s the Generic connector. This connector can be used to integrate any application with a HTTP-based API.
In this tutorial, we’ll show you an example of how to use this Generic connector by integrating Jira with Digital Humani, a third-party tool organisations use to plant trees. Follow the steps below, or skip straight to the video demonstration at the bottom of the page.
Before we get started, we need to create workspaces and authenticate connectors for Jira Cloud. Find out how to do that in this tutorial under the sections “Create and authorise your connections” and “Create a workspace to host your scripts”.

Create your Generic API connection

1. Let's create a connection to Digital Humani. Click on the "+ create new" button.
2. Select “Generic”.
3. Give your connection a name.
4. Add in the base URL for the API you want to connect to. For the Digital Humani sandbox, we’re adding the following:
5. Digital Humani uses a token passed as a header for authentication, so we will add that. We select “Add a custom header” and define the name as “X-API-KEY” (as per the Digital Humani API documentation) and the value as our token.
6. We then add that header, save our Generic API connector configuration, and then save the connector itself. Now we have the Generic connector ready to be added to our workspace.
7. Go to your workspace and add your new Generic connection to the API connections for this workspace. If you haven’t set up your workspace yet, follow these instructions:
  • On the left-hand side menu, click on "Workspaces".
  • Click "Create new".
  • Name your workspace and click "create".
  • The page will redirect to the user interface for the workspace.
  • For more information on setting up workspaces, check out this documentation.
8. In the “OnServiceNowGenericEvent” script, import the Generic connector into the script, defining the “import name” as “DH”.
9. Now that we have the Generic connector added to the script, we can write code that communicates to its API. However, first we will create a new script called “DigitalHumaniValues”, in which we are going to define values we need to pass to the API:
export const ENTERPRISE_ID = '<Enterprise ID Value>';
export const PROJECT_ID = '<Project ID Value>';
export const USER_ID = '<User ID Value>';
export const TREE_COUNT = 1;
10. And we can reference those in our main script by importing them:
import { ENTERPRISE_ID, PROJECT_ID, USER_ID, TREE_COUNT } from '•/DigitalHumaniValues';
11. Now, add the following code outside of the main function. This code calls the Digital Humani API:
export async function plantTree(enterpriseId: string, projectId: string, user: string, treeCount: number) {
const response = await DH.fetch('/tree', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
body: JSON.stringify({
if (!response.ok) {
throw Error(`Invalid response while planting a tree: ${response.status}`);
12. Create a function called “plant tree”. This function wraps around the API call to Digital Humani to plant a tree.
13. As we are using a Generic connection, we can't use a managed API. We don't know which tools you're trying to connect to, so we are unable to parse their API successfully. Instead, we have to do a more manual call. We define the pathway of the API call, the method, the headers and the body itself. These are all structured as you would expect for an API call.
14. Next, console log out the response from Jira.
15. Now in the main function, after we console.log out the response from Jira, we call the function we just defined.
16. In this call, we pass the values we imported from the DigitalHumaniValues script: Enterprise ID, project ID, user ID and tree count.
17. Save the script.
18. Let's now test that. Go to ServiceNow, and create a new incident (as per this previous tutorial!). This will create a Jira ticket and also plant a tree. You can log into your Digital Humani Sandbox dashboard to confirm that the tree was planted.
In summary, we have used ScriptRunner Connect’s Generic connector to integrate applications with a HTTP-based API. We created a tool that listens for events from Jira and accesses a third-party API to plant a tree.

Get started with ScriptRunner Connect

With ScriptRunner Connect, you can use managed connectors for Atlassian and third-party apps to handle authentication securely, so you can focus on scripting your business logic.
Using built-in connectors for the most popular Atlassian and non-Atlassian apps, and a Generic connector for everything else, ScriptRunner Connect solves even the most complex system landscape integration needs. Choose an integration tool that lives for your complex system landscape and makes it easy to connect all of your tools. Consolidate all your integrations into one centralised hub, saving time, lowering operating costs, and reducing app proliferation.

Try it today

Explore what's possible with ScriptRunner Connect's free forever plan!
Published on 13th November, 2023
Bobby Bailey
Bobby Bailey
Share this tutorial