Hi,
Anybody help me in configuring the custom actions to my board. I am choosing this option since i am unable to verify the origin as Monday.com of my webhook.simillar issue related to this thread - Voted
I have created the custom action and recipe. It is added to the board. When i do any changes to the board, the integration is started executing and It was in progress for an hour and later it got failed as mentioned in the screenshot below. Not sure what is the issue.
For your note, i am able to hit the endpoint from postman.
hi @Venkateshwaran
How is your action endpoint configured?
- are you sure the run URL (in combination with the base URL) is correct?
- Which input fields are configured and are you sure the standard trigger provide these fields as output?
Thanks for your response.
Sorry, I missed the base url part. But now i have tried by adding the base url and run url is (baseurl + relative resource path). But still facing the same issue. I have configured any authorization url.
Yes I have configured the itemid as input field. The standard trigger is item created.
Not sure what i am missing. I am new to this.
When you say that you have not configured authorization url is that the url in the OAuth scope. If so, that’s ok, you don’t need to have one. What you have to do is to authenticate the request coming from monday. In NodeJS you would add your endpoint something like this:
router.post("/autoid-column/recipeaction", authenticationMiddleware.authMonday, autoIdColumnController.recipeAction);
The authenticationMiddleware is used to authenticate the request send to you by monday. You authenticate the request with your sigingSecret
try {
let { authorization } = req.headers;
if (!authorization && req.query) {
authorization = req.query.shortLivedToken;
}
const { accountId, userId, backToUrl } = jwt.verify(authorization, envVars.signingSecret);
req.session = { accountId, userId, backToUrl };
next();
} catch (err) {
res.status(401).json({ error: "not authenticated" });
}
When monday posts to your endpoint you will receive a encrypted shortLivedToken (to be decrypted with your sigingSecret) that can be used to make the monday API call.
async function recipeAction(req, res) {
const { payload } = req.body;
const { inputFields } = payload;
const { boardId, itemId } = inputFields;
const { authorization } = req.headers;
const { accountId, userId, aud, exp, iat, shortLivedToken } = jwt.verify(authorization, envVars.signingSecret);
Hope that helps to get you started.
Hi @basdebruin,
I’m facing a similar issue and was wondering if there are any logs in monday.com to help debug this. Below is the route and authentication middleware. When I trigger this action from a button neither does it give any error message nor does it call the api i.e. the print statement is not being called in the executeAction
function. I have created a tunnel for which the base url look like https://[random_string].apps-tunnel.monday.com
. I am able to access both the base url and /health
which are provided in the Quickstart-integration code through a get request from the browser. I have provided the above base url to the feature and the path in the workflow blocks > action > api configuration is /monday/executeAction
. Is there a way to see the logs of what monday.com is trying to call?
Complete index.js from Quickstart-integration
const router = require('express').Router();
const mondayRoutes = require('./monday');
const authenticationMiddleware = require('../middlewares/authentication');
router.use(mondayRoutes);
router.get('/', function (req, res) {
res.json(getHealth());
});
router.get('/health', function (req, res) {
res.json(getHealth());
res.end();
});
router.post("/monday/executeAction", authenticationMiddleware.authenticationMiddleware, executeAction);
function executeAction(req, res) {
console.log("executeAction");
res.send("Health check done");
}
function getHealth() {
return {
ok: true,
message: 'Healthy',
};
}
module.exports = router;
Complete authentication.js
const jwt = require('jsonwebtoken');
async function authenticationMiddleware(req, res, next) {
console.log("Inside authenticationMiddleware")
try {
let { authorization } = req.headers;
if (!authorization && req.query) {
authorization = req.query.token;
}
const { accountId, userId, backToUrl, shortLivedToken } = jwt.verify(
authorization,
process.env.MONDAY_SIGNING_SECRET
);
req.session = { accountId, userId, backToUrl, shortLivedToken };
next();
} catch (err) {
console.error(err);
res.status(401).json({ error: 'not authenticated' });
}
}
module.exports = {
authenticationMiddleware,
};