Platform
Docs
Solutions
ContactLog In

Event Driven Notifications with Segment

We’ll see you here on

February 23, 2023 @ 6:00 pm

Add to your calendar

Open YouTube link

Hosted by

A headshot of Shreya
Shreya

Developer Advocate @ Courier

A headshot of Ben Link
Ben Link

Developer Advocate @ Segment

A headshot of Seth Carney
Seth Carney

CTO @ Courier

Description

Learn how to trigger notifications based on user activity. In this workshop, we will setup a sample webapp and demonstrate how to send notifications to users based on their activity and what you can now do with user events from Courier using Segment.

Transcript

Shreya:

Alright, and we made it. Thank you so much Seth and Ben for joining. This is Decode episode three. Today we're going to be talking about Segment and Courier and the entire integration that we have set up. My name is Shreya and I am your host for Decode. And today we are joined by two really awesome guests. Hi Ben and Seth, how are you all doing?

Seth:

It's great to be here.

Shreya:

Awesome. Thank you so much for joining. Also, thank you Suhas for being the first person to comment before the live stream even went live. Tejas and Nia are also joining in the chat.

Tejas said: “Excited for this episode!” We are all really excited because we have some sneak peeks that you know, you're not ready for! Nia says this music is getting getting her amped up. And honestly, yes that's exactly why I have that two minute counter that Micah made just so we can get pumped up for this episode.

Now, Ben, do you want to introduce yourself and tell us what are you doing here?

Ben:

Sure. So my name's Ben Link and I'm a developer evangelist at Twilio Segment, so not necessarily part of the whole Twilio family, but in the Segment subsection. I'm focused on customer data and making our platform connect all the different things. One of which is Courier.

Shreya:

Awesome and Seth, this is your first time on a livestream. How are you feeling?

Seth:

Doin’ Good. Excited to be here.

Shreya:

I'm excited that you're here. Could you tell us a little bit about what you do at Courier?

Seth:

Yeah, sure. I'm CTO here at Courier. Been here for, gosh, more than three years now, so not quite since the beginning, but almost. And excited to be here to talk about Courier updated Segment integration, rolling out the new capabilities and all the power that comes with it.

Shreya:

Yeah, power is a really good word to mr that really empowers developers to do things in a matter of minutes that would probably take them a really long time to do. Since we're going to be showing off our new Courier integration with Segment. Could you tell us a little bit about what that integration has and why we built it?

Seth:

Yeah, absolutely. Firstly, we've had part of a Segment integration for some time now. We've been a destination where all kinds of events that are already flowing through your Segment instance can make their way to Courier and allow you to trigger notifications or other workflows or automations that you want to execute as a result of those interactions.

Seth:

Also, things like automatically storing profile data with the identify calls and things like that. We wanted to complete the story and really bring everything full circle by treating Courier as a source for Segment events as well, which brings an additional layer of power to that integration allowing you to really easily integrate that information into your data warehouse or other downstream systems that Segment allows you to connect to.

Shreya:

That's really awesome. I'm really excited to sort of just jump into this project. Ben shared an e-commerce website that Segment has built out for us, and so today in our live stream, we're actually going to be cloning that website and then setting up both of the integrations that we've built out. How are you guys feeling about getting started?

Shreya:

Should we just dive into the code?

Seth:

Yeah let’s do it.

Shreya:

Awesome, so we're going to send the link for this public repository in our chat right now. Let us know if you have any issues with accessing it or forking it. I'm just going to go ahead and copy this and open up a new terminal and just go ahead and clone it. While we're getting this project set up..;.

Shreya:

Ben, could you tell us a little bit about ways in which you've seen Segment use, like what happens once events are within Segment? What are the cool things that your customers are doing with it?

Ben:

Sure. So the idea behind Segment is that it's a customer data platform. We've recognized that across the industry there's lots of different data sources that you're trying to pull together. You've got a website, you've probably got mobile app, and if you've got one, you've probably got two there and then you've got other engagement sources that you might be pulling information from.

Ben:

You might even be using some of the other Twilio products as ways to engage with your customers. So all of those things then have to be coded to talk to a data set of some sort and Segment acts as sort of a bus in between the sources and the destinations, because we recognize that there's going to be a lot of different moving parts out there.

Ben:

And if you have four or five different data sources for you're engaging with customers and you want to use three or four different tools in your stack for different purposes, think of like your Google Analytics to see how people are visiting the website or maybe or your Launch Darkly in terms of like controlling A, B tests or things like that.

Ben:

Mixpanel and amplitude for analytics and number crunching things. And then of course a data warehouse to push it further downstream for all of the data science folks to to do the big heavy querying against. So Segment acts as the way to connect all of those tools together in an easy, simple way to manage. We try to remove as much of the code from the equation as possible through this so that when you're integrating, it's not a big heavy burden on your engineering team.

Shreya:

Awesome. I also want to give a shout out to Arnav who's one of our hackathon participants and winners as well, who says hello to both of you in our chat. Just reiterating all we've done so far as we've gone into the GitHub repo that Charla shared in the chat and cloned it and now we can go ahead and sort of check out Segment.

Shreya:

So this is once you've already logged into Segment, I already have a source set up, but if you don't, that's fine. You just want to go to connections and sources and we're going to build out a source from scratch. So Ben, would you mind walking me through the process of adding a source?

Ben:

Sure thing. So over on the left there, you've clicked sources to get to this page, and then on the far right is where the add source button is. So we're going to go in there and look through the catalog. And there are hundreds of sources that are already prebuilt and packaged and ready to go and if you don't see a source that matches up with exactly what you need, you can actually custom design your own.

