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 demonstrates how to create an item in monday.com board from a Slack slash command.
BOARD_ID
- Enter the target Board ID (column type Number). GROUP_NAME_LABEL
- Enter the target group label (column type Text).Trigger a Slack slash command (/command_name <ITEM_NAME>
), after successful event processing a new item should be created in monday.com.
This template still uses Managed Fetch API together with cql-query-builder to make API calls to monday.com. However, monday.com Managed API support is now available for monday.com as well. Please check some other template to learn how to use Managed API directy to make API calls to monday.com.
import { SlashCommandEvent } from "@sr-connect/slack/events";
import Monday from "./api/monday";
/**
* Entry point to Slash Command event
*
* @param event Object that holds Slash Command event data
* @param context Object that holds function invocation context data
*/
export default async function (event: SlashCommandEvent, context: Context): Promise<void> {
if (Object.keys(event).length === 0) {
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;
}
// Check if the pulse name is present in the event
if (!event.text) {
throw Error('Item name is not present in the event');
}
const { BOARD_ID, GROUP_NAME_LABEL } = context.environment.vars;
// Get all the groups in the board
const groups = await Monday.Board.getBoards({
args: {
ids: [BOARD_ID],
},
fields: {
groups: {
fields: {
id: true,
title: true,
},
},
},
});
// Lookup the group
const groupId = groups.data.boards[0]?.groups.find(g => g.title === GROUP_NAME_LABEL)?.id;
// Check if the group was found
if (!groupId) {
throw Error('Group not found');
}
// Create the item
await Monday.Item.createItem({
args: {
item_name: event.text,
board_id: BOARD_ID,
group_id: groupId,
},
fields: {
id: true,
},
});
}