Streamline your Umbraco Cloud workflow by connecting n8n with Slack for instant updates and automation.
I first thought of this when my boss was wandering whether there was a way to receive updates automatically when someone pushes something to either the live, or dev site within Umbraco Cloud.
This is because as an agency, if someone pushes something up that breaks the site, we need to know ASAP so the issue can be resolved quickly, and efficiently.
However, this will also update us whenever an automatic update comes through, therefore we know whether we need to update the respective site manually or not.
We use Slack for communication between our team, and therefore we thought it'd be the best platform to update us.
Firstly, you will need to create an account with Slack.
You will also need an Umbraco Cloud project.
Finally, you will need a digital ocean droplet, or something for n8n to run on.
This is the easy part simply create an account with Digital Ocean, create a droplet and use their marketplace to choose the pre-built n8n application.
just follow the instructions to setup the instance, then once it is up and running, login and carry onto the next section.
Once you have created your Slack account and workspace, head over there and click on apps.
From there, you can search for "Incoming Webhooks", and it should be the first result. Follow the quick installation process for this.
Once this is installed, you will arrive at the setup page, where you can see the webhook URL, and other useful information about the "app"
Create a new workflow from the top right of your screen.
Now you are on a new / blank canvas. click the + icon in the middle, and search for webhook.
Once you select this, you will be greeted with a display for configuring the webhook node.
Set the:
While you are still on this display, near the top, click on production URL, and copy that to your clipboard.
Then, paste that into all of the Cloud projects that you want to be updated about. Configuration - Webhooks - Paste
Head back over to n8n, and go back to your canvas. Create a new node, called code, and set it to JavaScript.
Set Mode to "run once for all items" and Language to "JavaScript", then paste the following code inside of the code block.
// Get first item from webhook
const inItem = $input.first();
const b = inItem.json;// Some Cloud payloads wrap fields in `body`, others don't.
// Normalise so `d` always points at the object with EnvironmentName/Status/etc.
const d = b.body ?? b;// Extract (with safe fallbacks)
const environment = d?.EnvironmentName ?? d?.environment ?? '';
const status = d?.Status ?? d?.status ?? '';
const authorEmail = d?.AuthorEmail ?? d?.authorEmail ?? '';
const message = d?.Message ?? d?.message ?? '';
const projectName = d?.ProjectName ?? d?.projectName ?? '';// Build Slack message text
let text = `Project: ${projectName} has received a message`;
if (environment) text += `\nEnvironment: ${environment}`;
if (authorEmail) text += `\nAuthor: ${authorEmail}`;
if (message) text += `\nMessage: ${message}`;
if (status) text += `\nStatus: ${status}`;// Return for next node
return [
{
json: { text }
}
];
Go back to your canvas, and add your final node, called HTTP request.
Set the:
Once these are applied, under body parameters, set the name to "text" and the value to:
{{$json.text}}
Now everything is setup correctly, go back to your canvas, and in the navigation menu at the top, make sure to activate the workflow.
To test this is working, you should make a small code change, such as adding a space to your code that wont affect anything, and push it up to your live / dev websites, and once the upload is finished, you should receive a notification from Slack.
If you want to customise what message Slack sends you, or the layout, you can configure the code block in the "code node". The official Umbraco documentation for webhooks has a list of the variable names and what they each display, meaning you can pick and choose what is the most important information for you and your team.
Keeping your website running smoothly while you focus on your business can be overwhelming, I get it. That is where I come in. Think of me as part of your team, handling the technical stuff so you don’t have to.
Reliable support to keep your website secure and optimised
Regular updates, backups, and performance tweaks
Tailored plans designed to suit your needs
Priority care with limited availability
Please fill out the form below or contact us directly at hello@simonantony.co.uk