Where to store webhook id for custom trigger when working with monday code

Hello Team,

I am planning to build an app with integration feature. For my feature I need to build a custom trigger. Generally developer would need to store webhook id for subscribe event to a external db, so how can we manage that when working/deploying solely on monday code?

Thanks
Yash Garg

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,

1 Like