by Abdelrahman Al Allaqi
I have just finished the code for my very first slack-bot Project, which was creating a Bot with JavaScript, node, using the Adobe aio-runtime and adobe aio-lib-state. It was a RIDE. I know this might seem like a lot of time to make a slack-bot. It wasn’t just about the end project. I wanted to understand everything which was quite difficult having no experience with APIs and HTTP requests(the fact that I can say that is an achievement).
I enjoyed the project and the time it’s taken me to finish. None the less it was very difficult and I faced a lot of challenges. But the best thing is how far I have come and learned a lot. I feel now that I can work on similar projects and will only take me a few days to complete.
The task I was given
I was given the task by my internship mentor to create a Slack Bot:
(The project is still in an early stage, the features I planned to add are not all developed yet)
· Chat with users in the workspace
· Respond to commands
· Perform task when an event occurs on the workspace
· Organise events
· Store data
· Publish that data
· Direct message with Bot
-Photo by Estée Janssens on Unsplash
So what are bots?
§ A bot is a type of Slack App designed to interact with users via conversation.
§ A bot is the same as a regular app: it can access the same range of APIs and do all of the magical things that a Slack App can do.
§ When you build a bot for your Slack App, you’re giving that app a face, a name, and a personality, and encouraging users to talk to it.
§ Your bot can send DMs, it can be mentioned by users, it can post messages or upload files, and it can be invited to channels - or kicked out.
§ Bots are not cybernetic infiltration units, and it is unlikely that they dream of electric sheep, though we can’t rule it out.
Why slack?
Over the past year, Slack has changed the way businesses communicate. With a very well documented and intuitive API, Slack gives developers the ability to easily create custom integrations to get data out of or into Slack.
My Learning Process
I had already worked with JavaScript before(previous article), but everything I was doing on here didn’t seem to work. I struggled a lot in the beginning,
I asked google a lot and I was talking to my mentor a lot about the issues I was facing.
After getting the hang of things it was hill down from there. Or was it? getting some interaction back from my Bot always put a smile on my face. Every time I had to add functionality to the bot something would crash. A bit frustrating.
Now I understand the real meaning of BUG.
-Photo by taha ajmi on Unsplash
FFC(first article) was really helpful, to kickstart my documentation reading and searching for what I needed. The slack documentation is really detailed and vast. So I had to look for what I needed and I would always find things that would confuse me. Learning is trying out different solutions. That helped me to keep trying and searching.
The Tasks kept getting harder and harder, but I was learning by the day so it evened itself out.
There were days where I was I was stuck. But realized staying on the same issue for a long time doesn’t help.
Used:
-
JavaScript
-
ES6
-
Node.js
-
Docker
-
Aio-runtime
-
Aio-state-lib
-
Jest
Aio runtime made everything so much easier I was always afraid of the backend.
Its just so simple to understand and use.
What now?
I hope to take what I learned and implement it on my next project. And add the functionality I want to the slack bot. maybe even create another one for fun. I am going to add even more modifications.
Lessons learned
Like I said in my last article, It takes time to really understand all of this. When working on it daily, you don’t realize how much progress you are making.
I found that, while these are intermediate topics, these libraries(Node, Aio-runtime, Aio-state-lib) make working with JavaScript much, much easier. They abstract away so much of the tediousness of writing JavaScript.
Always listen and ask again if you don’t know or understand. Don’t waste your time you will regret it and Try your skills. Put them to the test.
Set aside time to deal with the technical side. It is as much important as developing features. Always test the code.
I learned to take challenges and break them down into smaller pieces.
Now I use this in my everyday life, not just coding.
Building the slack-bot was fun. I love the feeling of showing my work to people and the excitement to see people interacting with it. I learned a lot from this.
Some other resources I found useful:
· https://www.freecodecamp.org/
· https://api.slack.com/tools/block-kit-builder
Feel free to contact me on my website if you have any questions!