# Webhook Creating Endpoints Part 2

## Метаданные

- **Канал:** n8n
- **YouTube:** https://www.youtube.com/watch?v=j_iUzrYYWrg
- **Дата:** 01.02.2021
- **Длительность:** 4:21
- **Просмотры:** 3,527
- **Источник:** https://ekstraktznaniy.ru/video/15920

## Описание

In part two of two videos, we will be finishing setting up a custom endpoint for the webhook and then returning information based on what was queried in the request. We will also show you how to run this as a service in the background.

Resources:
- n8n Website - https://n8n.io/
- n8n Documentation - https://docs.n8n.io/
- n8n Community - https://community.n8n.io/
- n8n Workflows - https://n8n.io/workflows/

- n8n Webhook Node - https://docs.n8n.io/nodes/n8n-nodes-base.webhook/

A Basic Introduction to Webhooks - https://markheath.net/post/basic-introduction-webhooks

## Транскрипт

### Intro []

so in today's video we're going to do the second part of creating end nodes and what we're going to do is we're going to do a little bit of pseudo authentication so we got thinking about this term pseudo authentication and really we don't recommend using this process for authenticating your users on the n8n side there are much better ways of doing that which will come up in later videos rather think of this more as routing your messages based on queries that are coming in from the end user anyway back to the video and so what we'll do is we're going to move the set node over we're going to add an if node in between the set node and the web hook itself and so we'll just leave this blank for the moment and then we'll come back here a little bit later to change it so what we're going to do is the set node here we're going to set that to the true output and we're just going to go into that set node now and we will rename it to success

### Duplicate Success Node [1:10]

now let's duplicate the success node and uh this will give us a second node here and we will rename this one as well and surprise we're going to call this one failed

### Duplicate Failed Node [1:25]

failed and we'll drag the false output to the field so let's go back to the field and make sure that it gives us a different message so this time we're going to do message not received and we'll just uh close that up there so now we have our success output and our field output but we got to see what we're going to do with the web hook in order for us to determine what's going on so we'll go into our json view here and you'll notice at the bottom we've got the query id n8n so what we've done is we've passed the value of n8n through the web hook by adding a variable at the end of the webhook url where it's question mark id equals n8n now you'll notice that it won't run unless we execute the node so we'll just execute that here and when we run it says message received and you'll notice that where we've got our id ended in at the bottom and that's how we get that id ended and showing up so we can now

### If Node [2:34]

look at that information we'll open up the if node now and uh what we're going to do is we're going to add a string condition into here so we're going to make sure that the value is what's passed through from the web hook so we're going to go to the current node input json query because that was query information and the id that's what we had passed through and notice it says n8n and then for the value we're going to put n8n as well so what this is basically saying is this will be true if the value that comes in from the web hook is equal to n8n so let's execute the whole workflow and we will resend the information and there we go id equals n8n and if we enter that in message received excellent and we can see that it goes from web hook to if to success now let's change that id equals ending into something else let's say we call it i don't know maybe bob so we'll end that in there and you'll notice it went to failed and our output message is message not received

### Move to Production [3:36]

received one of the things that we noticed once we finished the video is that we neglected to show you how to move this from test mode into production mode to do that open up the web hook and go into the web hook urls and make sure that you have production set and you can start aiming at your production url you can copy that there and you can use that over in your web client the other thing you must then do

### Setup Workflow [3:59]

is set your workflow to active hit yes active and save and now this will run in the background so that you don't have to keep the editor user interface open at all times and it will just run anyway thanks a lot for watching the video
