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.
Template Content
This template demonstrates how to create a Trello webhook programatically via Trello API to listen to updates from a Trello board.
Generic Async HTTP Event
listener. Grab the URL that you received and
add set it to CALLBACK_URL
parameter in Parameters
.BOARD_ID
parameter in Parameters
.CreateWebhook
script to create a webhook that listens to updates in your trello board.
This will also log out the webhook ID, copy it and add it into Parameters
under WEBHOOK_ID
parameter if you need to delete the webhook in the future, or store it externally.DeleteWebhook
script when you want to delete the webhook.import Trello from './api/trello';
/**
* This script created a webhook in Trello
*/
export default async function (event: any, context: Context): Promise<void> {
const { BOARD_ID, DESCRIPTION, EVENT_LISTENER_URL } = context.environment.vars as EnvVars;
// This function retrieves another ID for the board
const board = await Trello.Board.getBoard({
id: BOARD_ID,
});
// This function creates a webhook using the callback URL, board ID and description
const webhook = await Trello.Webhook.createWebhook({
idModel: board.id,
callbackURL: EVENT_LISTENER_URL,
description: DESCRIPTION,
});
console.log(`New webhook was created with ID: ${webhook.id}. Store this webhook ID if you intend to delete it later.`);
}
interface EnvVars {
readonly BOARD_ID: string;
readonly EVENT_LISTENER_URL: string;
readonly DESCRIPTION: string;
}
import Trello from './api/trello';
/**
* This script deletes the webhook using its ID.
*/
export default async function(event: any, context: Context): Promise<void> {
const { WEBHOOK_ID } = context.environment.vars as EnvVars;
await Trello.Webhook.deleteWebhook({
id: WEBHOOK_ID,
});
console.log('Webhook was deleted');
}
interface EnvVars {
readonly WEBHOOK_ID: string;
}
import { HttpEventRequest } from '@sr-connect/generic-app/events/http';
/**
* Entry point to Async HTTP Event event
*
* @param event Object that holds Async HTTP Event event data
* @param context Object that holds function invocation context data
*/
export default async function(event: HttpEventRequest, context: Context): Promise<void> {
console.log('Event event triggered from Trello:', event);
}