I want to create a webhook in N8N that responds to information from a GitHub webhook and performs an action. However, I don’t know how to do it.
My version of n8n is 0.236.2.
At the moment, I am using the below endpoint in TypeScript:
import { Request, Response } from 'express';
import { verifyGithubPayload } from '../lib/verifyGithubPayload';
const GITHUB_SECRET = process.env.GITHUB_SECRET || '';
export const githubWebhookEndpoint = (req: Request, res: Response) => {
if (!verifyGithubPayload(req, GITHUB_SECRET)) {
return res.status(403).send('Invalid request.');
}
updateRepository(req, res);
};
const updateRepository = (req: Request, res: Response) => {
const exec = require('child_process').exec;
const command = ';
exec(command, (error: any) => {
if (error) return res.status(500).send('Failed to pull repository.');
res.send('Repository successfully pulled.');
});
};
But I can’t create something similar in N8N. I want to create the scenario below:
Link to scenario
I tried options 1 and 2, but they are not working:
Link to option 1 and 2
How can I do that?