Template Content
About the template
About ScriptRunner Connect
What is ScriptRunner Connect?
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.
This template fetches users from a Jira Cloud instance, transforms the users list and sends it back as JSON with the HTTP response. This template demonstrates how you can build your own API endpoints by making use of Generic Event Listener and by responding in JSON.
Grab the URL that you should have received when setting up the Generic HTTP Event Listener, open that URL in your browser, after successful event processing you should see a list of transformed users from your Jira Cloud instance in JSON format.
import { HttpEventRequest, HttpEventResponse, buildJSONResponse } from '@sr-connect/generic-app/events/http';
import JiraCloud from "./api/jira/cloud";
/**
* This function fetches users from Jira Cloud, transforms the users list and sends it back as JSON with HTTP response.
*
* @param event Object that holds Sync HTTP Event event data
* @param context Object that holds function invocation context data
*/
export default async function (event: HttpEventRequest, context: Context): Promise<HttpEventResponse> {
// Get users from jira (result is paginated which we're not traversing right now)
const users = await JiraCloud.User.getUsers();
// Pick out fields that we're interested in
const formattedUsers = users.map(({ displayName, emailAddress, active, accountId }) => ({
displayName,
emailAddress,
active,
accountId
}));
// Finally return transformed JSON output
return buildJSONResponse(formattedUsers);
}