Webhooks Tutorial with Discord and Vanilla Javascript (fetch api)

Hussein Nasser December 14, 2019
Video Thumbnail
Hussein Nasser Logo

Hussein Nasser

@hnasr

About

Join me as we discuss various software engineering topics with examples and add fun elements to them. We always try to learn by example here in this educational Youtube channel which we believe is the right way to learn. I love Software engineering (especially the backend) and I strive to be a better software engineer every day. Join me on this journey and let us learn together. All opinions, suggestions, and tips I provide in all of this channel's content are my own. Information provided is for educational purposes only. Consider becoming a member to support the channel https://www.youtube.com/channel/UC_ML5xP23TOWKUcc-oAE_Eg/join Check out my courses https://courses.husseinnasser.com Stay awesome! Hussein Nasser, http://www.husseinnasser.com Feel free to shoot me an email [email protected] twitter: @hnasr

Video Description

Webhooks are custom callbacks URLs that an application can call to communicate with another application. A popular uses of webhooks are github and discord. Where discord creates a webhook and you can share that webhook for other applications to “hook” into it to post messages discord when something happened in the application. When I upload a video post a link to discord In this video, Ill demonstrate webhooks with vanilla Javascript fetch api and discord webhooks. We will execute a fetch api call from the browser, 0:00 Intro 1:10 Webhooks Explained 5:20 Example const whurl ="https://discordapp.com/api/webhooks/655433405068214293/mcp5150ruDAwgWG_H5zrB_PHpd-UfMdP4Jn2aZVTt2k2jGmb_0VpCAo5roLPcQVZcNgU" const msg = { "content": "Hello! I'm a bot, this is fetch api" } fetch(whurl + "?wait=true", {"method":"POST", "headers": {"content-type": "application/json"}, "body": JSON.stringify(msg)}) .then(a=xa.json()).then(console.log) replacex with greater than Discord API https://discordapp.com/developers/docs/resources/webhook Discord Server Link https://discord.gg/CsFbFce 🏭 Software Architecture Videos https://www.youtube.com/playlist?list=PLQnljOFTspQXNP6mQchJVP3S-3oKGEuw9 💾 Database Engineering Videos https://www.youtube.com/playlist?list=PLQnljOFTspQXjD0HOzN7P2tgzu7scWpl2 🛰 Network Engineering Videos https://www.youtube.com/playlist?list=PLQnljOFTspQUBSgBXilKhRMJ1ACqr7pTr 🏰 Load Balancing and Proxies Videos https://www.youtube.com/playlist?list=PLQnljOFTspQVMeBmWI2AhxULWEeo7AaMC 🐘 Postgres Videos https://www.youtube.com/playlist?list=PLQnljOFTspQWGrOqslniFlRcwxyY94cjj 🚢Docker https://www.youtube.com/playlist?list=PLQnljOFTspQWsD-rakNw1C20c1JI8UR1r 🧮 Programming Pattern Videos https://www.youtube.com/playlist?list=PLQnljOFTspQV1emqxKbcP5esAf4zpqWpe 🛡 Web Security Videos https://www.youtube.com/playlist?list=PLQnljOFTspQU3YDMRSMvzflh_qXoz9zfv 🦠 HTTP Videos https://www.youtube.com/playlist?list=PLQnljOFTspQU6zO0drAYHFtkkyfNJw1IO 🐍 Python Videos https://www.youtube.com/playlist?list=PLQnljOFTspQU_M83ARz8mDdr4LThzkBKX 🔆 Javascript Videos https://www.youtube.com/playlist?list=PLQnljOFTspQWab0g3W6ZaDM6_Buh20EWM Support me on PayPal https://bit.ly/33ENps4 Become a Patreon https://www.patreon.com/join/hnasr? Stay Awesome, Hussein

Upgrade Your Carry Essentials

AI-recommended products based on this video

Loading...
SmallRig NATO Clamp to Quick Release Plate for Arca-Swiss, Built-in NATO Clamp, Lightweight and Easy to Carry, Compatible with Tripods for Arca-Type - MD4857

SmallRig NATO Clamp to Quick Release Plate for Arca-Swiss, Built-in NATO Clamp, Lightweight and Easy to Carry, Compatible with Tripods for Arca-Type - MD4857

(32)
$23.79
FREE delivery Thu, Jun 19 on your first order
Loading...
LifeStraw Go Series – BPA-Free Water Filter Bottle for Travel and Everyday use removes Bacteria, parasites and microplastics, Improves Taste

LifeStraw Go Series – BPA-Free Water Filter Bottle for Travel and Everyday use removes Bacteria, parasites and microplastics, Improves Taste

(2,775)
$61.85$41.83
FREE delivery Tue, Sep 23
Loading...
Long Range Super Endurance Foldable Drone with Camera for Beginners–36+ min Flight Time, WiFi FPV Quadcopter with 2K HD Camera, Brushless Motor, Auto Hover, Follow Me (2 Batteries)

