Build an AWS IOT Button Slackbot for Beginners | James Hurst | Skillshare

Build an AWS IOT Button Slackbot for Beginners

James Hurst

Build an AWS IOT Button Slackbot for Beginners

James Hurst

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
13 Lessons (1h 10m)
    • 1. Introduction to the Project

      1:58
    • 2. Introduction Part 2

      0:59
    • 3. 500 Foot Technical Overview of the Course

      2:40
    • 4. The AWS IOT Buttons

      1:11
    • 5. Create or Login to your AWS account and setup a user

      3:31
    • 6. Download IOT Button iOS app and setup your button

      8:02
    • 7. Set up Button Manually Using the Configuration Wizard (Optional)

      5:46
    • 8. Create a Lambda and Link it to a Button Click

      7:12
    • 9. Create or Sign in to Your Slack Account and Test Your Button

      18:36
    • 10. James, I'm not going to buy a button (Mock button clicks w/ MQTT Client)

      13:24
    • 11. Simulate Double and Long Clicks with the MQTT Client

      1:00
    • 12. Join Slack Team via Secret Webhook URL

      2:46
    • 13. Thank you and Next steps

      2:34
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

29

Students

--

Projects

About This Class

What could be better than bringing together the world's hottest cloud offering in AWS and the rapidly emerging trend of the Internet of Things (IOT) and a favorite communications and collaboration tool in Slack.  Build a working AWS IOT Slackbot and at the push of a button, you'll be able to demonstrate your new found tech skills and impress your boss and co-workers by being an early adopter of these new technologies. This highly rated course taught by an AWS Certified Solutions Architect is just what you need.  Paper Towels out of stock?  Push the button.  Fresh Coffee ready?  Push the button.  You get the idea.   Just push the AWS button to take this course and get started on your journey with AWS IOT. 

Meet Your Teacher

Teacher Profile Image

James Hurst

Teacher

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Your creative journey starts here.

  • Unlimited access to every class
  • Supportive online creative community
  • Learn offline with Skillshare’s app

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

phone

Transcripts