Ben:

We're not going to get into that today. That would take us a little over time and a little off topic. But if you dig down through here, you should be able to find it. We're starting by setting up our website, right? So we're going to go to just a JavaScript website, the example that's been linked out in the chat there.

Ben:

It's just a little node app that you can run and it starts up on Port 3000. So you add the JavaScript source.

Shreya:

Does it matter if you use JavaScript versus Node.js?

Ben:

It's a rather it’s about where you've implemented your Segment code. So if you're writing the Segment integration from client side events, you're going to want to use the JavaScript websites. If you're using something that's purely like a node server situation, then you'll want to use the Node.js server.

Shreya:

So we'll go with JavaScript and Suhas as a really great question for Ben, what Segments recommendation on best practices around sources potentially sending bad data.

Ben:

Potentially sending bad data. I'd like to maybe dig into that and find out a little bit more about what you mean by that Suhas, in the way that we're using this where we're gathering data from sources that we control. So it's my website, it's my mobile app, it's things that are completely under my control as the development team to be able to say, okay, I'm the one who's deciding when to send data.

Ben:

So if, if that doesn't really answer your question, feel free to toss another thing in there and let's kind of clarify it and we can work through it.

Shreya:

Awesome. Thanks for that, Ben, and thanks for Suhas for asking that as well. So I'm going to go ahead and click add source. What should we call this?

Ben:

You can call it whatever you like it. It's a simple text field there. So ecommerce example or…

Shreya:

You going to see how bad I am selling things today. All right, I'll call it e-commerce website and we can just do we need to add labels and website URLs right now.

Ben:

If you were doing this in like an actual production environment, you'd want the website URL attached there. I don't think it's necessary to to keep us rolling though.

Shreya:

Got it.

Ben:

For the purposes of our small example, at least.

Shreya:

Great. And so we're actually going to be adding two sources today. First, we're going to add our website and later we're going to be adding Courier as a source as well. But we'll get to that in a minute. What's the next step? What do we do now?

Ben:

So what you're actually seeing here is that the website is ready to go. You would have to make a very small code change. And the smallest version of this is to copy that snippet that you see right there in the center of the screen into the head tag of your JavaScript website and then rebuild it. So you could do that and that's enough to get you started with Segment.

Ben:

Now that's not going to have all the bells and whistles that we offer because we're not just providing a data bus here. Segment does a whole lot more than that, in part insofar as we are, we build out a customer profile and we maintain it. So so there's lots of other calls you can make from your website in Segment too, to capture more pertinent data and to build that that knowledge of your customer base.

Ben:

But if you're just trying the product out for the first time, then the copy paste here gets you all the way to the point where data is flowing.

Shreya:

Awesome. So where should I be placing this code snippet?

Ben:

On so in a normal in a a non demo prepped environment, you would put this into the head tag of your HTML page. So usually like an index study, HTML, you'll have the classic HTML headers there. And so when you put the head tag in place, you can drop that in there just as a snippet that's included as part of that so that it'll pull in our library and do that stuff.

Ben:

Now, the example that we're working with today actually has all this predefined already and has a bunch of events already set up, so you don't need to go that route with it. What you want to do in this case is go to the config.JSON file and you'll see that there are API keys attached there.

Shreya:

Awesome.

Ben:

So what we want to do is go back to our Segment Workspace and under the settings tab.

Shreya:

Open settings tab…

Ben:

Yes, you can go to API keys there on the left and you can grab that right key. And if you paste that in where it says to put it in the config file and then rebuild your app, you'll be able to run this and it should start talking to your Segment instance immediately.

Shreya:

Okay. So one thing that I noticed while I was practicing this before the livestream was that I did have to hit NPM install first. So I'm going to do that and then we're going to build the actual website. This is going to take a minute. So could you walk us through what we're going to be working like at this stage we have a website/ That's just a local website that is set up with Segment, which means that anything that happens within this website, any time someone clicks on a page, anytime someone adds an item to their cart, Segments going to be getting access to those events. It's going to be tracking those events. Is that right?

Ben:

Yeah. So the basic form, like if you were to go back to that overview page and look at the code snippet that was provided in the Segment workspace that only has the analytics, that page calling it, which is just enough to give you page view events. What we've implemented in this demo environment actually has other events created along the way.

Ben:

I can't remember all of them off the top of my head, but there is a track event and then identify events that are going to be really important to your Segment usage. The identify event. You drop into the log in routine so that as soon as you've identified a customer as this person with this ID, you can now start that identify gives the the Segment workspace the ability to start stitching that profile together.

Ben:

And so every event that comes from that user sessions, regardless of where they've gone, as soon as they log in and we know it's them again, then we can pull all that data together to build a unified look at their profile and what they've done to interact with our business. The dot track call is something that you can drop into your code wherever you find interesting.

Ben:

Anything that a customer can do within your website that you would want to be able to track and pay attention to as soon as you know where that is in the code, you drop a track, call into that and it gives you the ability then to tag that with a certain name and then you can follow that event any time that occurs.

Ben:

So if you care a lot about a certain button, one of the common examples in a retail scenario is view the shopping cart. Anytime somebody goes to the view shopping cart or any time somebody goes to checkout or any time somebody hits the submit on the checkout page where they're actually completing their order, those are events that you would want to know about that aren't necessarily tied to page calls.

Ben:

And so you would miss them if you just had the page stuff implemented. But using the dot track gives you the ability then to click all these things together and go, Look, I can see that Ben came to my website and he shopped and added things to his cart and then when he hit view cart, he went to checkout, but he didn't complete his order.

