One easy way is to use Monday Code SecureStorage, or Monday Code Storage with { shared: false } for added security and control.
This lets you store the webhook data needed for your event subscriptions right within Monday Code, so you don’t need to worry about managing an external database.
Remember to store your webhookUrl so you can trigger your custom action whenever needed.
// Exemple of subscription request handler
import { Storage } from '@mondaycom/apps-sdk';
import jwt from 'jsonwebtoken';
async (req, res) => {
const authorization = req.headers.authorization ?? req.query?.token;
const { shortLivedToken } = await jwt.verify(authorization, MONDAY_SIGNING_SECRET);
const { webhookUrl, integrationId, inputFields } = req.body.payload;
const storage = new Storage(shortLivedToken);
const KEY = // create your key from inputFields / integrationId
await storage.set(`trigger_${KEY}`, JSON.stringify({ webhookUrl }), {shared: false});
return res.status(200).send();
};
Best,