Build A Slackbot
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
thanks man, you have been keeping me employed for the last 4 years
You still employed my man?
@@floweemusic8008 000Ă€pli9luillp*0Äșl
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!
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.
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.
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!
Wooow, really-really nice đđ» I like your videos!
Brad, you should start a weekly podcast. Your content is the best and I love your down-to-earth approach to learning.
This is so cool! I use Slack everyday at my work and I love it.
i enrolled in your course on udemy Brad all of them :)
As always, awesome tutorial ! Thanks Brad !
Clear and concise. Well done!
The feedback for the jokes was the best :) Nice content!
Thank you for this awesome tutorial!!
You are an awesome teacher. Thanks for the great content!
so cool. first time experiencing my slackbot is responding. Thanks Brad for this brilliant tutorial!!
Keep it up with these Nodejs tutorials! Thanks!
God bless you Brad.
Firstly got it on Instagram, then finally here
You are the best teacher! Would love to see you make an NGXS tutorial!
Really nice tutorial! Thanks!
Thank you for such simple explaination.
You got a like for being a practical programer!!
Simple ans clear đ you are a great man Brad.
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!!!
Great video - more, please!
This is amazing, thanks a ton! You're awesome
This was an awesome tutorial! Thanks a lot :-)
Found it super helpful. Thank you!!!
Wondering if you can do another simple video from scratch building slash command bot example for Slack.
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.
Really amazing Brad !
Good video. Thanks, Brad.
My favorite teacher ! Do something with NativeScript ! :D
Hey Traversy can you please do a video on how best we can keep a user activity data ( history log )
thanks much, very helpful! died laughing at the wooly mammoth joke)
Thank you for this great tutorial, appreciated it a lot! Did you plan on making a Facebook Bot tutorial in a next video?
great tutorial ! thanks !!!
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)
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...
You are the man! Thanks!
Great video, thanks
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.
''It seems someone stole yor Boston cap, I swear wasn't me'' Thanks Brad :)
I downloaded your css and html5 tutorials bro all i can say is thanks for making life easy â€.
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.
Awesome ! Thanks a lot
Hi Travis, love to see each of your tutorials. Is it possible to create some tutorials for developing bot in Microsoft Teams?
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!
Have you figured it out how to host such bots?
Hey brad. As usual very informative content. Can you please make a video on chatbot for websites?
You are the best!!! Thank you so much for your tutorial!!!
hi, have u face the error of " not allow token type"? how will u fix it?
Hokwan Liu sorrry for the late reply. I did not get any error.
@@MrFatlius i got the same error as your, do you have any solution for that?
@@quangkhanhchu3022 for the previous version of slackbot you could follow this tutorial, new versions dont support this library
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
Hi Brad, Slack has made some major changes to it's API and App features. Can you create an updated tutorial covering this please?
Really nice thank you! Could you do a video about Lumen - PHP Micro-Framework? :)
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.
Really Awesome
Please make a video on MEAN stack using latest trends, techniques and technologies of MEAN stack
My favorite youtuber
Another amazing video Brad..Can you tell me what's your code editor theme in VsCode?
Thank you Brad. What theme did you use in your VS code?
Quite helpful. Especially the token bit. haha For real.
This is great. Hoping to find one build in Python.
Love from Lagos NG đ
Come up with the more complicated bot, like Dialogflow + slack
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
Many thanks đđœ sir
Could you please make a series:
Symfony 3 from scratch to deployment. (Or just the deployment part of it, that would really help me)
Thank you. :)
You ever get into chatbots? I messed around with Microsoft Bot Framework a while back but didn't get too far in it.
Thanks a lot:)
I like to see your hair sensei, its a new perspective from you, thx your great insirational works!:))
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 :)
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/
Thanks Boss...!
Very nice video thank you Brad. Does anyone know to host your slackbot on heroku?
This time without a hat buddy.. grt8..
Can you invoke the /poll command using postMessageToChannel?
Thanku so much
nice one mentor
Thanks for the tutorial, handsome! xox ;)
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
more node videos!
You are legend!
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`
);
}
}
Hi Brad, can you make a video about chatbot messenger using Nodejs, I am really excited. By the way, your video is very useful
Finally a bot. Looling for a discord bot too
Already looking into it :)
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.
+1 Support this, looking forward for a discord bot using Discord.py
Traversy Media hey brad I am waiting for your react course on udemy .
Jeez lol
What're your thoughts on GitHub bring bought by Microsoft?
Can you add voice recognition system in which it hears and responds in voice
Yes, you can do it with JavaScript.
what program do you use there for the syntax editing?
It is called vscode by Microsoft
hey Brad.im getting error as message.includes is not a function.pls help me
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.
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 .
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.
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.
Do you have permission to add bot? Maybe you need to request it before you can install a bot.
i finished before 3 months :D
Nice can you do it in PHP
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
Brad - do you have a video on how to send a message to a slack-channel using a slack-bot and Python ?
What is your think about selling GitHub?
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.
Next up do Discord bot :D
when I try to run it it shows me not_allowed_tocken_type do you know how I can fix it?
Did you find a fix? I am having the same issue
@@david43454 Did you resolve this issue, I am facing the same issue
same for me. I tried to debug in several ways, no luck
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.
Can you do a version for 2020 with Python ?
How to work with proxy with this library
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?
Next axios crash course???