Ben:

And maybe that's really important to your marketing team because they want to know when that happens, when are we not making a sale? And this is what gives you the data to be able to to make decisions off of that and to send out a notification, which is kind of what we're going to look at with Courier in a bit here.

Shreya:

Awesome. Thank you so much for explaining that. While we were talking, I did run the NPM run build command. So if you're following along, make sure to do that as well. And then once you do that, we can just hit and NPM start and we should get our little local host website up and running. Let me see.

Shreya:

Okay, it's showing up on the wrong tab. Let me pull it up over here.

Ben:

So there you go. Yep. We've got our website running and ready to go. So because we've implemented the right key already, you did that before you actually hit build. So that's really awesome. That means it should be working right out of the gate. If you were to go into your Segment workspace, we need to make a couple of those page calls occur.

Ben:

So if you wanted to click on some things.. Let's just go shopping.

Shreya:

Okay, okay, let's go right now. Look through these very pretty shoes. Can I add stuff to cart? I'm going to add it to cart. Absolutely awesome. And then you can click on there. I'm going to add it to cart from here. You can click on the actual cart itself as well.

Ben:

We and so now if you go over to your Segment workspace, you should be able to see events on the debugger tab.

Shreya:

Okay. So we're going to go on to the debugger tab and previously this would have been empty. I should have clicked on that earlier to show you that. But if you're in your own workspace, then this would have been empty. And now these are this is everything that I have done as a user on this local website.

Shreya:

So you can see that I sort of went through all of these different pages. I added some products. I clicked on a product and at the very end I also viewed the cart. Awesome.

Ben:

Yep. And one of the things to note here is you can see the analytics.track call over there. You can also see the tag on the left that says track to let you know what type of event was captured. But the really interesting part of seeing the the data on the right there is you can actually see that you can pass along whatever event data is important to you.

Ben:

So in the case of viewing the shopping cart, you know, what's the next possible question that someone could ask? Well, what was in the shopping cart when they hit view cart? That data can be passed right along for the ride. Your developer writes the tracking call in a way that captures whatever relevant session data is available and just plugs it right in here so that it comes along for the ride and you get to see all this in one place.

Seth:

So this is really useful for enriching your notification data when you're sending out messages about them.

Ben:

Exactly. Not only can you make the decisions off of what's actually in there, for instance, you picked a couple of Filo products. Let's see what's different between the two. So it's an outdoor slide. Maybe we have a deal on slides this week and it's only the slide type of shoe that we're concerned with. If you didn't have a slide in your cart, I might not want to notify you.

Ben:

That would be something I would pay attention to. Further, there might be, you know, certain types of slides that are more deeply discounted than others or something, and I might want to notify you differently. So that's other data that I could pass along where a destination like Courier would pick it up.

Shreya:

Awesome. And we do have a question from Craig asking, can you track video?

Ben:

Yes, you could totally use Segment to track video. So the idea of being able to watch a video, if you think of your YouTube experience, you go to a page and you're watching a video play and you want to know when certain events happen. So the play and the pause and the stop and the how far did the person get before they finished, you would be able to track by putting, you know, some sort of milestone.

Ben:

Did they at least make it to 30 seconds? Did they at least make it to 2 minutes, whatever, whatever relevant information there we actually have in in our documentation, a whole series of specs for the different types of uses that we've seen commonly. So video playback is is one that's of concern for a lot of folks. And then of course, like the retail space is probably the one we talk about the most because it's by and large the most common thing you'll see.

Ben:

But, but yeah, the interesting part of this is not only can you use those predetermined specs to figure out what's important in those spaces, but if you imagine a new use case, you can build the whole thing on your own as well to match whatever specific thing it is you're doing that's different from anything we've seen before.

Shreya:

Awesome. Craig is also devrel from Twilio, so thank you so much for joining Craig. I'm glad that you're able to participate in this live stream. Alright, Seth, I'm going to ask you to take over now and sort of tell us a little bit about what we can do with this information with Courier’s integration and also just like walk me through that entire process.

Seth:

Yeah, sure. Well, as I mentioned earlier, there's going to be two parts to the integration. And I think, you know, in terms of sending notifications and mentioned earlier especially if you've got a Segment up or running or you're already tracking events or have this kind of implementation in your ecosystem, it's it's honestly one of the easiest ways to get up and running with Courier.

Seth:

It's a matter of setting up Courier as a destination which we’ll walk through. Wiring that event up to an automation and telling what that automation should dom and kind of sitting back and watch it do its thing. So we'll walk through all those bits. And the first thing is setting Courier up as a destination, right? So we've got this source that we've created that's our e-commerce site.

Seth:

Well, all this data is coming in. We need to send it somewhere, right? And so let's go in andadd Courier as a destination for that source.

Shreya:

All right. So I have Courier added in, but we're just going to go ahead and repeat this process for the sake of the livestream. So I'll just type it in here so it's easier to find. And what do we do once we've clicked on this page?

Seth:

So we'll need to configure Courier or maybe give you some information about where you can get your API key and stuff like that. But let's go ahead and pick our new e-commerce website. You know, you have two options here. One, you can fill in information manually or the alternative is you can copy from another installation that you've already got running, depending if you've already configured or not.

Seth:

In this case, Shreya, not sure if you is that already connected to the workspace we're using. If so, we can copy the settings. Otherwise.

Shreya:

No idea. So I'm just going to do it.

Seth:

Call it Courier. Yeah. And we'll fill those in and we'll need to put an API key in here. So the way that you'll get this is you'll go over to your Courier instance and you'll go to settings.