Long Range Super Endurance Foldable Drone with Camera for Beginners–36+ min Flight Time, WiFi FPV Quadcopter with 2K HD Camera, Brushless Motor, Auto Hover, Follow Me (2 Batteries)

(206)
$88.98
FREE delivery Sun, Nov 30
1K+ bought in past month
Loading...
3 Channel Dash Cam,4K+1080P Dash Cam Front and Rear Inside,Triple Car Camera, Dash Camera for Cars with 32GB Card,Built-in G-Sensor,170°Wide Angle,2’’ IPS Display,24Hr Parking,Night Vision

3 Channel Dash Cam,4K+1080P Dash Cam Front and Rear Inside,Triple Car Camera, Dash Camera for Cars with 32GB Card,Built-in G-Sensor,170°Wide Angle,2’’ IPS Display,24Hr Parking,Night Vision

(23)
$69.99
FREE delivery Fri, Dec 5
2K+ bought in past month
Loading...
Dash Camera for Cars, 4K+1080P Dash Cam Front and Rear with 5G WiFi, Built-in 32GB Card, Night Vision, G-Sensor, Loop Recording, 24H Parking Mode

Dash Camera for Cars, 4K+1080P Dash Cam Front and Rear with 5G WiFi, Built-in 32GB Card, Night Vision, G-Sensor, Loop Recording, 24H Parking Mode

(759)
$75.99
FREE delivery Sun, Oct 19
2K+ bought in past month
Loading...
NAFYRE N11 PRO GPS Drone with Camera for Adults 4K UHD, 90 Min Long Flight Time, Long Control Range, Auto Return, Follow Me, Brushless Motor, 5G FPV RC Quadcopter for Beginners

NAFYRE N11 PRO GPS Drone with Camera for Adults 4K UHD, 90 Min Long Flight Time, Long Control Range, Auto Return, Follow Me, Brushless Motor, 5G FPV RC Quadcopter for Beginners

(108)
$149.98
FREE delivery Wed, Aug 20
100+ bought in past month
Loading...
WINDARS WINDARS Backpack for School Girls, Cute High School Backpacks for Teens Women Student Large Bookbag 15.6 Inch Laptop Bag with USB Charger Port for College Work Travel Trip (Beige Khaki)

WINDARS WINDARS Backpack for School Girls, Cute High School Backpacks for Teens Women Student Large Bookbag 15.6 Inch Laptop Bag with USB Charger Port for College Work Travel Trip (Beige Khaki)

(70)
$40.99
PrimeFREE delivery Sat, Jun 14
Loading...
HOMESPON Large Corduroy Tote Bag for Women Everyday Shoulder Bag with Pockets and Zipper for Work Travel Vacation

HOMESPON Large Corduroy Tote Bag for Women Everyday Shoulder Bag with Pockets and Zipper for Work Travel Vacation

(263)
$22.39
FREE delivery Sat, Jun 14 on your first order
Loading...
Influence Empire: Inside the Story of Tencent and China’s Tech Ambition

Influence Empire: Inside the Story of Tencent and China’s Tech Ambition

(274)
$27.34$15.97
FREE delivery Tue, Jun 17 on your first order
Loading...
Hand Warmer Rechargeable 2-Pack, Electric Hand Warmer, 3 Heat Settings, Up to 20Hrs, Ultra Thin Portable Pocket Hand Warmer for Camping,Hunting,Outdoors, Tech Gifts for Men Women

Hand Warmer Rechargeable 2-Pack, Electric Hand Warmer, 3 Heat Settings, Up to 20Hrs, Ultra Thin Portable Pocket Hand Warmer for Camping,Hunting,Outdoors, Tech Gifts for Men Women

(89)
$22.99$11.48
FREE delivery Sat, Jun 14 on your first order
Loading...
OCOOPA Magnetic Rechargeable Hand Warmers 2 Pack, Card-Style Electric Hand Warmer for Gloves, Pocket Hand Heater, UL Certified, 3 Heat Settings, Christmas Tech Gifts for Women, UT4 Young

OCOOPA Magnetic Rechargeable Hand Warmers 2 Pack, Card-Style Electric Hand Warmer for Gloves, Pocket Hand Heater, UL Certified, 3 Heat Settings, Christmas Tech Gifts for Women, UT4 Young

(2,160)
$30.39
FREE delivery Sat, Jun 14 on your first order
Loading...
OCOOPA UT3 Lite Rechargeable Hand Warmers 2 Pack, Magnetic Electric Handwarmers Ultra Thin Light Portable for Pocket Gloves,3 Levels Heat, Up to 8 hrs, UL Certified, Tech Gifts for Men, Women
Best Seller

OCOOPA UT3 Lite Rechargeable Hand Warmers 2 Pack, Magnetic Electric Handwarmers Ultra Thin Light Portable for Pocket Gloves,3 Levels Heat, Up to 8 hrs, UL Certified, Tech Gifts for Men, Women

(3,234)
$31.99
FREE delivery Sat, Jun 14 on your first order
200+ bought in past month