Skip to content
by Unity Nodes
NEAR Protocol

Pagoda Console | Automations with Alerts & Triggers | Hue Lights + NFT Mint!

about 11:18 long

Nothing is loaded from YouTube until you press play, and then without tracking cookies.

About this video

Join Dorian from the DevRel team as he showcases the power of automations on Pagoda's Console! Using the Alerts & Triggers features you can connect on-chain conditions and events (like an NFT mint event) to reactions via webhooks such as... automatically tweeting the new mint, or turning on your hue lights in Dorian's case!

This is an example of how flexible this system is - with webhooks you have a white canvas to create automations that grow your dApp's power. From reacting to a security event automatically, to notifying users of certain events.

👉 Get started on Pagoda Console: pagoda.co

👉 Got questions? Chat with the Pagoda team in the NEAR Discord. near.chat

---- Join NEAR's community: Website: near.org Reddit:   / nearprotocol   Discord: near.chat Medium:   / nearprotocol   Blog: near.org/blog Twitter:   / nearprotocol   GitHub: github.com/near github.com/nearprotocol Dev Docs: docs.near.org Create a wallet: wallet.near.org/create Apps on NEAR: awesomenear.com Learn to Build On NEAR: near.university Grants & Funding: near.org/grants #Blockchain #FutureisNEAR #NEAR #nearprotocol #nft #dao

Transcript

2,475 words