Shreya:

Alright, I'm going to open Courier from scratch close out my old tabs and you said go over to settings.

Seth:

Settings and API keys and where you want to grab that one you've got right there you are a production published key.

Shreya:

We’ll, go ahead and paste that in here and click save and great.

Seth:

Now good news is, Courier is wired up to receive events from Segment? So let's go back over to the Courier… Actually if we could really quickly, let's go back to our e-commerce site and lets generate a few more events.

Shreya:

Okay. Sounds good. So just like.

Seth:

We can.

Shreya:

Click on and just look.

Seth:

Around if you want, you can pick another shoe to buy and let's view our cart and let's go over to Courier.

Shreya:

Let's go to Courier.

Seth:

If everything was set up right, we're going to go in the channels and find our channel Segment integration.

Shreya:

And find Segment.

Seth:

And what we should see here, if you scroll down, is hopefully some of the events that we just generated.

Shreya:

Oh, Oh, okay. This is actually from yesterday because this is wired up to a different site here. So should we update this right with the new website that we just set up?

Seth:

So let's go and just clear that right here for now, because that's going to be Courier sending source data in. And let's just pay attention to this destination events. And you'll see here that we have been getting these different destination events in and they should look really similar to the events that we were generating over in our Segment debugger.

Seth:

And so why don't we go ahead and set up a use case here? You know, a lot of times you see an experience where you'll go view a cart, you'll add a bunch of items to it, you'll get that buyer's remorse and you don't check out. You just leave. You go away. And at times you get a reminder, right?

Seth:

“Hey, you left your cart, come back, check out.” Maybe you want to even ply them with a coupon code or some kind of incentive, right? Would that be great if we could wire that up really easily based on all the events that we've already pumped into Couriers destination here. So let's go do that.

Seth:

So what that's going to take for us to do is wire up two events, one when they view the checkout screen, right. So they go they start the checkout process and then, if they actually check out, we want to discontinue any kind of engagement process we've been running with them. So that's going to require us to go wire a few things up.

Seth:

So let's go create some automations.

Shreya:

Okay. Well, I do want to ask really quickly, so before we do that, I'm noticing that the time received for these ones are actually the ones that I did yesterday. So maybe there's something that we're missing over here? Do I need to enable that?

Seth:

It’s not enabled. Great catch Shreya.

Seth:

So let's go generate a few more events and make sure. No, that was a great catch. Some live debugging there,

Shreya:

We can just add stuff. Click on stuff and let's go back here and we'll just reload this page.

Seth:

Actually, that list will auto refresh, by the way. You don't have to refresh it itself, but you can see here, we did get the events in. Let's go back to the example we were building out. Right. Which is just a cart reminder now. It's going to take two automations and I think exciting news, right?

Seth:

We're going to see a sneak peek of our new automations designer, which has gone into a closed beta this week, but super excited to show this off. Let's go start creating some automations.

Shreya:

This is the moment. I don't think anyone understands how excited I am. This is the first time we're showing automations to point out live. It's not even actually out available for the public yet. We're just doing a sneak peek. So this is it. This is the big reveal oh my god!

Seth:

So really, this is basically our new workflow designer, and this allows you to build orchestrations around notifications. And so what we're going to do here, right, is first, we need a trigger, right? And in this case, we want to trigger based off a Segment event that's happening and so let's expand our trigger section and add a new trigger.

Seth:

All right. There's a handy dandy Segment trigger that we can drop right onto the UI there. So let's go ahead and do that and then you'll see some of the events that Ben talked about earlier. In this case, we care mostly about identifying track events. We care about a track event… And help me with the text here.

Seth:

I think this is going to be the event that we sent in for the check out step viewed.

Seth:

I think from our debugger.

Shreya:

We can get it from our source over here. We'll go over to our website. Craig mentioned that pair programming is great because specifically you can have multiple people looking at the same stuff. And Dennis said that he's really excited for the big reveal as well.

Seth:

So there was your track event actually, I think it was the check out event.

Shreya:

Alright. Let me zoom out a little bit because this is cutting things off. Which one did you say you want?

Seth:

I think it was the one we're looking for is a check out event. So we could even generate one just to see what it looks like, right?

Shreya:

Yeah. I don't think I clicked check out recently. That's why it’s not showing up.

Seth:

Perfect. So check out step, fantastic. So let's grab that event name. So excitingly, we'll have auto complete rolling out this week with us so you won't actually have to type this in. But now we've got a Segment event that's going to trigger this automation. And like we probably don't want to immediately send this automation when someone views this. We probably want to wait some sensible amount of time.

Seth:

I don't know, probably something like an hour usually. But let's go ahead and drag a delay action on.

Shreya:

All right. We'll click on actions and there's a delay. Perfect. I like how it just like I don't know if you guys saw that, but it became pink. Look, I did something wrong, so.

Seth:

Let's just refresh. That's what we where we're in beta.

Shreya:

Oh, I got it. Okay.

Seth:

Betas. That’s why we’re still in beta, testing it live. So usually we set this to something reasonable like an hour, I think for our testing purposes, like, let's just set it to something short like a minute.

Shreya:

Okay, I'll take a minute.

Seth:

And after that, we're going to want to send them a message.

Shreya:

Send them a message, and then there's a send option. Object? Option? What is it called?

Seth:

These are called steps.

Shreya:

Steps, okay.

Seth:

And so the user ID from this one is actually going to come off the Segment event. So we're going to use a reference for this. And so what you're going to type in the user ID is going to be a reference. And the ID field is a reference to the user ID field that's coming off of the Segment event.

Seth:

