Build A Slackbot

SdĂ­let
VloĆŸit
  • čas pƙidĂĄn 3. 06. 2018
  • In this tutorial we will build a Slackbot using JavaScript/Node.js that reaches out to 2 public APIs and tells random jokes within Slack. We will use the Slackbots.js library to achieve this.
    Code:
    github.com/bradtraversy/slack...
    💖 Become a Patron: Show support & get perks!
    / traversymedia
    Website & Udemy Courses
    www.traversymedia.com
    Follow Traversy Media:
    / traversymedia
    / traversymedia
    / traversymedia
    The Developer Hangout: Public Discord Server
    / discord
  • Věda a technologie

Komentáƙe • 170

  • @robbiealixsantos
    @robbiealixsantos Pƙed 4 lety +34

    thanks man, you have been keeping me employed for the last 4 years

  • @justinmathews6630
    @justinmathews6630 Pƙed 5 lety

    This is one of the first tutorials I did that actually worked! I didn't have to modify anything or troubleshoot your code, it just worked. Well done sir and I'll be using this to get started with a custom Jenkins Slack Bot. Thanks!

  • @Coco-uk5yn
    @Coco-uk5yn Pƙed 6 lety +2

    Thanks Mr Brad. Next week I'll be joining as a UI/UX developer at a startup and the first thing I'll be doing is donating you at patreon. I owe you a lot and you are a savior to most of us budding developers. Thanks a ton. Continue your good work and God bless.

  • @AtomCoder
    @AtomCoder Pƙed 5 lety +2

    Nice tutorial. Currently your code allows you to trigger the bot with or without "@jokebot", so simply entering "chucknorris" will trigger the bot. As a suggestion, you could do something like this within the handleMessage() function:
    if(message.includes(''))
    {
    var text = message.split(" ").pop();
    if(text == 'chucknorris')
    {
    getAPIData();
    }
    }
    Basically it first checks for the existence of the bot ID and then it simply splits the string to get the text that triggers the bot. This ensures that your api data call is only triggered when using the bot.
    A great starter tutorial to get the ball rolling for project.

  • @joelgreek
    @joelgreek Pƙed 5 lety +1

    Awesome video! If you want the bot to post messages with the profile picture you add in the slack-api instead of an emoji, you can add:
    as_user: true
    inside the 'const: params:'- curly brackets instead of 'icon_emoji'. When 'as_user' is set to 'true', the bot will post as a user instead of as a bot.
    Thank you for this video!

  • @SuprunAlexey
    @SuprunAlexey Pƙed 6 lety +8

    Wooow, really-really nice đŸ‘đŸ» I like your videos!

  • @ben.thornhill
    @ben.thornhill Pƙed 5 lety

    Brad, you should start a weekly podcast. Your content is the best and I love your down-to-earth approach to learning.

  • @ZeeshanTamboli
    @ZeeshanTamboli Pƙed 6 lety

    This is so cool! I use Slack everyday at my work and I love it.

  • @vincesanchez7790
    @vincesanchez7790 Pƙed 6 lety +5

    i enrolled in your course on udemy Brad all of them :)

  • @philippec4448
    @philippec4448 Pƙed 3 lety

    As always, awesome tutorial ! Thanks Brad !

  • @nithin_satheesan
    @nithin_satheesan Pƙed 5 lety

    Clear and concise. Well done!

  • @ThePedroGF
    @ThePedroGF Pƙed 6 lety

    The feedback for the jokes was the best :) Nice content!

  • @januszszubert7469
    @januszszubert7469 Pƙed 5 lety +1

    Thank you for this awesome tutorial!!

  • @albertograu3318
    @albertograu3318 Pƙed 6 lety

    You are an awesome teacher. Thanks for the great content!

  • @RagavanRajanrahav
    @RagavanRajanrahav Pƙed 6 lety

    so cool. first time experiencing my slackbot is responding. Thanks Brad for this brilliant tutorial!!

  • @srdjagunjic
    @srdjagunjic Pƙed 6 lety

    Keep it up with these Nodejs tutorials! Thanks!

  • @irwinpalomo7212
    @irwinpalomo7212 Pƙed 6 lety +7

    God bless you Brad.

  • @Lampgram
    @Lampgram Pƙed 6 lety +3

    Firstly got it on Instagram, then finally here

  • @Udodelig1
    @Udodelig1 Pƙed 6 lety

    You are the best teacher! Would love to see you make an NGXS tutorial!

  • @fabrytomas
    @fabrytomas Pƙed 5 lety

    Really nice tutorial! Thanks!

  • @apurvsawant5703
    @apurvsawant5703 Pƙed 3 lety

    Thank you for such simple explaination.

  • @kimfucku8074
    @kimfucku8074 Pƙed 5 lety

    You got a like for being a practical programer!!

  • @codecorner131
    @codecorner131 Pƙed 6 lety

    Simple ans clear 👍 you are a great man Brad.

  • @onakoyakorede
    @onakoyakorede Pƙed 6 lety

    Hey brad, saying your videos are good is an understatement. I'm already attached to your addictive videos. You're just too awesome. I don't know if i'm in a position to actually request for videos but i was wondering if you could make something on bootstrap-vue. Regardless you make them or not i still find your contents fascinating. Good Job!!!

  • @adriansun2999
    @adriansun2999 Pƙed 6 lety

    Great video - more, please!

  • @sanchithaseshadri2166
    @sanchithaseshadri2166 Pƙed 5 lety +1

    This is amazing, thanks a ton! You're awesome

  • @mspanhaak
    @mspanhaak Pƙed 5 lety

    This was an awesome tutorial! Thanks a lot :-)

  • @shariatpurorg9148
    @shariatpurorg9148 Pƙed 6 lety

    Found it super helpful. Thank you!!!
    Wondering if you can do another simple video from scratch building slash command bot example for Slack.

  • @cathymurry4331
    @cathymurry4331 Pƙed 5 lety

    Learning to work with technology helped me to get a better understanding of how people are working and reacting to each other. I recommend Slack plugins like Moodbit that sends me regular reports on the team’s emotion through emotion-sensing AI technology.
    It's really helpful to detect the problem immediately and work on it rather than wait until the survey that comes once a year.

  • @gowthams8340
    @gowthams8340 Pƙed 6 lety

    Really amazing Brad !

  • @vijayu707
    @vijayu707 Pƙed 6 lety

    Good video. Thanks, Brad.

  • @Juanmv05
    @Juanmv05 Pƙed 6 lety

    My favorite teacher ! Do something with NativeScript ! :D

  • @wellingtonchanda4067
    @wellingtonchanda4067 Pƙed 6 lety +4

    Hey Traversy can you please do a video on how best we can keep a user activity data ( history log )

  • @nikhilgoyal007
    @nikhilgoyal007 Pƙed 6 lety

    thanks much, very helpful! died laughing at the wooly mammoth joke)

  • @Khalyomede
    @Khalyomede Pƙed 6 lety

    Thank you for this great tutorial, appreciated it a lot! Did you plan on making a Facebook Bot tutorial in a next video?

  • @puptiz1
    @puptiz1 Pƙed 5 lety

    great tutorial ! thanks !!!

  • @niccubagonoc9907
    @niccubagonoc9907 Pƙed 6 lety

    Great tutorial Brad! Can you do your next tutorial on multiple user roles using Passport's local strategy? That would be a really awesome tutorial (since there's nothing about it here on youtube)

  • @liveandlearn1702
    @liveandlearn1702 Pƙed 5 lety +1

    OMG such an wesome tutorial, you're a great teacher, thanks for sharing! Do you know if it is technically possible to have the bot *respond to the user as a thread* as opposed to inline right below the query? My idea would bring up a nice bit of content and don't want to clutter the main chat...

  • @carlos.arenas
    @carlos.arenas Pƙed 6 lety

    You are the man! Thanks!

  • @deepakkoirala1237
    @deepakkoirala1237 Pƙed 5 lety

    Great video, thanks

  • @tridvaenazdaj
    @tridvaenazdaj Pƙed 5 lety

    Hi Brad. Thanks for great tutorials here and on Udemy. I'm not a slack user but I'd love to see how you build a twitter bot someday in the future. The one that grabs data from some other API and tweet that data. I wonder how CSS-trick twitter bot works when automatically post every new article published on their website.

  • @kennymoreno5735
    @kennymoreno5735 Pƙed 6 lety

    ''It seems someone stole yor Boston cap, I swear wasn't me'' Thanks Brad :)

  • @burhankalu2682
    @burhankalu2682 Pƙed 6 lety +3

    I downloaded your css and html5 tutorials bro all i can say is thanks for making life easy ❀.

  • @KevinMarchese
    @KevinMarchese Pƙed 5 lety

    I love the way you explain things! thank you for the video. Can you have multiable bots users for one app? I don't think so.

  • @leopng
    @leopng Pƙed 6 lety

    Awesome ! Thanks a lot

  • @webdeveloperify
    @webdeveloperify Pƙed 4 lety

    Hi Travis, love to see each of your tutorials. Is it possible to create some tutorials for developing bot in Microsoft Teams?

  • @annez8598
    @annez8598 Pƙed 6 lety

    It is a fun learning experience to follow your tutorials such as this one. It would be great if you could teach us how to host the bot. Many Thanks!

  • @sairammuthineni9796
    @sairammuthineni9796 Pƙed 6 lety

    Hey brad. As usual very informative content. Can you please make a video on chatbot for websites?

  • @yoemasey
    @yoemasey Pƙed 4 lety

    You are the best!!! Thank you so much for your tutorial!!!

    • @MrFatlius
      @MrFatlius Pƙed 4 lety

      hi, have u face the error of " not allow token type"? how will u fix it?

    • @yoemasey
      @yoemasey Pƙed 4 lety

      Hokwan Liu sorrry for the late reply. I did not get any error.

    • @quangkhanhchu3022
      @quangkhanhchu3022 Pƙed 4 lety

      @@MrFatlius i got the same error as your, do you have any solution for that?

    • @zaryabbaloch5266
      @zaryabbaloch5266 Pƙed 4 lety

      @@quangkhanhchu3022 for the previous version of slackbot you could follow this tutorial, new versions dont support this library

  • @zaryabbaloch5266
    @zaryabbaloch5266 Pƙed 4 lety +1

    Thanks alot for this wonderful tutorial, only question is that it is implementable in classical slack app (depreciated now), can you please do another with new slack app

  • @greenmansession
    @greenmansession Pƙed 3 lety +3

    Hi Brad, Slack has made some major changes to it's API and App features. Can you create an updated tutorial covering this please?

  • @markadell
    @markadell Pƙed 6 lety

    Really nice thank you! Could you do a video about Lumen - PHP Micro-Framework? :)

  • @rocktimsaikia1394
    @rocktimsaikia1394 Pƙed 6 lety

    Awesome man.Huge admirer . Love your videos.Anyway could you make a tutorial on creating a twitter bot using Javascript and other JS frameworks. ? It would be great help if you could do that.

  • @muhammadhamzaasif2128
    @muhammadhamzaasif2128 Pƙed 6 lety

    Really Awesome
    Please make a video on MEAN stack using latest trends, techniques and technologies of MEAN stack

  • @raisshaikh259
    @raisshaikh259 Pƙed 6 lety

    My favorite youtuber

  • @akashrajpurohit97
    @akashrajpurohit97 Pƙed 6 lety

    Another amazing video Brad..Can you tell me what's your code editor theme in VsCode?

  • @songcham.moingay
    @songcham.moingay Pƙed 6 lety

    Thank you Brad. What theme did you use in your VS code?

  • @acidfire980
    @acidfire980 Pƙed 4 lety

    Quite helpful. Especially the token bit. haha For real.

  • @lightninginmyhands4878
    @lightninginmyhands4878 Pƙed 5 lety

    This is great. Hoping to find one build in Python.

  • @abrahamemmanuel4906
    @abrahamemmanuel4906 Pƙed 6 lety

    Love from Lagos NG 😘

  • @johnday941
    @johnday941 Pƙed 6 lety +1

    Come up with the more complicated bot, like Dialogflow + slack

  • @matthewtetley7048
    @matthewtetley7048 Pƙed 6 lety

    I'm guessing you could make a bunch of cases and use them in this type of bot and have the bot run many if it got selected @Traversy Media

  • @jamalabdullahi8155
    @jamalabdullahi8155 Pƙed 6 lety

    Many thanks đŸ™đŸœ sir

  • @HordeonSC2
    @HordeonSC2 Pƙed 6 lety

    Could you please make a series:
    Symfony 3 from scratch to deployment. (Or just the deployment part of it, that would really help me)

  • @FlorianDootz
    @FlorianDootz Pƙed 5 lety

    Thank you. :)

  • @Chandasouk
    @Chandasouk Pƙed 6 lety

    You ever get into chatbots? I messed around with Microsoft Bot Framework a while back but didn't get too far in it.

  • @babashovmehemmed9396
    @babashovmehemmed9396 Pƙed 6 lety

    Thanks a lot:)

  • @janosmarta8258
    @janosmarta8258 Pƙed 6 lety

    I like to see your hair sensei, its a new perspective from you, thx your great insirational works!:))

    • @TraversyMedia
      @TraversyMedia  Pƙed 6 lety

      Haha, I didn't even realize that. I don't think I have ever not wore a hat in a video. Usually I am just too lazy to throw gel in my hair :)

    • @janosmarta8258
      @janosmarta8258 Pƙed 6 lety +1

      Traversy Media It was just a surprise, anyway I like your bigB caps, I am a celtic fan so its reasonable :D
      I am doing the edX.org PennX webprogrammer course.JS, jQuery, React and Node.js their line where we advance, I am very eager for these languages and frameworks, maybe once in future I will understand prototype function mechanisms too.
      Can you take a look on it and tell your magical words about it?:)
      courses.edx.org/courses/course-v1:PennX+SD4x+2T2017/course/

  • @hemaethossain4946
    @hemaethossain4946 Pƙed 6 lety

    Thanks Boss...!

  • @juliencolombain7440
    @juliencolombain7440 Pƙed 4 lety

    Very nice video thank you Brad. Does anyone know to host your slackbot on heroku?

  • @rahulr4667
    @rahulr4667 Pƙed 6 lety

    This time without a hat buddy.. grt8..

  • @89srle
    @89srle Pƙed 5 lety

    Can you invoke the /poll command using postMessageToChannel?

  • @GeekySatyam
    @GeekySatyam Pƙed 3 lety

    Thanku so much

  • @Tigap
    @Tigap Pƙed 6 lety

    nice one mentor

  • @chunk1978
    @chunk1978 Pƙed 5 lety

    Thanks for the tutorial, handsome! xox ;)

  • @DonHaul
    @DonHaul Pƙed 6 lety

    When I deploy it to heroku it doenst, work. Is this implementation really possible to run on heroku?
    On their site, they configure it using incoming web hooks

  • @pillar6programming687
    @pillar6programming687 Pƙed 6 lety

    more node videos!

  • @ilyaskarim1952
    @ilyaskarim1952 Pƙed 6 lety

    You are legend!

  • @ZankOu75
    @ZankOu75 Pƙed 5 lety

    Hello sir,
    Thank you for this tutorial.
    I have an issue : when i do a handle function with a condition with includes, it just spams the channel like a loop
    function handleMessage(text) {
    if (text.includes(' php')) {
    params = {
    q: 'php'
    };

    bot.postMessageToChannel(
    'général',
    `you wrote php`
    );
    }
    }

  • @buiductai489
    @buiductai489 Pƙed 6 lety

    Hi Brad, can you make a video about chatbot messenger using Nodejs, I am really excited. By the way, your video is very useful

  • @utkarshdubey8641
    @utkarshdubey8641 Pƙed 6 lety +20

    Finally a bot. Looling for a discord bot too

    • @TraversyMedia
      @TraversyMedia  Pƙed 6 lety +15

      Already looking into it :)

    • @utkarshdubey8641
      @utkarshdubey8641 Pƙed 6 lety +1

      Nice, but there is a request. Please try to make it in Python. Discord.py as it offers more functionality.
      Anyways glad you replied to me.

    • @ARCtrooper98
      @ARCtrooper98 Pƙed 6 lety

      +1 Support this, looking forward for a discord bot using Discord.py

    • @satyajeetkumarjha1482
      @satyajeetkumarjha1482 Pƙed 6 lety

      Traversy Media hey brad I am waiting for your react course on udemy .

    • @TaelurAlexis
      @TaelurAlexis Pƙed 6 lety

      Jeez lol

  • @George-yd1ns
    @George-yd1ns Pƙed 6 lety

    What're your thoughts on GitHub bring bought by Microsoft?

  • @TheCodebookInc
    @TheCodebookInc Pƙed 6 lety

    Can you add voice recognition system in which it hears and responds in voice

  • @Timvoortaal
    @Timvoortaal Pƙed 5 lety

    what program do you use there for the syntax editing?

    • @Matt-ft5xi
      @Matt-ft5xi Pƙed 5 lety

      It is called vscode by Microsoft

  • @ashutoshsenger9266
    @ashutoshsenger9266 Pƙed 5 lety

    hey Brad.im getting error as message.includes is not a function.pls help me

  • @satyajeetkumarjha1482
    @satyajeetkumarjha1482 Pƙed 6 lety

    hey,
    i have taken your mern stack course and there is one small mistake at one part where you ask users to enter skills which is basically an array and you have used a validator to check if it is correct or not but validator checks only the strings and not arrays.Please correct that thing in your course and code.

    • @satyajeetkumarjha1482
      @satyajeetkumarjha1482 Pƙed 6 lety

      Florian Suess oh yes I do take part in Q&A of the course and it is the best couress that I have taken on udemy .

  • @davecoder7118
    @davecoder7118 Pƙed 6 lety

    So, why does the datatype matter in `if(rand === 1)`? If it's string '1' or boolean true, it should evaluate to false? That makes no sense in this context.

  • @VukotaDjLewu95
    @VukotaDjLewu95 Pƙed 4 lety +2

    Please help. I can't add a bot. When I create a workspace and my app and when I click on the Bots field then send me to HomePage. I really don't know why.

    • @kevinsulatra2661
      @kevinsulatra2661 Pƙed 4 lety

      Do you have permission to add bot? Maybe you need to request it before you can install a bot.

    • @VukotaDjLewu95
      @VukotaDjLewu95 Pƙed 4 lety

      i finished before 3 months :D

  • @pavankumarr7089
    @pavankumarr7089 Pƙed 5 lety

    Nice can you do it in PHP

  • @shelletonianhuman
    @shelletonianhuman Pƙed 6 lety

    I hosted my bot on glitch i think it's a great place To host IT its Also pretty easy to host IT on glitch

  • @charlesbovalis6591
    @charlesbovalis6591 Pƙed 5 lety

    Brad - do you have a video on how to send a message to a slack-channel using a slack-bot and Python ?

  • @milosmik
    @milosmik Pƙed 6 lety

    What is your think about selling GitHub?

  • @the_thinker8
    @the_thinker8 Pƙed 4 lety

    Hi @Traversary Media great video man. Can you let me know how to host it on heroku? I had tried it to host but it did not responded.

  • @beardninja5029
    @beardninja5029 Pƙed 6 lety

    Next up do Discord bot :D

  • @DC-no9kw
    @DC-no9kw Pƙed 4 lety +2

    when I try to run it it shows me not_allowed_tocken_type do you know how I can fix it?

    • @david43454
      @david43454 Pƙed 3 lety

      Did you find a fix? I am having the same issue

    • @mayemami8057
      @mayemami8057 Pƙed 3 lety

      @@david43454 Did you resolve this issue, I am facing the same issue

    • @matthewspach
      @matthewspach Pƙed 3 lety

      same for me. I tried to debug in several ways, no luck

  • @doriomer
    @doriomer Pƙed 6 lety

    Can i use this tutorial also to make a TelegramBot in nodeJs? is it the same principles?
    I'm a new php developer - should i build bots in PHP or NodeJS, what is better?
    thank you for your time reading my msg.

  • @nonikita
    @nonikita Pƙed 4 lety

    Can you do a version for 2020 with Python ?

  • @akhix319
    @akhix319 Pƙed 5 lety

    How to work with proxy with this library

  • @Saywhatohno
    @Saywhatohno Pƙed 3 lety

    is there a way to create a slackbot which controls adobe license so if anyone wants to sign into adobe apps they can sign out a license from slackbot and do it that way?

  • @shubhamtarkar38
    @shubhamtarkar38 Pƙed 6 lety

    Next axios crash course???