Get started with n8n.cloud (Part 2)
6:12

Get started with n8n.cloud (Part 2)

n8n 09.12.2020 2 511 просмотров 22 лайков

Machine-readable: Markdown · JSON API · Site index

Поделиться Telegram VK Бот
Транскрипт Скачать .md
Анализ с AI
Описание видео
In this tutorial, we'll setup a Github Trigger that starts the workflow each time a user comments on a commit on a particular repo. We'll then use n8n expressions to reference that data in the Slack node to post the comment to a channel.

Оглавление (7 сегментов)

Intro

so in the previous tutorial we set up our slack node here and connected it to the start trigger what we're going to do now instead is connect the slack node to a github trigger so we can reference dynamic data that's happening from a github event and send that in a message because that's a bit more useful than sending a static message manually so what we'll want to do is click the

Adding a trigger

plus button here since we want to add a trigger click on the trigger section here and we'll search for github we'll click on that

Setting up the trigger

now we'll disconnect the start node we'll tuck it away here and instead connect the github trigger to the slack node and we'll set it up just like the slack node the first thing we're going to want to do is select a credential to use with the github trigger node in this case again i'm going to use oauth2 and select what i already have in the previous video we are showing how to do this however and so once we set up credentialing the next step is to set up the various properties necessary for this trigger in this case we need to add the repository owner which and i have a test repo so we'll add that and then lastly for the github trigger you want to select the events that you'd like to monitor for to trigger this workflow in this case we're going to trigger every time someone comments on a commit so click on that now for any node when you're looking at it and you're not sure exactly what one of these inputs or properties might be you can always open the documentation by this link which then opens in a new tab has an example workflow and sometimes faqs and various other information help you understand how to set up that note so the github trigger setup we'll close it now before we test it we

Saving the workflow

need to save the workflow so we'll go down here and commit hit save as you can hit command or control s as you would on a desktop app so we'll add that now

Testing the workflow

if we click this execute workflow button we see that we're waiting for the webhook call since we have a external trigger here we're now waiting for that event to occur for the next two minutes and we'll pull it into this editor ui here so i'm gonna go over to a commit that i have already and we'll add a comment and now we see that the workflow is just

Testing the GitHub trigger

executed and if we open up the github trigger we can see that github has sent us a response now there's a whole lot of information in here but if we collapse these objects we can see there was a header in here but in the body we're having this information on the comment on the repository in the sender so it looks like it's working

Testing the Slack node

so the next step would be to open our slack node and we're going to use nan expressions to reference some data from that github node so right now we have a static message instead we're going to click this cog here and add an expression now every input across nodes in n8n has this cog on the right hand side where you can add an expression which opens up our expression editor where we can now build out an expression that is a combination of static text like this variables from previous nodes as well as even snippets of javascript to generate a response so in this case let's add a little label for our message and go find it here we'll go into nodes we'll go into the github trigger we want its output data the data that it got from github some json data in there and we'll drill down here into the body into the comment and we see we've got the body of the comment that seems to be the actual text of the comments we'll click that and so now we see what we're pasting is a snippet of code this is just a javascript variable but in the bottom here then we're seeing how that renders out so that's looking as expected and then we'll also add the name of the person who posted it which here is in the user scroll down and click that there so posted by max to catch and lastly we'll add the um url for that user because maybe you want to go check out their profile we'll see here there seems to be an html url it's github. com max to catch perfect so now we have a well prepared message and we can close this and the next step would be to test this node we'll do that by clicking this execute node button here we see we've got a response back we'll check in slack and we see that we've got the message here psyc sent us some information also but the message seems to be working we have the message this is a comment posted by max to catch in the url now what we did by clicking this execute node button is we took the data from the github trigger and use that to perform our slack step so what's nice about that is we didn't have to create another commit comment we use the data that's already um loaded into this trigger which wouldn't be the case if we click the execute workflow button clears all the data so we can do a fresh run so execute node is very useful when you're building a workflow so that you don't have to be creating a jira ticket or something multiple times so now to wrap up we've used expressions to reference data from our github trigger to post a slack message with dynamic data in the next video we'll expand upon this and learn some more concepts thanks

Другие видео автора — n8n

Ctrl+V

Экстракт Знаний в Telegram

Экстракты и дистилляты из лучших YouTube-каналов — сразу после публикации.

Подписаться

Дайджест Экстрактов

Лучшие методички за неделю — каждый понедельник