Sothis will be refs.data.user_ID and you can confirm that by going and looking at the debugger, but that's the property name that's coming in. And then we'll want to pick the template that we want to send to right.

Shreya:

So just a little a question for someone that doesn't understand this stuff very well. How does Courier know that user ID is coming from Segment? Is it because of the trigger over here?

Seth:

And Ben earlier talked about how on the events there's all this meaningful data that gets passed along. So for identify events, you get traits about the person for track events, you get information that's about the behavior that they did, right. So in this case, it's information about the cart that they viewed. Right? And so what Courier does is take that data, that Segment passes on and we wrap it a little envelope and we give it to the automation so that you can reference those parts along the way.

Seth:

It might make a decision in terms of whether or not you want to send it. That might be because you want to reference it in terms of building the message up on it. Like in the example Ben talked about earlier, where there was a list of products, you know, if we were really going to the Nth degree and building a production version of this, the template would take that list of products and it would tell you all the things that you were looking at.

Seth:

Right. And give you some kind of information about it. So what we're doing here is saying, hey, the person we're going to be sending to is dynamic. It's a different person every time. And since it's a different person every time, we want to reference the data that's coming in from the Segment event.

Shreya:

Sounds good.

I guess I'm going to maybe rephrase my question and ask if the trigger wasn't there, like if the Segment trigger wasn't there, would this still evaluate to a user ID? Like is that the key component that ties this whole thing together.

Seth:

So automations can actually be invoked what I would call ad hoc. So what I mean is not necessarily in reaction to just a Segment event, right? So you can have a scheduled trigger rate that runs on some interval. You can have an API based trigger where you're calling Cuurier and say, Hey, go run this automation. And of course you can have the event incoming from Segment.

Shreya:

Awesome. Thank you so much for clarifying that. Yeah. So what's the next step?

Seth:

Yeah, so the last step is we need wire a template up.

Shreya:

Wire template up.

Seth:

Actually you can just select a template there.

Shreya:

Okay.

Seth:

An example Segment example. This would normally be your view cart reminder right. And let's publish our changes.

Shreya:

Alright.

Seth:

So what we've just done is in reaction to that event that happened, we basically created a very small sequence and that sequence waits some reasonable amount of time and sends the person the message, Well, what happens if they actually check out? What if they immediately completed the process? Right. We don't actually want to send them a message. So there's a couple more parts we've got to wire up.

Seth:

So basically what we need to do is say this needs to be canceled If they finish the process before the delay expires. And so there's two other things we're going to do. First is we're going to go into settings and see the settings tab at the top of the designer. We're going to put a cancellation token in. And this cancellation token is basically it's going to be a reference and we're going to go ahead and for simplicity, just use the same ref we had earlier.

Seth:

So refs.data.user_ID

Seth:

And what we're basically saying is when Courier sees this value is issued as a cancellation token, discontinue running this automation instance. So let's publish that change really quickly if you didn’t already. And that's it. We finished this automation. So we're going have to create one more automation that actually does the cancellation.

Shreya:

Right. I'll head over to new automation. Actually, before we do that, let me go back to this automation. Can we just try testing this out just to like see it live action.

Seth:

Awesome. Let's do it.

Shreya:

I will remove the delay and we can add that back in later. But I really just want to see this whole thing.

Seth:

That was so easy to do by the way.

Shreya:

Yeah, it's so intuitive. I love it. So we say that on the website, if someone clicks on the checkout step, then essentially that same user should get an email.

Seth:

That's right.

Shreya:

So let's go ahead and going to just click on a bunch of stuff again and then click on checkout since that's the trigger. And then I'm going to check out as guest just add my email and bring up the message. Okay, let me check.

Seth:

Yeah. So you can actually we can check career logs to start.

Shreya:

Yeah, let's check Courier logs. Alright, this is from yesterday. So I think we're missing something because didn't go through yet.

Seth:

Go to your automations tab.

Shreya:

Invalid step definition. Oh, did I type something wrong? No…

Seth:

I think that what happened, Shreya, is when we saw that little bug, do you recall where this step disappeared and then we just added a new one? I suspect that's the cause. Let's go remove the trigger from the one we just created.

Shreya:

The one that we just created. And I think this is around one.

Seth:

There's automations V one UI.

Shreya:

20?

Seth:

Second from the bottom right there.

Shreya:

Okay.

Seth:

You're just it can trigger also this one doesn't you can just hit the little x and publish that. Let's take that off and publish it just because we don't want it to trigger and let's just create a new one really quickly.

Shreya:

Okay, sounds good.

Seth:

I suspect that that issue where this step disappeared as the recall was there. So so just to recap here, we're going to add our Segment trigger.

Shreya:

Add our Segment Trigger, I'll click on track.

Seth:

Should still be in your pasteboard.

Shreya:

Oh, no. I think I added the rest.data thing, so I'll copy it from here. Then check out step.

Seth:

And then we'll want to do a send.

Shreya:

Awesome. Let’s go ahead and send over here and this is a refs.data.userID.

Seth:

You got it, and pick our template.

Shreya:

Pick our Segment example.

Seth:

Publish our changes. Okay, let's cross our fingers and try that again.

Shreya:

Awesome. Let me click on.

Seth:

I suspect that was the root cause there.

Shreya:

And then we've already clicked on the checkout step. So go into our logs again.

Seth:

Hey.

Shreya:

Something's happening. It's not great, but something's happening.

Seth:

Do you have a provider set up here?

Shreya:

I do. I should have.

Seth:

So let's go to your profile. Load it really quickly.

Shreya:

Yeah.

