In the last section we started testing our second grade web callback by using this test to your integration
button right here.
Now very important if you are not seeing anything appear at your terminal over here if you're not seeing
a console log of the web hooked data go back to the text section that was right before the video and
I put a little bit of debug stuff that you can possibly do to troubleshoot your web host setup.
So you only have to go through that if you did not see this stuff pop up right here.
OK.
So again I had a little bit of trouble getting my web host data to pop up here.
Hopefully you had better luck than I.
So this is the body of the request that said grid sent over to us.
This is an array that contains many different objects.
Each of these objects represents or kind of corresponds to a single discrete event that web hook can
track.
So remember that this is a test request right here.
So they are essentially test throwing you the kitchen sink of every different type of event that we
can track.
So we get a better sense of what they can track.
So inside the body.
We have a array of different objects and every object in there has a property called event there are
event names like group resubscribed which is whenever someone restricts subscribes to some group email
list you can get an event whenever someone unsubscribe from an email list anytime someone issues a spam
report.
Anytime an email fails to be sent properly or bounced and then the one that we really care about the
event of type click so we can go look through our consul log over here through every single one of these
objects.
You'll notice that it has the event property.
Here it is right here.
And here's one that says Group resubscribed.
So let's find one of these sample events that we can possibly get inside an application that corresponds
with a click event.
So scroll up a little bit.
Here's the next one of events is event of unsubscribe event of spam report event of a dropped event
of bounce and then finally an event of click.
So this is the one that you and I really care about right here.
We want to be sent an event notification through that Web hook any time someone clicks on an e-mail
link.
So you'll notice that the event has the email of the person who did the actual click which is extremely
important for you and me.
And then we also get told what address the user was trying to navigate to.
So this would be the actual You are L of the link that they clipped.
So this right here is definitely the type of event that we really care about inside of our application.
Now before we do anything else.
One last thing on send grid's side.
So I want to go back over to the sand grid dashboard.
We only tested the integration right here.
We never actually enabled the entire web hook.
So to make sure that the web hook is actually fully enabled and saved inside of our application we're
going to do two more things.
First we'll scroll down a little bit and make sure that we specify which action we want to use sent
a web hook notification on.
So the only event or the only action that we care about right now is when someone clicks on a link inside
of an e-mail.
So we're going to check the clicked box right here.
Then we're going to make sure that we finalize and enable this web connection by scrolling back up a
little bit and finding the blue checkbox right here.
So click on that I should see on over here.
So I'm going to click on as well and I should then see active appear next to event notification.
So at this point nothing should be editable anymore.
It should all be saved.
You can notice I can't change the URL and the actual notification feature is turned on.
So make sure you've got both those things going.
Now one last thing I want to say about the grid configuration.
You'll notice that our web hooks set up is using specifically this URL that we just set up for development
purposes.
So you can.
Unfortunately you cannot set up two separate web Poku or else one for production and one for development.
So when we eventually go to deploy our application next time we're going to need to make sure that we
come back and update this web.
Hope you are all over here or at least somehow make sure that our application works correctly in the
production versus development environments.
Right now everything is just setup only for development.
But again we'll take care of that a little bit later.
OK.
So our web book is all set up.
We have verified that we are receiving traffic from the Sangar API.
Now the very last thing they want to do before we close the section out I want to make sure that we
get a kind of event or a console log that very closely represents the exact event notification that
you and I are going to receive for our application.
So in other words I want to go through the actual survey process just one time so we can see a very
real event printed out here just to make sure everything is really truly working inside of it.
So I'm going to flip back over to our application and I'm going to create send out another survey it's
really important that you create and send out a new survey because any existing surveys you've created
and sent to yourself will not have all this web stuff enabled you only get all this Web tracking after
four e-mails sent after you turned it on.
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
title of web book test and I'll do that for the subject line and the email body as well.
And then for the recipient list again I'm going to send it to this test e-mail account that I have tied
to my account.
All right so next I'll send the survey.
So that should send the survey out or then go back over to my e-mail inbox.
Here's the web test right here.
I'll open it up and I'm going to click on the Yes button.
So I eventually get sent off to localhost three thousand eighty I-Slash surveys.
Totally fine.
Now as a reminder when we got sent to this link right here we should have now kind of issued any event
over to send grid and send grid should now know that it needs to send a web request over to our server.
And I remember those Web poll requests are only sent once every like 30 seconds or so.
So if I flip back over to my terminal right now I might not immediately see that new console log pop
up here.
I might not see it right away.
I might have to wait for 30 seconds to a minute.
And as a matter of fact there it is right there.
So we just saw a pop up.
So we'll take a quick break just to kind of make sure that you are getting the request consul here as
well.
I'll give you a minute just to make sure yours is working.
So let's take a quick pause and when we come back we'll kind of dissect this thing a little bit and
we'll talk about exactly how we're going to deal with it in the next section.
So I'll see you in just a minute.