1 00:00:00,660 --> 00:00:06,070 In the last section we started testing our second grade web callback by using this test to your integration 2 00:00:06,070 --> 00:00:06,990 button right here. 3 00:00:07,110 --> 00:00:12,460 Now very important if you are not seeing anything appear at your terminal over here if you're not seeing 4 00:00:12,460 --> 00:00:18,130 a console log of the web hooked data go back to the text section that was right before the video and 5 00:00:18,130 --> 00:00:23,290 I put a little bit of debug stuff that you can possibly do to troubleshoot your web host setup. 6 00:00:23,290 --> 00:00:27,230 So you only have to go through that if you did not see this stuff pop up right here. 7 00:00:27,670 --> 00:00:27,980 OK. 8 00:00:28,000 --> 00:00:32,390 So again I had a little bit of trouble getting my web host data to pop up here. 9 00:00:32,410 --> 00:00:34,180 Hopefully you had better luck than I. 10 00:00:34,360 --> 00:00:39,290 So this is the body of the request that said grid sent over to us. 11 00:00:39,430 --> 00:00:43,620 This is an array that contains many different objects. 12 00:00:43,660 --> 00:00:49,510 Each of these objects represents or kind of corresponds to a single discrete event that web hook can 13 00:00:49,510 --> 00:00:50,100 track. 14 00:00:50,230 --> 00:00:52,500 So remember that this is a test request right here. 15 00:00:52,540 --> 00:00:58,150 So they are essentially test throwing you the kitchen sink of every different type of event that we 16 00:00:58,390 --> 00:00:59,240 can track. 17 00:00:59,440 --> 00:01:02,560 So we get a better sense of what they can track. 18 00:01:02,670 --> 00:01:03,960 So inside the body. 19 00:01:03,970 --> 00:01:10,870 We have a array of different objects and every object in there has a property called event there are 20 00:01:10,930 --> 00:01:16,360 event names like group resubscribed which is whenever someone restricts subscribes to some group email 21 00:01:16,360 --> 00:01:22,450 list you can get an event whenever someone unsubscribe from an email list anytime someone issues a spam 22 00:01:22,450 --> 00:01:23,120 report. 23 00:01:23,280 --> 00:01:28,930 Anytime an email fails to be sent properly or bounced and then the one that we really care about the 24 00:01:28,930 --> 00:01:36,820 event of type click so we can go look through our consul log over here through every single one of these 25 00:01:36,820 --> 00:01:37,790 objects. 26 00:01:37,810 --> 00:01:39,890 You'll notice that it has the event property. 27 00:01:39,910 --> 00:01:40,810 Here it is right here. 28 00:01:40,810 --> 00:01:43,080 And here's one that says Group resubscribed. 29 00:01:43,330 --> 00:01:48,280 So let's find one of these sample events that we can possibly get inside an application that corresponds 30 00:01:48,280 --> 00:01:50,020 with a click event. 31 00:01:50,020 --> 00:01:51,470 So scroll up a little bit. 32 00:01:51,550 --> 00:02:00,400 Here's the next one of events is event of unsubscribe event of spam report event of a dropped event 33 00:02:00,400 --> 00:02:04,230 of bounce and then finally an event of click. 34 00:02:04,330 --> 00:02:07,090 So this is the one that you and I really care about right here. 35 00:02:07,120 --> 00:02:13,120 We want to be sent an event notification through that Web hook any time someone clicks on an e-mail 36 00:02:13,180 --> 00:02:14,220 link. 37 00:02:14,410 --> 00:02:20,800 So you'll notice that the event has the email of the person who did the actual click which is extremely 38 00:02:20,800 --> 00:02:22,140 important for you and me. 39 00:02:22,240 --> 00:02:27,510 And then we also get told what address the user was trying to navigate to. 40 00:02:27,550 --> 00:02:31,370 So this would be the actual You are L of the link that they clipped. 41 00:02:31,420 --> 00:02:37,210 So this right here is definitely the type of event that we really care about inside of our application. 42 00:02:37,210 --> 00:02:38,680 Now before we do anything else. 43 00:02:38,680 --> 00:02:41,240 One last thing on send grid's side. 44 00:02:41,350 --> 00:02:43,750 So I want to go back over to the sand grid dashboard. 45 00:02:44,050 --> 00:02:46,870 We only tested the integration right here. 46 00:02:46,870 --> 00:02:50,420 We never actually enabled the entire web hook. 47 00:02:50,440 --> 00:02:55,390 So to make sure that the web hook is actually fully enabled and saved inside of our application we're 48 00:02:55,390 --> 00:02:57,940 going to do two more things. 49 00:02:57,940 --> 00:03:03,520 First we'll scroll down a little bit and make sure that we specify which action we want to use sent 50 00:03:03,580 --> 00:03:05,840 a web hook notification on. 51 00:03:05,860 --> 00:03:11,020 So the only event or the only action that we care about right now is when someone clicks on a link inside 52 00:03:11,020 --> 00:03:12,040 of an e-mail. 53 00:03:12,100 --> 00:03:15,290 So we're going to check the clicked box right here. 54 00:03:15,700 --> 00:03:20,320 Then we're going to make sure that we finalize and enable this web connection by scrolling back up a 55 00:03:20,320 --> 00:03:23,530 little bit and finding the blue checkbox right here. 56 00:03:23,530 --> 00:03:29,410 So click on that I should see on over here. 57 00:03:29,410 --> 00:03:35,110 So I'm going to click on as well and I should then see active appear next to event notification. 58 00:03:35,110 --> 00:03:37,360 So at this point nothing should be editable anymore. 59 00:03:37,380 --> 00:03:38,460 It should all be saved. 60 00:03:38,470 --> 00:03:43,920 You can notice I can't change the URL and the actual notification feature is turned on. 61 00:03:43,930 --> 00:03:46,210 So make sure you've got both those things going. 62 00:03:46,210 --> 00:03:49,120 Now one last thing I want to say about the grid configuration. 63 00:03:49,210 --> 00:03:55,090 You'll notice that our web hooks set up is using specifically this URL that we just set up for development 64 00:03:55,090 --> 00:03:56,090 purposes. 65 00:03:56,470 --> 00:03:57,100 So you can. 66 00:03:57,130 --> 00:04:03,180 Unfortunately you cannot set up two separate web Poku or else one for production and one for development. 67 00:04:03,400 --> 00:04:08,050 So when we eventually go to deploy our application next time we're going to need to make sure that we 68 00:04:08,050 --> 00:04:09,610 come back and update this web. 69 00:04:09,610 --> 00:04:14,620 Hope you are all over here or at least somehow make sure that our application works correctly in the 70 00:04:14,620 --> 00:04:17,200 production versus development environments. 71 00:04:17,320 --> 00:04:20,360 Right now everything is just setup only for development. 72 00:04:20,440 --> 00:04:23,290 But again we'll take care of that a little bit later. 73 00:04:23,510 --> 00:04:24,050 OK. 74 00:04:24,340 --> 00:04:26,090 So our web book is all set up. 75 00:04:26,110 --> 00:04:31,720 We have verified that we are receiving traffic from the Sangar API. 76 00:04:31,870 --> 00:04:35,590 Now the very last thing they want to do before we close the section out I want to make sure that we 77 00:04:35,590 --> 00:04:42,940 get a kind of event or a console log that very closely represents the exact event notification that 78 00:04:42,940 --> 00:04:45,650 you and I are going to receive for our application. 79 00:04:45,820 --> 00:04:51,070 So in other words I want to go through the actual survey process just one time so we can see a very 80 00:04:51,070 --> 00:04:56,130 real event printed out here just to make sure everything is really truly working inside of it. 81 00:04:56,530 --> 00:05:02,440 So I'm going to flip back over to our application and I'm going to create send out another survey it's 82 00:05:02,440 --> 00:05:07,630 really important that you create and send out a new survey because any existing surveys you've created 83 00:05:07,630 --> 00:05:13,630 and sent to yourself will not have all this web stuff enabled you only get all this Web tracking after 84 00:05:13,690 --> 00:05:16,050 four e-mails sent after you turned it on. 85 00:05:16,120 --> 00:05:21,760 So we need to make sure that we create a new email here so click on the plus button I'll give it a campaign 86 00:05:21,760 --> 00:05:28,750 title of web book test and I'll do that for the subject line and the email body as well. 87 00:05:28,750 --> 00:05:33,130 And then for the recipient list again I'm going to send it to this test e-mail account that I have tied 88 00:05:33,490 --> 00:05:35,570 to my account. 89 00:05:35,610 --> 00:05:37,890 All right so next I'll send the survey. 90 00:05:38,170 --> 00:05:43,260 So that should send the survey out or then go back over to my e-mail inbox. 91 00:05:43,450 --> 00:05:45,260 Here's the web test right here. 92 00:05:45,280 --> 00:05:49,540 I'll open it up and I'm going to click on the Yes button. 93 00:05:49,900 --> 00:05:53,540 So I eventually get sent off to localhost three thousand eighty I-Slash surveys. 94 00:05:53,650 --> 00:05:55,270 Totally fine. 95 00:05:55,300 --> 00:06:01,810 Now as a reminder when we got sent to this link right here we should have now kind of issued any event 96 00:06:01,900 --> 00:06:08,830 over to send grid and send grid should now know that it needs to send a web request over to our server. 97 00:06:09,090 --> 00:06:14,580 And I remember those Web poll requests are only sent once every like 30 seconds or so. 98 00:06:14,590 --> 00:06:20,710 So if I flip back over to my terminal right now I might not immediately see that new console log pop 99 00:06:20,710 --> 00:06:21,210 up here. 100 00:06:21,280 --> 00:06:22,360 I might not see it right away. 101 00:06:22,360 --> 00:06:25,000 I might have to wait for 30 seconds to a minute. 102 00:06:25,060 --> 00:06:26,680 And as a matter of fact there it is right there. 103 00:06:26,890 --> 00:06:29,090 So we just saw a pop up. 104 00:06:29,200 --> 00:06:34,390 So we'll take a quick break just to kind of make sure that you are getting the request consul here as 105 00:06:34,390 --> 00:06:34,690 well. 106 00:06:34,690 --> 00:06:36,760 I'll give you a minute just to make sure yours is working. 107 00:06:36,910 --> 00:06:41,200 So let's take a quick pause and when we come back we'll kind of dissect this thing a little bit and 108 00:06:41,200 --> 00:06:44,650 we'll talk about exactly how we're going to deal with it in the next section. 109 00:06:44,800 --> 00:06:46,890 So I'll see you in just a minute.