Seth:

Oh, let's go to request received. So with it, go all the way to the bottom for me at the bottom of the data pack. Okay, so it's not user_ID. Oh, okay.

Shreya:

We were just talking about this before the livestream. We were trying to figure out where it was.

Seth:

Yeah, I wasn't sure. So let's go back over to our automation really quickly.

Shreya:

Some little automated for them. All right. Over here.

Seth:

And let's just change that to be that publish our changes will trigger it one more time.

Shreya:

Check out and then we'll go over to logs.

Shreya:

Okay.

Seth:

And it is going to send. There it is! So it was sent to you. And so you can see we are in fact triggering a notification. Always casing, correct? Always casing. And you can see how we haven't written any code. We've written zero code. Right. We've been able to wire Courier up to send a message. This is again, we showed how to delay step plugs in there.

Seth:

Shreya should we complete the example and show how cancellation works?

Shreya:

Absolutely. All right. So I think there's something that I need to add, which is let's go to that.

Seth:

Yeah, we got to add two things, actually, so.

Shreya:

What's the right way to do that right now?

Seth:

Drop your delay step on.

Shreya:

Drop it on. Okay.

Seth:

And let's go ahead and plug our one minute value in.

Shreya:

Plug our one minute value.

Seth:

Then you can just drag and drop the dart connectors.

Shreya:

Okay, sweet. Awesome. Cool. Stick.

Seth:

Publish your changes and then we need to add our cancellation token.

Shreya:

And you said thats ref.data and then userID.

Seth:

You got the right one as well. And so the last piece is let's just go out our cancellation workflow really quickly.

Shreya:

Alright. What should I call this? I'll call this check out to.

Seth:

Check out remindeer.

Shreya:

Live check out Reminder. Right? And then I'll go to all automations. Whoops, my bad new automation.

Seth:

And let's go ahead and name this one, which is cancel check out Reminder.

Shreya:

Check out reminder so we don't lose them. And then. Alright, what's the next step?

Seth:

Okay, so the trigger here is going be another Segment event.

Shreya:

Alright, Let's go. And we're going to use a Segment event. I think there's a couple of comments. Josh said: “Person coding emoji.” Yes, that is awesome. Tejas said: “Copilot for notifications.” Suhas said: “Do we need to change cancellation to an alias to reference user ID?” Yep, that is right. So if you're watching this live at or later on and you're building this out, make sure that you don't make the mistake that we did.

Shreya:

Awesome. Let's continue.

Seth:

So let's do a crack event. Let's wire up I believe it's check out step completed.

Shreya:

Check out step completed. So I haven't gone to that part yet.

Seth:

Just pay. Pretty sure it’s check out step completed. Perfect.

Shreya:

So we want.

Seth:

All we're going to do here is add a new action.

Shreya:

Add a new action…

Seth:

Which lets pause here just so we can look at some of the actions. We know we only talked about delay and send, a bunch of different stuff that you can do, including updating profiles, subscriptions, invoking other automation, so on, so forth. But let's in this case, go ahead and cancel an automation.

Shreya:

Okay.

Seth:

And the token we're going to use is refs.data.userID, So this says cancel any token I'm sorry, cancel any running automations that match this token.

Shreya:

Got it. Okay.

Seth:

And so we're going to publish these changes. So let's go ahead and run back through our workflow again. Ideally the way we'll be able to prove out that this worked is that we'll be able to see the cancellation workflow run and we'll see the original one get aborted.

Shreya:

Alright. So in this case, I've opened the cart. What I'm going to do is I'm going to… I'll wait a minute. Let's lsee us actually get that notification first and then we'll do this process, go through the checkout process, complete it, and then see that actually it cancels out. This is really cool. I absolutely love how intuitive this whole thing is.

Shreya:

Obviously, there's a couple of bugs, but, you know, this isn't even out yet, so it's exciting to get a chance to play around with it. How are you feeling? So this is the first time you're showing this on.

Seth:

Exciting to see it live, right? Like we've been using it internally. Really quick Shreya. I think you actually have to click the checkout button to initiate the process.

Shreya:

Oh, you're right. You're right. I do have to do that.

Seth:

So like now, now that we've been hanging out, I think this is verified. Right. Let's go and look at automations logs.

Shreya:

Let's go look at our logs.

Seth:

We can we should see that in a in a 1043. That's why I did it. There.

Shreya:

It's a good thing you told me to check this and invalid step definition.

Seth:

Okay, well, we are doing it live. We are still closed on the access, right? Because we're getting some of the kinks out.

Shreya:

This is why it's exciting because it does this.

Seth:

I don't know if you want to debug this one live. Shreya, Im not sure, honestly, why this one is… We'd have to go look at that step definition. Actually, it's going to be on the delay.

Shreya:

It's going to be on the other line.

Seth:

The other line.

Shreya:

I don't think the name saved.

Seth:

Yeah, we saw that yesterday. Yes. So it's going to be the….

Shreya:

The other one.

Seth:

Yeah. 1042 I think.

Shreya:

1042.

Seth:

Nope! it was the one right before you got it.

Shreya:

The 36th one 1040.

Seth:

So the one…So yeah.

Shreya:

Yes. Okay.

Seth:

Looks okay to me but.

Shreya:

Should we try it. Should we just remove the delay and try it.

Seth:

We can delete while we remove it and try reloading it and see if that works. If not, we can just keep on moving forward.

Shreya:

Okay, sounds good. We'll add it. As you Lizzie said: “#Doitlive.” Exactly. And we're going to add another hash tag. Just, “#Doitlivebutwithaproductthatisn'tevenoutyet. So this happens. I don't think I've ever had like a live coding stream or any type of like product demo stream where things have gone perfectly well no matter how many times you practice it.