1. Introduction to the Project: welcome to how to build on AWS i o T button Slack bought for beginners. This hands on project based course will take you step by step and teach you how to create an AWS i o t button slack bots. My name is James first, and I'll be leading you through the course. I began my career as a software developer. And if since transition to the role of an AWS solutions architect and technical trainer for Brigham Young University, I stay up to date on AWS by attending conferences such as Reinvent as well as on site training, that AWS headquarters I. O. T. Is a super hot topic right now, and it's experiencing incredible growth. This is the perfect way to get some hands on experience with AWS Iot Tea Service. By the end of the course, you'll have exposure to the coyote buttons, the AWS things and think types, MQ TT client and Lambda Functions and slack Web hooks throughout the course will go through and we'll talk about the different generations of I. O. T. Buttons will set up and configure the button to connect to your own AWS account, then create a land of function, using the code provided to connect your button to post a message to the slack platform. After that will create the slack channel and create the Web book that's necessary to include in the land of function. Then we'll move on to testing and give you some things to try if you need to troubleshoot what's going wrong. Finally, we'll discuss next steps and other projects you can make with your newfound skills. You know, the ideal student for this course is someone who likes computers and is interested in the Internet of things. Any basic programming springs will help, but all code will be provided that is necessary to complete the course. Thanks so much for checking out the course I help. You'll join over 1000 students enrolled. This course enjoys a near by star rating. I look forward to having us 2. Introduction Part 2: I welcome to this course on Amazon Web services. I o t button to slack integration. My name's James Hurst, and I'll be your instructor for this Course. You should trust me, because, uh, I haven't Amazon web services Shirt on. And I went to reinvent you. That right? Got reinvent sweatshirt? Uh, you have, ah, solutions are textured by associate certificate. And I work in Amazon Web services every day. And I'm excited to have you join me, as this course was on, and we discuss how to get a slack bought, working, like in a general channel here and slack. And get over here in Lambda, get a land of fire off some code and get working with our AWS t button. And, uh, well, let's jump right in and get started teaching and where to get these buttons from and how to get started. Look forward to seeing inside the course 3. 500 Foot Technical Overview of the Course: Okay, So before we get into the to the details of it, let's go ahead and talk about a 500 foot overview of what we're going to be doing, how this all works together. So you're gonna buy your button, you're gonna have your button here, which has the ability to send a WiFi signal right. And that's gonna send a secure communication with TLS to AWS Iot tea service. But the button asked to be tied to a certain account, right? And so before you push the button, you're gonna go through a wizard process that basically creates ah, policy that has permissions using I am. And then those permissions are attached to a certificate, and that certificate literally gets uploaded to the button itself. And so now that's the connection between the button and your specific AWS i o. T account. So that and using a private key in a public key, that's how the button nose it's tied to that certain AWS account. So once you've clicked the button, the button, then we'll listen. Uh, excuse me. The button will then trigger a rule that you have set. And here's an example of the rule which is a query statement. Select star from i o T button. Okay, so the button goes to the AWS Coyote device Gateway, and it sees if it if it satisfies the conditions of any of the rules that you have created in this case, it will fire this rule. So once a rule has been created, then you get to choose what kind of action that the rule will perform. So here's some examples of different actions you could do. You could publish to finish a string you can publish to an SNS topic or endpoint. You can read or write to a dynamodb table. You can put an object in S three bucket and in our case, we're gonna invoke a lambda function, which is right here. We invoke the specific function for our slack bought function. The function then is executed. That's a lambda, which is just basically code that's running in the cloud and AWS. And then that's gonna call on http Endpoint, which is gonna post into our specific slack channel. So hopefully that helps you get an idea of what we're gonna be doing. We're gonna start with setting up that button and go through the wizard to get the connection between the AWS account and the button, and then that will fire the rule, which then viers the Lambda, which then post to the slack jail so hopeful that helps let me know if there's any questions. If not, I'll see in the next lecture. 4. The AWS IOT Buttons: if you don't already have an AWS i o t button, you will want to purchase one to complete this course and test everything out. So the easiest way to do that is to head over to the resource is available, section it within this lecture. Click on that, and I've got two links here for you. One is to the first generation button, the others to the second generation. But the main difference between the two buttons is the amount of clicks for the battery life that it's been rated for the first generations. Rated at 1000 clicks for its lifetime, the second generation is rated at 2000 clicks. Now, in an effort to reduce their inventory on the first generation buns, they've lowered the price of 14 99. And they're giving you $20 in AWS credits if you're registering for the first time. Alternatively, the second generation button is $20.1995 it doesn't come with any AWS credits, so pick the best option for you. I've used both buttons in the past that both great get get those on their way using Amazon Prime, complete the course and see what you're going to be doing assumes a button arrives, and then when the button comes, you'll be ready to finish the course and test it out. So get those buttons on their way and we'll see you in the next lecture. 5. Create or Login to your AWS account and setup a user: Okay, So I am going to assume that you're taking this course that you are able to are smart enough to be ableto get your own AWS account set up. I'm assuming maybe already have one or that you're able to get that going your basic analog and give him your information and give him a credit cards off the insurance and charges that can charge you and go from there. If there's enough demand in the feedback in the comments section on how to do that, I will make another video for you. But let's just go ahead, assume that you have account already or that you're able to get an account going. So here's my account and I have my user name there and log in. I happen to have M f A set up on this account, which I highly recommend for you as well. It's not required to do the course Andren Okay, so we will be using landed later. First I'm going to do in preparation to set up your I O T. Button is to set up a user that can log in and do that through the IOS app for the Google or Google Android app. We're gonna go I am, Which is your user management section. And we're gonna go over here and creating user. Okay, that's hard. I o t button set up user. Okay. And we'll give him consul access. And let's do a custom password, which will be my password. 123 I want to take a stronger one. I'll be deleting this afterwards, but my password 123 Next permissions. Go ahead and give them administrator access. Okay, so I clicked on, attach existing policies directly and administrator access next review and create user. Okay, that's all you need to do to set up that user. Here will be the link that you'll sign in so you'll come over here and now we have R i O T button set up user and my password. 123 And we should go in old password. New password kids gonna make us do old password in your password. My password. 123 And we caught my password. 1234 My password. 1234 So now we're in. Okay. In the next lesson, I will teach you how to download the IOS app and talk about the Google play android app and we will log in using this long in user Hyoty buttons up user and we'll set up our button. Thank you. 6. Download IOT Button iOS app and setup your button: Okay. Welcome back. So this tutorial is on have actually set up the button tie I t button to your AWS account that you've got. So they made it really easy. And you can do it here in the console by looking at the i o T. Service. And we'll take a closer look at this later. But here, you got this getting started. Page, go ahead and click on that if you need to. And we have the registry here of things. So the i o t. Button is a thing and you would click register thing, you give it a name and what not when you use the i o. T. Set up through either the android app or the IOS app. It does all this for you. It provision of certificated provisions in the access key. And it just does all of this for you. And that's why I want to show you how to do that. I don't have an android device, but if I did, I would look for aws i o t app. Okay. Okay. So I'm just gonna search for eight of us. I t button. And there it is. That's the one you want. So you're gonna download that and walk through the process of installing the app and then taking barcode image of your come on, just like that's right here. Who? And then you'll provisioning the app units. We're gonna log in with your i T button set abuser, and I will actually do this. Walk through with you right now for the, um i o s version U S T button. Um, this is where it will look like on the desktop. Well, I'm gonna take you over here on my phone. We will do it right now. So I'm going to come over here and cook on the APP store to go search aws t. But And this one here is the one we want. Go ahead and click on the Cloud icon or the original download icon downloaded before we'll get that going. Open up. This is where we're going. Teoh, Uh, log in with our AWS user that i o t. But instead of user we created earlier, not the account owner, I'm gonna sign it as I am user here instead, So put my account name in which is James Hurst and my user name is I o t but user by ot buttons set up user Think it waas I'm not remembering. So let's go take a look. Yeah, i o t button set of user. Cool. Okay, user. Most password. We changed it once. My password. 1234 Hopefully that works. Where is Okay, So we're in your account, were logged in, and I got my money here. Okay, so I'm going to click set up and use I t button read over these instructions. Register configure set button action. I'm gonna kick agree and get started. Here's the barcode whose top here to scan the barcode. Let it access my camera and God. Okay, so I don't recommend you don't need this, uh, friendly name here, but you can keep it if you want. I was gonna get rid of it. I'm gonna register the button. Look, always working sooner for you here. That's the beauty of this app here. Okay, so these buttons here actually have a WiFi radio in them, right? In order that it's so we're gonna turn it on. We're gonna configure the button by holding down for six seconds, and it's going to start broadcasting its own little network. It's little WiFi radio, and we're gonna then connect to it to configure the button. So, look, it says here on the screen, hold the But now for six seconds until the blue light flashes. So here we go. 12 three, four. Fine. Six. There it goes. Okay, so that means it's in configuration Senate mode, and we're gonna go back to the phone. Now, we're going to the very bottom says copy, password to the clipboard. We're gonna be looking for this S s I d In our settings are iPhone or their android. So first of all, a copy the password to the clipboard. Okay, I just did that. Now I'm going to go look for my sons. Okay? Here's my settings. And if I go to my wife, I sayings, You'll see the new S I d broadcasting button. Configure me. That's only one. Go ahead and click on that, and sure that Need a password, which we've already copping to our clipboard. Okay, I just lost the connection to the iPhone because I just went to a different network. Right, So go back to But how? And select the network that we want to be on. There's one I can use. Put the password in. Okay, so I put the password in right now, I am connected to the button, which is why I've lost you on my other screen here. And we're gonna choose a different lambda at a different point in time. But for now, just pick, send SMS no Js and entering one number for the phone number and click set, and then click set action. Okay, so that actually configure the button, and then we'll go back into your account and we'll see the new button. Let's go see if we can find it right now. So I'm actually gonna hit five or control at five and see if we have our But And there it is. I a t button you nine x nine is the end of the serial number, and that matches up to what we have here on the box. You nine x nine. So we now have our buttons set up in this account with its serial number, and it's type and we will go to the next step in the next lesson of tying that button to an action which is gonna be firing the land on which then which then fires a u R l that connects to slack, which will post a message to our slack channel as a slack bots. I will see in the next lesson. Thank you. 7. Set up Button Manually Using the Configuration Wizard (Optional) : Okay, so I thought maybe something you might want to see how this is done manually, if you have to do it that way. So what you're gonna do is you just gonna head over to the AWS Iot tea service and then you're going to say, Click on, get started and then go ahead and click view connection options to connect to AWS i o t. And then configure a button for all the way down and you'll see the Tuapse that you can choose from or keep going if you want. Teoh, use the configuration wizard. So we're gonna interrupt device serial number. We're gonna fall the steps to upload the certificate and the key that will continue to set up the button manually. That way, we're gonna go ahead and click on configuration Wizard. I've got the button here to set up this part. Doesn't really matter. We're just gonna We're basically using a function for Lamb does. We're just gonna put test here, and we'll use on existing role like Lambda Basic execution record end up using this. This is the part That's key right here. AWS i o t section This is where we're gonna put in our device serial number, which has just found on the back here. My button. So mine is G 030 m d zero to 5535 you nine x nine. Okay, And once that validates, it will let me click on generate certificate and keys. So going to do that? Okay, So here's my two things that I need. I need to download this certificate here in the private key logo. Didn't do that. Now I'm gonna save it to this i o t folder on my desktop. And now also download the private key like that. Okay, so this is where we're going to get into the set up mode again. So place the button in the configuration load by holding it for five seconds. Let's do that Now, one to three for five. There it goes. Okay, so it's flashing blue, which means it's broadcasting its signal. So you should be able to see this here on my laptop. Come through in. There it is. That's what I want to connect to. Oh, what's it doing? Okay, I got that. But it's gonna need a password, which is the last eight digits of your, um, serial numbers. That's good. And copy those. So you would need to put that in right there, which I've done it once before. So it might be remembering it if you were going to this for the first time. You probably just need a paste, your password in right there. So let's see. It's gonna let me connect to it or not. Okay, I'm not sure if I'm connected or not with us status symbol like that. But let the best way to check. Let's see. Best way to check is there's actually a little web page that's been built into that button and where how we access is right here. So I'm gonna control Click this. We're actually right. Click and say open in new tab and see if we can actually configure the button. There we are. So this is where I'm gonna pick my home network here, and I will need to use the password. And then now we're gonna up load those two files that we had done earlier. This is how we make the connection between the button and the account. That's kind of the security feature there. Let's go get that certificate right there. And the private key is right there. Gives us the end point in the region. We just click, okay? And then configure. Okay, so we have the button hill, and it's just gone from blue toe white blinking. So now I want to make sure I get back over to my old network from my home, and I'm gonna go back into my AWS account so it looks like I already automatically switched me over to my home network. Okay. So should go here and continue on with the instructions. So we've clicked, configure, reconnect to your original WiFi network. Um, it's a stop blinking blue. You'll see a white blinking light fall by a green solid light. So if we've done that, it should be all working okay away. To check is to go and see, Go back to AWS i o t. And then look in the registry and see if our new button is found. So go over here to manage and things. And there it is. I think so. I think Yepes of the united X nine That's matches what I have here on the on the back of the button. That's how you would add the button manually, so hope that helps. This is an optional lesson we'll see in the next video Thanks. 8. Create a Lambda and Link it to a Button Click: Okay, welcome back. And thank you for continuing on this journey of setting up the coyote button, getting that to create a slack by integration. Let's take a look around in the consul here in eight of the U S and see what resources were created by going through that set up process. We have our thing, all right, And you'll also see her here, A rule which was created our on our behalf. What this does is it says select star from my O T. Button, then the serial number of our But so that is the rule that is listening for the button clicks. Okay. And so when the rule here's a button click, so to speak, it fires this rule and then it takes an action. You can choose from a variety of different actions. You could insert a message in the Dynamo DVD. You can invoke a lambda. You could send messages in this in this in various different actions that you could do by setting up and choosing the node.js action. It created a land before us using the blueprint, and it is set up that we push the button to invoke this lambda. Okay, Let's go. Look at that Lambda. No notice up. Here we are in the Oregon region. If you're not seen, the resource is he thought he created Make sure you're in the same region Is before Here is the function that was created by going through that set of wizard. Let's take a look at closer. So here's the code. And I put in an eight for my phone number. You can see it took eight from the Senate, wizard and put it right there is the constant for the phone number recently about my whole phone number is that I don't want to use this code. Uh, I just need a pointer to another land we're gonna create next. But you could see here under configuration that it's running node.js. And it's set up on existing role for us to run the Lambda, and it has a trigger of aws. I am T. But Okay, so what I'm gonna do is actually delete this and show you the lander that we're gonna be using to fire our slack button. So the dysfunction here. So in your course here, give me it. Says creator landed and tie it to a button click. That's the step that we're on right now. I created Resource the code for you to download, and I will thank you to come over here and download it to your computer. Like So. Okay, so then come back over the Lambda, get started now, if necessary, and create a blank function. We'll worry about this later, and we'll click next. My function name. Let's call it slack, but function button my slide clock and we will choose No Js 4.3. And here we're going to upload the ZIP file that we just downloaded. Okay, here is the code we just downloaded there has been uploaded and, well, she's an existing rule and we'll use a service role of a i ot button which was created for us. And that's it. Quick next and review what we've done and click create function. There you go. So our function has been treated and as an example of what you could do is it you will be putting in your your else? Here we will be getting that from slack later. And I like to have ah production. You are well and a test you are also I might send the centre your l to myself personally in slack. That doesn't bother anyone else while I'm working on something. But then when I have the production code ready, I will switch my comment to where I'm using. The production we relegate might send it to the General Channel. The rain of channel, whatever channel you decide. So I have the two different your bells there to choose from and what we're testing. We're gonna have this one. A NCAA meant ID, and this one here will be common it out. Okay, let's look at the code. What is doing here? It's, uh, toggle ing on the clip type A single double and long. So as an example, you have a thing that you told the thing on average. But let's say and we will populate these later. The room long description and the room number. So let's say that coffee is out on the first floor. Break room room number 200. Well, that could be attributed to a single click. Let's say there's fresh decaf. Three. In another room, we'll double click could signify that. And let's say this fresh black coffee in another room along click could signify that. So that's how you toggle between the different click types, and a single click is about half a second. A double click is to single clicks right back to back and a long click. You hold it for 1.5 to 2.5 seconds to trigger that off button, and then it just calls this function here. Send the slack and it passes passes in this message to your channel. That's as much as there is to it. Pretty slick. Okay, so we have created our new land, a function that will integrate with slack. And now it's time to go back to AWS i o. T. And connect the rule to that land of function since going back to that rule. But triggers on that button is clicked and see how, since we deleted that function before earlier, this has been removed now, so there's no action here, so it's going at in action and will invoke a lambda could configure action, and this is where we'll choose our function. There's only one in there right now, and we'll call it the slack bought function that we named earlier, and we'll click at action. Okay, so when this rule fires, that action should trigger the lander. So we're very, very close to building, push the button and have a populated message into slag. In the next lesson, we're gonna create a slack teen or slack channel and create the euro, get the endpoint to pass. A flatlander will be calling so that we can actually pet post a message to slack. We'll see in the next lesson. 9. Create or Sign in to Your Slack Account and Test Your Button: Okay, So in this lesson, we are going to sign up for a new slack account in case you don't have one already. And we will get an endpoint for the Earl. And we will be putting the endpoint into the land of function and will be ready to test the button quickly. So Google here and look for a slack and we will sign up for a new team. I will create a new team. He's lying Email address for you, to me here I created for this course here. Confirmation. OK, so go over here to my email and confirmation code 219 to 1, 29 to 1. We go. Well, no surprises here. And continued password, the password, my password or 234 for a week. But no, I'm keeping this for very long. Probably use, like for other testing. I hope that it's thousands of people. Let's see this and you'll help me do that by sharing. This, of course, is giving it honest detail reviews, I hope. Thank you. Uh, what should we name it? Let's name it. You know me. Alia's I o t. Here. What's ring? Angry. Okay, I would say you on the invitation if I had your email, but I don't. So I'm gonna skip that from now. And here we are in the Web interface of slack. So it usually comes with a general channel and Random channel. Here's ah channel to myself. I talked about how I might have the baht send messages here first for testing. And then maybe when I'm already to go, I'll get another your AL and send it to the General Channel. Everyone will see it. Okay, so let's go ahead and go get our euro for us. Like, But let's get one for our own private channel. And let's get one for the General Channel That will go from there. Okay, so let's head over to slack maybe i dot com ap i slacked dot com We are locked in. Let's start building and let's name this coffee, but we'll put it on our new team. We just created Click Create up. So what this is is an incoming Web hook. So that's what we want to click here. Incoming Web hook. So I didn't activate it, and right here we'll click. Add new weapon to team, so we will so much of the test, you are helped to myself individually, or we're testing it. Click Authorize. Okay, so that will be the Ural that we need to put in Orlando while we're here. Let's do another one. And let's post to general. Well, it's all ready to go. Okay? So if I wanted to add a little cute icon to make this even more polished couple here basic information, cause I'm in my coffee pot and then we're going to basic information, and I can add an app icon and a description So we'll see fresh coffee, but and we'll do black. Let's go get a coffee icon. I do know we have to be 5 12 coffee. I can pain. 5 12 I'll see that headache of having Teoh find the right size that still that guy factual . Eventually it's going to see this a czar coffee 5 12 And over here and upload. All right, This makes it with a little more polished, more professional, which is what we're all about Here. Uh, okay, they go. So save these changes and the local back and grab those you or else and put him in our letter. Okay? so incoming with hooks. Let's go grab this guy will copy him. This is to my channel copy and let's head over to Orlando and we're just gonna edit this right in line. So the test you are well, but this one here and then for the General Channel. Let's put that right here. Okay, so there's a couple more things when you do before we contest this first, let's just say what we got. As you can see here. It's gotten if statement based on the thing type name being an outage button. And it's also got some attributes of a long description in a room number. So we're gonna going back into eight of the U. S i o t and set this up so dysfunctional work, and then we'll be almost ready to test our but Okay, let's go over here s i t. We've got to make ourselves an outage. But so registry things types were created. Thing type. Call it an outage, but this lets us know when coffee is out and it has some attributes, All right, It's got attributes of room, long description and room number. Let's get a copy word for word so we get it exactly right. This has to match. Okay, So, adage, but needs to match right here. Average, but needs to match the end. Long description. Needs to match. I guess the other one. Remember? No creator thing. Type everything type now we need to tell it. That are thing. This button is a type of that type of but on outage button. So that's where we do that is inside the button and at the type. These will go away because we're changing the tight it it change it to an average button room on description. Let's call it the first floor break room. And I have Teoh not have spaces in your doesn't like that. So that's why have those underscores keeping it all together and the remember, Let's call it 22 04 Okay, so we're trying this these attributes to that specific, but you could have more buttons with different attributes for different break rooms. Okay, so that should all be set up. So that button is gonna call that rule or this ruling that butter together. I'm gonna call that land, uh, in the land that we have set up to call the easy or else I'm anticipating. But push this button a single click that I will get a message saying coffee is out in that room. So let's head over to our select channel. My personal channel Untested. Live right now. I was scared. Okay, So you can see here. Says added coffee bought integration. So that that part that's working Here we go. Live demo. Oh, uh, okay, uh, Troubleshooting 101 Let's make sure we saved everything. Test it. Saving test. It's like, but function is not authorized to perform described thing on the resource. Okay, so this is a good example of something that might go wrong. Some troubleshooting there needs this. Landed in certain roles to be able to execute different functions. And the configuration here. It's gotten a rule that does this. I actually want to create a new rule, create a custom role. We're gonna give it all permissions to eight of us. I o t. Okay. So we will do, man, what's called this, uh, create a new I enroll for I o t. And lets you policy document and let's allow. So now let's go back in that I am and give that role the ability to do everything with i o t. So where is our little right here? Yeah, let's edit it. Create post. He was a policy generator, and we will give it eight of us. I o t full permissions for I o t for all resources. There we go. Those apply policy. Okay, so let's check this out, see if it will work now. Configuration, You got our existing role. We want to use our other rule here. I want to just make So let's save that you're back out. It's try this again tomorrow. So it actually didn't work the first time. I had to do a little bit of trouble shooting, and you might have to do some trouble shooting as well. What I did was reconnect my butt into the Internet. I'm not sure I lost the connections. I went through that process again, setting it up, making sure have it the Internet connection. Um, but as you can see it, my message came through. Let's go ahead and do it again. Live so, uh, single click should sugar a message. There it ISS, and there's a double click should share your message There it is. Okay, it's working. And then along hold 1 2.5 So that registers is a long hold. There you go. So it is working. Let me show you a couple things I did in trouble. Shoot what I thought maybe was going on. So over here in Atlanta, I came in and put some console dot logs out. So you have a console that log here, and I could just put whatever Let's say I just want to verify that it's even getting into the function so I could do something like this. They got here to lying 18. Okay, so we'll save that. We'll need my closing imprint. This is there closing semicolon. I should sing. So every time a button this click, it presses Every time a button is clicked, it triggers these cloudwatch logs. Basically, these is logging functional. You can tap into, and I'll show you have Yes, I'm adding that semi colon, I'm saving it. It's actually over here under monitoring, which is a good way to get to it. So I will click on monitoring here, and you can see my invocation count different things on right? Here's where you want to go view logs and cloud wash. Okay, so it's sorted by the date that it was created, and I'm gonna go ahead and click the button right now, and it should send a message through your channel again. A single click. But let's also go and see if we get a new lie. So we're at 14 4 years, our latest. There's 14 42. Let's go See, we confined our debugging message in there. There it is got here, toe lying 18. So that's one way that you can use to troubleshoot what's going on in your application for me. In my case, I just need to reconnect to the Internet, and it seemed to work just fine. So that is the real life of a programmer. Is not having work the first time around having to do some trouble shooting, but it wasn't too bad. What's next for us? Well, let's go ahead and add our production. You are well to the General Channel. Let's come back over the slack a p I and get art euro for the General Channel. Copy that there. Let's go back over to our Lambda and let's put in our production. You are well, do the General Channel and let's demonstrate how we will come in this out and then uncommon this out and we will save. Let's go ahead and let that safe. And we will go back to our General Slack Channel and click the button again and hope for the best of luck. There it ISS Life is good. Things were working in a double quick and a long cold 2 2000 Maybe I do. There is So that is working. It's no longer posting Teoh. Uh, this channel, my private challenge got posted to the General Channel. Okay, well, that is the crux of the course is getting that code firing on the AWS i o t button posting into a slack channel as a slack pot. In the next lesson, I will wrap up here and tell you where to go from here. 10. James, I'm not going to buy a button (Mock button clicks w/ MQTT Client): Alright, guys. So put in the extra hours for you and proving this course. This is update. Since I released the course, it's after midnight. Um, as you can see here And it occurred to me that some people are not gonna by the AWS i o t button. Maybe it's because they don't really want one. Maybe it's a little bit of a stretch on the budget. Um, so I've researched a way that we can actually simulate the button clicks in AWS i o t So if we come out here to Google and search for M Q t t view message, what will end up doing is getting to this page here. Okay. View device in Kott Messages with the AWS i o T m Q T t client says you can use AWS i o T client to better understand the empty T messages sent by a device devices published and Kott messages on topics you can use the AWS I OT and CTT client to subscribe to these topics to see these messages in the console in the left navigation pane choose test. Okay, so we're gonna go into aws i o t click on tests, Okay. And then we're gonna subscribe to the topic, and in this case, we're gonna subscribe to I o T button plus. Okay, so right here, then once we hit subscribe topic, it will come over here as a topic to subscribe on and we'll click on it. This topic should appear under the subscriptions. Choose it there. Okay, Then it says Press your i o t button and view the message in the AWS coyote client. If you do not have a button, you will simulate a button press in the next step case. Let's get up to that point right now. So let's see, Here is the AWS i o t console Click on test, and we're gonna do i o t button such. Plus, it will subscribe to it. Okay, so I just popped up over here. So we click on that, we can seen messages that come through. Now we're gonna publish a message to this topic. OK, so let's go back to the instructions. And it says to publish the message using the baby s I t console. Specify a topic. So right here i o t button. And then in the message payload type the following Jason. And this is actually exactly what the coyote buttons actually sent. Except for the serial number's gonna map up with the serial I d. That's on your So your button here with these ones. Thank quick type voltage. So I'm going to do here is I'm going to copy this, Jason. Right? And then I'm gonna hand type in just any old coyote button. Um, topic. Okay, So, for example, the i t. Example. Topic. So it paste this in now. It published a topic boat, and there it goes. So it's listing on this topic. Anything i o T button and after its listening on. Okay, So how do we get this concept to work with our, uh, code? Right. So let's go look at the code. Okay, Let's look at the code here. So it's gonna come in here, and it is going to look for a thing name with I o T button and serial number or that device . I d. Okay, But it's also gonna come in here and look for something to be of a thing. Type of outage button. Okay. So what we're gonna do is we have to go create the thing. So we're gonna come over here and get create. Let's give it a name. Um, ABC 123 Okay, create a thing. Now we've got our new thing in here. Okay. A B C 123 Or actually, let's try to make it exactly like the one we have here on this so we can use this code here . It's where thing is gonna be this long one. Here, take that. We'll copy it. Go make a new thing. We could just call it. Who? That. Okay, Now let's remind ourselves with the lamb is looking for what rule it will call. So the configuration or the triggers? All right, It's going to call this here, which is gonna call this rule. It's looking for any topic. Anything published on the topic of I O T button. All right, what's he gonna do is gonna call this Lambda. So what we have to do is publish on that I o t topic. You head over here, right? We're gonna publish on that topic, gonna copy this here, and we're gonna paste it there on the topic will be This will be I ot button topic okay when we published this topic that's basically simulating a button click. Thanks. And if when I click it I'm expecting that I should get a message in this General channel. Right? So let's do it. I was too. Topic first of subscribing topic. Do I o t button pelt. So we'll see it come through here. Hopefully, but will we see it come through in General Channel? Off topic. There it is. Okay. Do we see it come through in the general trail? We don't. So how do we troubleshoot this? Let's go look at the Lambda who did the land of fire. Right? So let's go over here to Lambda. You go find our function. Slack bought fashion Goto monitoring and view logs and cloudwatch. We'll look at our latest logs and see what it says. Look what it says here. Got here to line 18. Resource Not found exception. Hyoty button. Every city isn't that failed. Okay, so the code is looking for something that has the name of I O T button and then a B C D e f G. So does that match up what we did back here? We have our rules. It's good or registry of things. So you notice this Notice this structure here without e button i o t button underscore. And then the serial i d. So that's the exact same pattern that we need to follow when we make our thing So these air not gonna work So we've got to do i o t button underscore a B C D e f g Let's make a new one try. Okay, so I'm just gonna copy that again from here. I'll see what I leaned up right there. So we want this to be the same structure is a button that I had and I o t button A B C D E f g create the thing. Okay, so let's go try it again. Because now we've got our thing in the right structure as the but seems the button. We can go and delete these and let's send through our misses again on that same topic. Um, you know, what was the topic? Came through there. Didn't make it to our General Channel? No, did not. Okay, again, let's go back to the Lambda or let's go back to the crowd. Wash logs. We'll go back up to the law groups. See if there's anything new come through. Come into the this latest logs. See what says no. What does it say? Staring one I o t button. Obviously not found. Mm. So if you look here, you can see where it was having troubles finding it before and then on these latest ones and see it's actually executing. Got tow line 18. We'll get it again here, but it doesn't really throw any errors. And if you go back to the General Channel, there's nothing there either. Okay. And if you look at the code more closely, you can see that it did get to line 18. We have our ceiling i o t button structure set up correctly, but right here is where we're actually exiting the code because not set up is an outage button. Okay, I'm gonna go back to AWS. I o t up here and I'm going to sent my button up. Did I lose that guy? It is my button. Here he is. So I just refresh the page. Here is my made up button. My fake one. I'm gonna set this up as a out his button. Like before. Really long description. This is my A little description. Remember? Um 22 05 1234 It will update that. So now let's try it one more time. Let's publish on that same topic. This topic is to the i O T button topic, which will hit the rule. It should fire the Lambda. Hopefully it's up correctly. Let's go and check the General Channel. Nothing there. Okay, let's fire that published a topic. Go check the General Channel. There it ISS Okay, so that's all you need to know. You're gonna set up a create your fake I o t button thing right in the registry. You're gonna create thing. It's going to be an i o T eyelids button. It's gonna have the structure of i o T button underscore this. Okay. And then you're gonna fire topic on. Thank you, Titi client on the test here, here in the AWS I ot console and you can use this for the payload, which you can find and copy from the docks here on view in county team message dot html. Get that from right there. So you don't even need an AWS outage button to test all this course out. And hopefully that helps you save 20 bucks. 15 20 bucks. Thanks so much. And I hope you enjoy the rest. Of course. 11. Simulate Double and Long Clicks with the MQTT Client: Okay, so there's one more really cool thing you guys gotta try. And that is we already have co that's set up to listen on single clicks, double clicks, long clicks. What if I wanted to test those up? We just come in here to your payload and go double. What was the topic? Great. Any changes up there? There you go. Fresh decaf in the long description Does, uh right. Just like that, it's traveling more long. What I think's gonna happen. Well, let's go Lambda. Take a look. Long, fresh black coffee. OK, and publish General Channel. There it is, guys. Software works. So check that out. Take a look. Experiment with that. Hope you like the MQ TT client. 12. Join Slack Team via Secret Webhook URL: Okay, So I thought of a fun way that we could kind of keep in touch throughout the course and after the course. And that is that I'm gonna take this girl this weapon curole to my personal channel here. And I'm gonna give that to everybody. We're going. Copy that. Throw it into no pad. See here, and I will save that and upload it to the course. Free to use What I want you to dio is throw that right here. I was using for my test your web book before we send it to the General Channel. So what I'll have you do now is this will be pointing back to this environment that we created in slack that this you to meet slack team. You did me aws i o t. And what I want you to do is point your stuff to this u r l And then I like you on your single click. Put in something like, um, please invite me to this slack team. My email is O. J her start you to me like its spell at gmail dot com. All right, he put that in there, push your button or send the empty T t message. And hopefully, if everything I'm thinking is working foods working the way I think it should, that message should post to me personally in this lack team. Okay. And the way you'll find out if it works is this is if I get your email address in that message that I go into slack as the admin and send you an invite. Then once I invite you, then we can hang out there and answer some questions, possibly or keep in touch on future courses that I'm making. So, um, you have to try fee. If that's something you like to try, get invited to this special slack team created just for this course. I use that you are l there, which I'll upload is a resource and point it. You have to uncommon it and pointed to, um, this new slack channel. Send me your email. It will go to me personally, and then I'll use that to send you an invite on slack. So I hope that would be fun for you guys. I can't see. You can't wait to see who will be the 1st 1 to ah send me their email and seeing the people we get in the selecting so trying that out. Thanks 13. Thank you and Next steps: Hey. Well, a big congratulations to you all for finishing the course. I hope you enjoyed it. I've enjoyed making it for you. I'd be interested to know what other courses you'd like me to make as I have time to do so I just want to give you a few more things to think about. As you continue your journey with AWS. I o t a few more things on where to go from here. One thing you could easily do would be that get another button and add more buttons to this application. You could add more room numbers and different room locations. Teoh have a button in every break. Rumor. Maybe the bathrooms got so bad stock or paper towels out of stock. Whatever you can think of what makes sense to push the button and truth or something in here in the slack environment. So if you do end up having multiple buttons, there is something you need to know. Which is that the rules that you're using? Aws I t I o t will need to be a little more generic to capture all button clicks in the account. So let's go take a look at that. If I wanted to capture all button presence and not just the button of, uh, this specific one with filter on this device, I d this serial number. What I'm gonna do is just back that out a little bit and add a pound symbol. If you do that, everybody in the account will trigger this exact same landed. And that's how you get on your way to have multiple buttons in your camp. What else can you do as you saw? The IOS app has a lot of these different blueprints that you can choose from. And I would encourage you to go through their go and sweat that to the left and click on the Land icon. And this shows you the different land of blueprints that you can choose from. This would be a great way to get more familiar with a little bit of python a little bit more node that I have t t. If this then that have you experimented with making things on that platform? So go ahead and point your land into these other blueprints on sending an email or sending a text message and see, see what kind of progress. You could make seals you can build on top of it or continue to make your own custom functions like we did here in point. Your land is there and see what you can come up with Their I've really enjoyed making this course for you guys. And I hope you leave me positive reviews, honest reviews and let me know if you have any questions. And I look forward to seeing you in the next course. Thank you.