Captions as YouTube publishes them, usually machine-generated, so product and people names can be misheard.

  1. 0:00

    so the Pagoda console is capable of many different things if your mind to it you can use some really cool creative projects in this short video I'm going to show you guys how to turn it on and off your lights whenever entity gets minted with that let's get started so in this short video we're going to be using the Pagoda console to essentially let us know whenever nft is minted by calling a web hook on an endpoint in

  2. 0:26

    IFTTT IFTTT stands for if this then that essentially if an ft gets minted then we're going to be turning on our Hue Lights so yeah with that let's just Jump Right In okay everyone to begin this video I want you guys to head over to ifttt.com create your account and once you create your account you should be sent to this Explorer page so yes forget IFTTT stands for if this then that essentially it's a

  3. 0:50

    Trigger action service that allows you to integrate multiple different types of services together such as YouTube or Spotify if you like a Song in Spotify it can appear in YouTube playlist or maybe even like time and your temperature apps like it may be like you have like a smart device in your home and you know if it because if it's like 5 p.m you can turn on or turn off your AC and also play a song If you want to on Spotify it's a way to automate your life it's

  4. 1:15

    really cool so uh very first thing we're going to do get started uh with our particular uh with our particular applet which will essentially be a web hook that will allow us to integrate that web hook into our Pagoda console so anytime nft gets minted we get notified by it by our Hue Lights turning on um so go over to Services right in this little tab here and then search for webhook that's gonna be a very first

  5. 1:38

    step so web hooks so this web hook essentially will allow us to interact with the endpoint that exists on IFTTT that we're going to send to our Pagoda console um so that any time that endpoint gets called our Hue Lights get turned on so head over to documentation and we're just going to leave this page alone so we're going to leave this page alone we're going to come back to it

  6. 2:01

    um now hit either this create button or this create button it doesn't matter which one it'll they'll both lead you to the same place now you have if this then that if this is a trigger then that is the action that will occur once that trigger gets triggered or gets stripped so hit add and search for web hooks again it's a web hook now select this option that says receive a request essentially that trigger a

  7. 2:25

    fire every time the maker service receives web request to notify it of an event so anytime this endpoint gets called something will happen now we can give this particular endpoint a name so let's just name it nft underscore mint then that will be your action so uh first we're going to do hit add right so our action will be Hue uh so our action would be our actual like our lights turning on or off right so search for Hue select Philips Hue and select turn on lights now I should go without saying

  8. 2:58

    and we're not sponsored by Hue by the way but you go with that saying that you in order to be able to participate in this demo you have to have like a Hue Lights a hue bridge and a hue account um I hope you guys do if you click on this video or if not then I hope you guys are having fun watching this awesome thing you can do with whether you know the Pagoda console um but yeah so if you're if you don't have it keep watching it's just for fun

  9. 3:20

    so uh first you should add your account if you have a hue account that's very easy just follow the on-screen prompts every added mine uh so the things I'm going to actually focus on is like you know would you like the ones are on or off so I'm just going to leave this to all that's just going to turn all my lights on or off every time I get an NFD minted I'm going to hit create action and essentially there you go you know you have your central applet like you have your if which is the web request from the web hook and then then which is

  10. 3:45

    the Hue Lights so hit continue and then we're going to actually take this name and copy it for a minute before we hit this finish button so again take this name copy it and then hit the Finish button um you don't have the copy it's a very short name uh so now we have our name copied we're just going to paste it inside of our documentation page so I'm going back to that documentation page we opened up earlier and pasting my name inside of

  11. 4:08

    this like events line here so paste it over the you know everything here including the curly braces just paste the name nft mint now you know for some reason anytime I try to copy this thing it like it gets cut off there so what I like to do is like to go down here because it's the same link it just like copies entire thing here and you know I'm gonna I'm just gonna have them a clipboard for later um so now uh we have our we have our applet created right we can even get

  12. 4:33

    like notified anytime this runs it sends a notification to the IFTTT app on your phone anytime this actually happens so it's another cool like feature they have um so we have this right created and you have this so now I'm going to head on over to console.pagoda.co I'm going to log in and I'm going to hit create I'm going to hit examples and when we hit non-fungible token after that I'm going to hit this deploy and explore contract button essentially

  13. 4:57

    that's going to create a Dev account for me and Dev account is essentially the same thing as a normal account on near the purpose of it is so that the name is automatically generated so you have to come with your own like name while you're experimenting with your different smart contracts it's meant to be disposable so you can do things like change the state make sub accounts it's

  14. 5:14

    automatically fine with 200 test net tokens and it's meant so that like uh you know you the user don't doesn't have to use like real tokens to be able to experiment with your smart contract on here it's very very handy but just know again it's the same thing as normal account it's just meant for to be disposable for experimentation so hit the name of the dev account and we're going to first initiate this contract so every contract on here has to be initiated which essentially lets

  15. 5:39

    you set uh metadata for that account or for that contract so in this case we're going to like set the owner of the smart contract as us um uh one more thing about initialization functions that they can only be called once so once they're called they're going to recall again or also throw some error so it's typically called once per deployment I should say um so great so we're signed in we have our wallet uh attached or signed into

  16. 6:04

    this account so we can sign transactions using this particular account name on you know onto this uh onto this contract account we cover call function on that contract account so hit uh new default metadata that's going to be the initialization function we're going to call so we're going to set Blockhead blockhead29.testine that's my account but you should put your the name of your own account because I don't want to be the owner of your smart contract

  17. 6:27

    um so uh hit block edit 29.test net or your account name wherever you sign in here with it hit send transaction so that's going to Simply initialize the uh the smart contract for us as I said a bunch of times so great transaction sent successfully so now we actually have our contract initialized we can head over to the alerts feature which is my personal favorite feature um on the Pagoda console so the alerts feature is really really cool so it's going to monitor a contract by the way when I say monitor a contract that's the

  18. 6:58

    same thing as monitoring an account because every con every account on near is a smart contract it's just whenever you make a new one it's an empty smart contract so um again let's say one more time every account on near is a smart contract this one again might say monitor smart contract I'm saying or monitoring an account that owns a smart contract so hit new alert and select the contract name we want to monitor right so this is

  19. 7:22

    the dev account name we're going to monitor now again essentially it's going to monitor its account so that and if any specified action that we desire occurs on the smart contract we will get notified in the form of a message sent as a telegram message a web hook or an email so the conditioner setting is a successful action so anytime a successful action occurs on this smart contract a successful transaction same

  20. 7:45

    we're gonna get notified of it so and how we get notified again telegram webhook email so literally send you a telegram message or an email like if this if a successful transaction has occurred on this smart contract we're going to select the web hook option so anytime like a successful transaction occurs it's going to Ping an end point for us and that endpoint will then do something so what is that input going to

  21. 8:07

    be well we're going to you know paste in the link we made earlier the nft mint uh with IFTTT webhook so we're going to hit create after you paste it and if you're guys wondering where I got this from again I got it from our documentation page after changing this name and you know just copying this line here and pasting it in there so hit finish once you have that done remember to hit create alert so don't leave this page just yet hit create alert sometimes to do that and I get like where's my web hook I don't

  22. 8:31

    know where my alert feature went um so great we've created our alert and now we can actually test out our application so I'm going to turn up all my lights my lights are voice operated with Google so I'm just going to turn them off right now hey Google turn off lights great okay so here I have a uh here I have one of my Hue Lights here um so this is like apparently my lights are not working um so here I have a Philips hue light uh there's no buttons on this thing there's no way for me to you know turn on

  23. 9:04

    manually my phone's off and you can see it just turned it off like uh with my with my voice right it's nothing Shady or nothing should be going on here um so let's go over to contracts and click on cartridge again and hit interact so we're going to simulate minting nft or I guess this will literally actually means you have T2 but you know we're going to call this function empty mint to see if the light turns on if this transaction is successful so we're going to set some

  24. 9:29

    random token ID just put anything here uh set your receiver ID could be any account that you own or whatever you know send your friend an empty nft if they want and put an empty uh curly brace here an empty object instance essentially um yes we're just sending essentially an empty nft uh after that switch this over to near and set this value to one now nft mint has some logic in it so that anytime that like you mint an empty the user has to pay for the storage of that nfts being minted

  25. 9:59

    otherwise this contract account has to pay for that storage or anytime like some storage is occupied on the state of an account there is process called storage staking uh this contract counter is responsible for paying for the storage at um its state is or that it uses right uh so this so This has logic and inside Anytime like a user mints in Ft they have to pay for the storage they used and the amount that's left over for the storage that's not being used gets

  26. 10:23

    refunded back to the user so we're essentially storing nothing so we're going to get most of this one year back so hit send transaction you're going to approve this transaction for one year and once it gets approved we're going to you know watch my hue light so see if it turns on wait for two seconds and there it goes so literally all my lights just turned on I have no idea what this is doing to my green screen so I'm going to put this away and there we

  27. 10:53

    go we've successfully integrated the Pagoda console into iift TT to turn on my Hue Lights I hope you guys had so much fun with this video I had a lot of fun making it be sure to make your own IFTTT app play and send it to me with a view to Via hey guys that's all I have for you guys today I hope you guys had fun with this video I had a lot of fun making this particular project and I'll put a challenge to you guys as well make your

  28. 11:18

    own IFTTT applet make a YouTube video about how you can grade New Year into IFTTT and send it to me sent to me on Discord send me on Twitter and yeah let's feature it on this YouTube channel I think it'd be a lot of fun remember to like subscribe and comment below if you guys want to see more of out of the near YouTube channel and with that have a wonderful day foreign