Shreya:

Alright, I'm going to publish this.

Seth:

You got to add the delay minutes in there.

Shreya:

Oh, the minute. You're right. And then try it. Just do it again.

Seth:

Yeah, let's just give it a try. We can immediately go over to the automations logs and see if it's… \

Shreya: Something works, right?

Seth: Oh, okay. That one worked. So something that was wrong with our original definition. Actually, if you click the one that's waiting right there. Yeah, that's the one.

Seth:

And so we should be able to hang out for a minute or so and it will come in. We could also alternatively complete the check out and watch it stop.

Shreya:

Watch it stop..

Seth:

So like it'll go into a…

Shreya:

Oh if I go ahead and click check out and….

Seth:

Check out and you make it before the minutes up and you pay it should cancel. So we didn't beat it.

Shreya:

Okay. That's all right. I can at least show the actual email though.

Seth:

Quick.

Shreya:

I didn't get the email.

Seth:

Go to messages.

Shreya:

Go to messages.

Seth:

It just hadn’t sent yet.

Shreya:

Oh, okay. 2 minutes ago. That's a different one, right? Mm. Or did it already send. And I just didn't realize it because I did get one 2 minutes ago.

Seth:

It's a process, we would have to look at the logs.

Shreya:

Well this is what it looks like when we zoom ina little bit and now what we're going to do is try to see if the cancellation works, because we know that the sent works. We're having some issues with the delay stuff. So for cancellation, I should go in here, I should check out and I should just directly pay. Do you think it's the the second automation that's causing the error?

Seth:

Click on to see what the error is. Let's see. It's the delay step. Okay. I think this is a false positive. This isn't the template we care about. This is another one that's listening to the same event. Shreya. What we care about is the one that's waiting. You want to refresh again?

Shreya:

Yes.

Seth:

Because of the process one. Oh, okay. So you got canceled.

Shreya:

Okay. Okay. That's good. That's what we were hoping would happen.

Seth:

Well, that's the cancel step. So close that one. And then the one that's four down is the other one we need to go look at real quick, because hopefully that one. Yeah. No, that's the cancel again. We'll have to go debug those two pages.

Shreya:

This is from maybe like an automation that I rolled out yesterday is that what it is?

Seth:

It almost certainly is.

Shreya:

Okay. Gotcha. So y'all ignore that one to be there. These are the ones that we care about. Cool. So that's my fault. I should have started with a new workspace instead of having one with all of my test automations. Cool. We have a few extra minutes.

Seth:

You see it there. Apologies. They are appearing. You see the canceled. 1047.

Shreya:

Yes.

Seth:

There you go.

Shreya:

Perfect.

Seth:

This made me nervous to not see it working. I'm actually glad to see those logs. The having the multiple unless there's definitely made it a little harder to for us to track there.

Shreya:

So here there is a cleaner view. We don't have to see the ones that have errors in them.

Seth:

And you can see you can see very acutely that the process for follow it here, nothing like doing it live.

Shreya:

Exactly. And the good thing is I didn't get that email and that's the main thing that we were trying to go for is once you actually finish the checkout process, you don't want your users getting that extra email. Otherwise they're going to get really mad at you and start emailing you. Awesome filter on the left seems handy. It is very handy.

Shreya:

I love the fact that it's here. Great. So that is pretty much the entire sort of workflow of how you can go from building out your website, getting those events, those user events into Segment. and then doing something with that information, such as communicating with your user as being like: “Hey, we noticed that you wanted to buy something and you didn't actually complete the entire process…

Shreya:

…So we're sending you a quick email reminder,” but you don't want people getting that email unless they actually haven't bought that product yet. So one more thing I'm interested in, which is the new Courier Segment integration, which allows us to kind of pull a lot of this information from Courier back into Segment. So would you mind showing me how that works out?

Seth:

Yes. So firstly, we need to go back over in the coming to Segment. All right. We're going to create a new Segment source.

Ben:

Guys, if I can interrupt. It looks like there's a question in the chat from Arnav.

Shreya:

I missed it. Thank you so much.

Shreya:

Question: “Does Courier provide multi-language support for AI powered notification templates or does it only generate in English and we have to manually convert it to a desired language?” This is great.

Seth:

Yeah. So on the outside you can, for example, like let's say you wanted to have a welcome message in Spanish. You can literally in the prompt just type welcome message in Spanish and it will support putting that value in Courier does have more robust internationalization and localization features that are available but those aren't those aren't AI powered explicitly.

Shreya:

Yeah. And in our Decode episode from last week, we actually tried translating things with the AI power content generator. We did it in like Spanish and French. But yeah, feel free to try in other languages too, and let us know if it works out for you. Which it should because it's powered by ChatGPT. Awesome. Let me pull this back up.

Seth:

Yeah. So we're over here in Segment really fast and we need to add a new source. You might have to delete one because I think you're on free.

Shreya:

I am on the free version, so I'm going to go ahead and delete my old one. Let's see. Delete Source. I'm going to delete one and now I can go ahead and add my new source.

Seth:

And so right now we're a customer source right now and so we'll need to wire up. Ben actually touched on this earlier on when he was talking about all the different sources that Segment supports. Right. And so what we've rolled out initially is a custom source from Courier. So if we go ahead and I think pick that custom tab there on the left under categories.

Shreya:

Custom?

Seth:

We can pick actually for ease, just pick nodeJS server right now.

Shreya:

So right. think we can just clook for Courier.

Seth:

No type HTTP.

Shreya:

HTTP got it.

Seth:

You add the source.

Shreya:

Add the source.

Seth:

And this is going to give us… Let's call this Courier.

Shreya:

Call this Courier.

Seth:

And we don't need to give it a label and this is going to give us a handy dandy right key. They're available as soon as it comes up. And what we're going to do now is going to take that right key and we're going to put it into Courier. So we're going to go over to our Segment configuration

Shreya:: Segment.

Seth:

And right there in the source section, we're going to put that right key. Just to kind of call this out, we do support a source key per environment. So if you were to switch between test and production, you would be able to put different ones in for different sources. That's it. What we could actually do is now generate some form of send. Shreya and let's actually just do this super easy and go back over to our logs and pick the last message and hit the resend button at the top.

Shreya:

So last message and hit send again?

Seth:

Send again. And so what this is going to do is trigger this message to get sent again. So let's refresh our logs and and so you'll see that message got sent. And just so we have a corollary here, you see the message was sent. The other events don't necessarily matter in terms of downstream processing. But do me a favor and could you actually go open that message really quickly.

Shreya:

Yes. Oh, in the logs.

Seth:

No, no, no apologies in your email. That was the right thing. Okay, let's do one and just refresh that page really quickly so we can see the sorry, the Courier page. So we can. Yeah, I just want to see the opened event in there.

Seth:

This server actually we have opened events. Therefore it what I'd like you to do now is go over to your Courier Segment source and go to the debugger.

Shreya:

Over to our Segment source and go over to debugger.

Seth:

Hey, now we see a message was sent. You can see it was sent to Shreya and you can see information about that. And then we can see that Shreya opened that message. And what we send is the first time that you opened it, we don't send you all the opens because that would be a little bit excessive. Yeah, we do something you the very first open in the very first click that comes across and the information about it.

Seth:

And so you can obviously take this now and wired up all kinds of really interesting downstream Segment sources. You can use this to sensibly like power journeys and power like profile data and all kinds of other things like that.

Shreya:

Actually, on that note, then, could you talk us through what Journeys is and how like what we could actually do with this information, with a journey?

Ben:

Sure. So the the same way that you had sort of the automation thing in Courier, a Journey is very much like that in the Segment context. So to take the example that Seth started with there and kind of riff off of it, what we would do is when the the person opens the message that would get tagged on their profile that we know now that they have received message.

Ben:

X-Y-Z And they've opened Message X-Y-Z And so now that those events are captured,imagine that you want to send that over for your analytics team to look at in a deeper dive. So all of the events, any time you ever contacted this user, how often does that person open emails? Is it really worth your time and money and effort to continue to send them emails or should you maybe back off and use your marketing spend a little differently?

Ben:

Maybe you see that they engage better with your SMS service than they do with your email. And so using the data that you would capture. You know, as Courier comes back in and you populate that information in the user's profile, you pass that information into the data warehouse where all of the analytics get done, and then you can start to update the user's preferences just based on how you see them behave.

Ben:

And so that that would be a really powerful story in terms of marketing spend. We're paying by the message, we're paying by the email. In a lot of cases, you know, it's paid in bulk, but you're still sending out a whole lot of messaging and you're paying for the privilege of sending out a whole lot of messaging. So how do you use that more effectively, especially in a time like this when it seems like everything's tight in the wallet, We're all trying to figure out where to to shave off costs, and that would be a great way to go about doing it, to be able to to see how people behave and go, you know

Ben:

what? Every time I send this email to Ben, he opens like one a week. Maybe I should stop sending him more than one a week.

Shreya:

That's really powerful. Thank you so much for explaining that and thank you so much for joining us. This was a really fun livestream. You know, it's always great to see things go wrong so that you can figure out how to make them right. And I think that's really important because when people are building this out on their own, they're going to run into bugs as well.

Shreya:

And it's nice to kind of show them how they can navigate through the logs and figure it out, you know, figure out where the problem is and how to solve it. Thank you so much, Lizzie and Craig and Arnav and Suhas and Kylie. You said hi at some point as well, and I forgot to say hi back to you.

Shreya:

Who else join us today? I think Josh was there. Dennis was there. Charla was there. Of course, Charles in a snowstorm right now. So that's crazy. Thank you for joining us. Nia also joined us a lot. So thank you all. Thank you, Nia’ cat, who is an inspiration to me, I think the cat's name is Gremlin, which is like the coolest name in the world, I hope gremlins watching as well.

Shreya:

Thank you all. Thank you, Seth and Ben, do you have any final thoughts, anything that you want to share, anything you want to talk about?

Ben:

Seth, you go first.

Seth:

No. I appreciate both of you being on the the stream and talking about this stuff. It's been a lot of fun.

Ben:

And I guess my sign off statement would be you can sign up for a free Segment workspace and try all this out for yourself. Come by and do that and hit us up If you have questions, will be happy to to point you in the right direction and get you started.

Shreya:

Exactly. And if you happen to try building out this project on your own, let us know how it goes. Tweet about it. Feel free to reach out if you have any issues and we'll be happy to help out. Thank you guys again for joining and we will see you next week on the next episode of Decode. Bye.

Ben:

See ya.

Build your first notification in minutes

Send up to 10,000 notifications every month, for free.

Get started for free

Email & push notification

Build your first notification in minutes

Send up to 10,000 notifications every month, for free.

Get started for free

Email & push notification

Platform

Users

Content

Channels

Sending

Workflows

Preferences

Inbox

Workspaces

Observability

API Status

Changelog

© 2024 Courier. All rights reserved.