Hey everyone, welcome back! This week I will be briefly going over my interviewing prep and experience, while also saying goodbye to this class and this blog.
Internship
During this month, I started my internship as a software engineer intern. It was my first time working as a software engineer and it was a bit daunting. At this point, I hadn’t yet even thought about interview prepping. Luckily, I had a friend that is also in this program that let me know about CodePath’s interview prep course opening up. I applied, took the online assessment and was told I was borderline between intermediate and advanced. I ended up doing intermediate for 2 weeks before switching over to advanced due to the large gap in difficulty.
Burn Out
Midway through the summer and I was feeling pretty burnt out. I had been doing CodePath 3 times a week + the weekly online assessment with a 40-45 hour internship. I started to pay less and less attention toward the end of the courses’ duration and eventually decided that I would need to really put in work to be interview ready.
Interviewing
As September started, so did interview season. This time I felt more confident since I had been covering different pattern types on leetcode and had just finished my internship. I immediately saw the difference in response rates this time around. By the start of October I had about 20 online assessments which 14 landed in first round interviews. As of November, I’ve only had 3 onsite interviews due to my internship’s return offer deadline.
Study Guide
My brief prep study guide: get comfortable with arrays, strings, linked-lists, trees, and graphs. Start on easy difficulty and switch to medium after about 1-2 weeks. Switch topics every 2 weeks. I intentionally did not include dynamic programming problems as I have never gotten one in an interview. Others might have a different experience. After about a month or so, do Pramp mock interviews, so you can get comfortable explaining your thought process. Get your resume ready and let the interview season start for you!
The End
As for this class, the quarter is now coming to an end and with it this blog. I didn’t think I would enjoy writing as much as I did. Not sure how it is related to CS, but for some reason it feels kind of nice doing assignments not directly related to coding. As for the project and my team, I’m glad to have found a couple of teammates that really do their end of the bargain. I’m excited to finish this class strong and start my career after graduating!
Welcome back folks! This week I will be discussing my experience preparing for interviews for companies at intern level and next week I will discuss the same for new grad positions. This post will be short but sweet and I hope someone reading this will be able to both relate and learn from my mistakes!
Intern Path
It was January 2020 when I decided that I was going to stop making excuses for not applying to positions. Truth is, I was fearful of looking dumb in front of an interviewer with the little programming knowledge I had (started Fall 2019). I decided to make a plan. I would apply to positions and try out this website called Hackerrank. I would also continue to read the plethora of posts on Reddit about people’s journey towards being interview ready.
Blind
By the time summer 2020 came around, I had done a couple of interviews (failed) but most importantly I felt confident in my plan. Starting June 2020, I was taking CS325 (algos) and working on side projects that I could put on my resume (to get interview screeners like an online assessment). Fast forwarding to August 2020, I had completed 2 full-stack projects and decided to start really getting into my algorithms practice. I started by doing Leetcode problems at the easy difficulty level but then progressed into mediums and found Blind’s top 75 leetcode questions. This is like the holy grail of problems that allow you to get comfortable with pattern recognition. Plus, they get reused pretty often in interviews. In tandem, I also started sending out applications. I made sure that for large companies, I would reach out to friends for referrals.
Interviews
By October, I had studied arrays, strings, trees, and graphs. Overall, I was pretty confident about my programming ability. Luckily my strategy had worked and I had about 3-5 interviews per week consistently for about 5 weeks. My application to interview ratio was about 1:14, so for every 14 applications I was getting an interview. However in these interviews, I didn’t know that for large tech companies there was an initial question then follow up questions. For me, the follow up questions included concepts from OS and distributed computing. I was exposed. I had not taken those courses yet and when I mentioned it to interviewers, it usually resulted in a rejection. It actually wasn’t until I interviewed with Goldman Sachs that I decided to tell them straight up that I had not taken those courses so I had no idea how to respond. Interestingly enough, I received an offer from them! Goes to show that honesty is often more valuable than raw knowledge.
The End
Anyways, I kept interviewing and kept my programming skills up by continuing to do Leetcode problems. I also saw that a weak point of mine was walking my interviewer through my thought process as it is pretty sporadic sometimes. I decided to do Pramp interview sessions so I could be more comfortable explaining things. This helped me out way more than coding in silence! I went from landing 2 onsites up to that point to landing 6 onsites afterwards.
Conclusion
I ended my interviewing season on November 1st when I received my last internship offer. I decided to go with the offer I received last and have not regretted my decision or my preparation strategy! I hope anyone reading this can relate/learn!
Hey, welcome back! In this blog, I will be talking about my fitness journey in 2021 and how it was largely shaped by unforeseen circumstances and health concerns. I’ll also talk about a new hobby that I picked up along the way: running.
January 2021
During this month, I was still recovering from the flu in December and thinking of ways that I could lighten the workload when I did have the strength to work out. It was during this time that I also began having GI issues and went to see a doctor. I was basically told that I needed to try a new diet and see what foods I could eat by experimenting what reactions my stomach had with each ingredient. I began the diet strong, but felt especially weak during my workouts as I didn’t have the same caloric intake. I slowly saw my workouts getting worse and I knew I had to change something up.
February 2021
This month was a life changing month. My significant other and I realized we had mold in our apartment and moved to a different city. Our new complex had 3 grocery stores within 2 blocks and a gym for residents to use. I sped up the process of finding out what I could and couldn’t eat by doing smaller portions of a variety of common foods. My workouts also changed. I was now focusing more on warming up on a stationary bike then stretching, followed by a light 30-45 weight lifting session. While lifting, I limited my sets and repetitions to 3×12 with 40-50% of my personal best for the individual lift I was doing. I also followed up on days off with body weight training so I could get accustomed to working out more regularly. Towards the end of the month, I remember seeing a resident jogging through the complex and thought how it looked so peaceful. I ran cross country in highschool and it had been a long time since I had gone for a solid run. This moment was to change my fitness journey.
May 2021
It had been 3 months since I saw that person run and since that time, I had also picked it up. I was running every other day doing Fartleks, tempo runs, warm up runs, recovery runs, and long runs. My initial mile time was atrocious at 10:30 minutes per hour pace. After 3 months, I was averaging 8:35 minutes per hour pace on 3-5 mile runs. This was a huge improvement. I even went as far as buying new shoes so that I wouldn’t get any injuries by continuing to run in my all-birds ( 🙂 ). My routine changed as I progressed, but I want to share what helped me improve. First, I always did a warm up run which was usually about half a mile to 1.5 miles later on. After the warmup, I did static stretches and dynamic stretches. Then, I would do runs through the nike run club app so I had a coach pace me. After the run, I focused more on my recovery run and post-run stretching. I also always ate after my runs. As for breathing inside the mask, I would say to focus on not having large inhalations or exhalations as it can sometimes feel like the mask is going to go up your nose.
I had also kept up going to the gym 3-4 times per week with increasing weight per set. This had probably been the longest, healthiest I had felt in a while.
July 2021
Remember when I said “You go forward 2 steps and take a step back.” ? Yeah, so my internship derailed my fitness journey. I found myself working extra hours to get my project done (I know I know, not worth it) and less time to focus on my health. My diet also suffered as I had less time to make meals. It was at the end of this month that I decided to put myself first. I pushed through tiredness and overall laziness to workout. I ran less and my time had gotten worse, but at least I was doing it. I felt proud of that.
Conclusion:
As you all can see, I have had some minor and major setbacks in my fitness journey over the past two years. I’m hoping I will be having more months like February – May 2021, but the reality is that I just don’t know when roadblocks will come up. All I (and you) can really do is just keep moving forward.
Hey everyone! This week I will be going over my fitness experience during the COVID-19 pandemic. I will be starting off with how the pandemic and OSU affected my life early on and then dive into the past year. I hope this blog helps others see how a regular person’s fitness journey is really dependent on life circumstances and that it is okay to not be working out 2 hours a day every day. This will be part 1 of 2. This part will cover 2020 year.
March 2020
Prior to starting Oregon State’s program, I worked out 5-6 a week for about 1-2 hours each session. I primarily lifted weights and played basketball here and there. At the start of March 2020, I had just gotten past my second quarter in the program while working 60 hours a week. My life consisted of a 45 min commute to FiDi in San Francisco and a 8 am – 8 pm work schedule. I did homework and lectures during my bus commute and for the most part, I had neglected my physical fitness. I knew that this was unstable.
After much thought, I decided to quit my full time job and dive into OSU’s CS program. I spent the next couple of weeks catching up on sleep, while starting to go on jogs (can’t call them runs because I wasn’t running 🙂 ). A month into being a full-time student, I felt like I had a lot more down time, but due to the pandemic, I was worried about going to the gym so I decided to not get a membership. However, I decided to start doing at home workouts on the peloton app. At this point I was going on jogs 2-3x per week and doing home workouts 2-3x per week. I started to feel better physically and mentally. Working out even allowed me to have a more structured day given that I was not working anymore.
July 2020
At this point, I was mid-swing into interview prepping for software engineering internship recruitment season in the fall. This meant going through different patterns in Leetcode-esque questions and doing mock interviews on Pramp. I was also taking 2 classes and making side projects. I had less free time and as a result I started to work out less. I tried to counteract this by doing compound movement workouts like squats, cleans, and deadlifts. I was doing a 1×12, 1×10, 1×8, 1×6 split for those workouts with increasing weights. I usually jumped rope for about 5-10 minutes prior to working out and did some stretching. Post workout, I also stretched and sometimes did a 20 minute yoga session. I also started to move away from jogging as I injured my right knee during one of my workouts.
November 2020
During this month, I was finally done interviewing and was lucky enough to secure an internship! However, my physical fitness suffered. I live with my girlfriend and we usually split the house duties, but during this time, my girlfriend’s company had their busy season, so I was doing more of the duties. With doing this, all of the interviews and keeping up with school, I had neglected working out from the end of August to the start of November. As much as I wanted to feel bad for again being consistent and then neglecting working out, I tried to reason with myself that life happens. Prioritizing things like career progress and significant other support were more important to me at the time. This month was also my birthday month, anniversary celebration, and Thanksgiving. This meant taking time off and eating great food 🙂 . This meant less time to workout and more caloric intake of course. During this month I attempted to start working out again by doing some cardio days and light weight lifting days. For cardio, I mainly did Fartlek runs and recovery runs. For light weight lifting, I did Chest/Triceps, Back/Biceps, Shoulders/Traps, and legs splits with low weight and higher repetitions.
December 2020
The start of December was great! I had been working out consistently for about 1 month. I started to feel good again like I did during the summer. I decided to switch my workout types from cardio and light weights to heavy weights and fun cardio. For my lifting sessions, I did 2×8 warm ups and 2×6 increased weight and 1×4 70% of personal record weight. My fun cardio was biking around Golden Gate Park in San Francisco. During one of the biking sessions, it rained super hard and somehow a couple of days later I got the flu. Not saying rain causes sickness, but it is weird how I got sick suddenly. This derailed my workout plans and my holiday plans. It was the end of the year and I had again stopped working out. I was sitting on my couch, sipping on some Theraflu, and thinking “when will I be able to workout and not have something come up”. It’s safe to say I was frustrated, but luckily I knew this had always been part of my life. You go forward 2 steps and take a step back. But, regardless, we keep moving forward.
Conclusion
Overall, you all can see that my fitness journey was very much affected by what was going on in my life. I definitely put it in the back seat whenever I had to take on more responsibilities or when I became ill. What I don’t show here is how frustrating it can be to start and stop over and over again. In the next blog, I will be going over 2021 and you will see how this has continued to happen. My workouts changed significantly and I began to enjoy learning new workouts and adopting/unadopting a new hobby; running!
Hi and welcome back everyone! In this post, I will be discussing my experience learning how to program at Oregon State, what helped me improve my programming abilities, and what helped me overcome (mostly) imposter syndrome.
CS @ OSU
Before diving in, I want to give you all the structure that I will be using. I will be briefly mentioning some of the early courses and giving out some pros and cons to them.
CS 161
This introductory Computer Science class seemed pretty slow paced until about the 9th or 10th week. I thought the instructor Tim Alcon did a great job breaking down assignments and giving us clear instructions. I also have to thank some of my peers for being so persistent in trying to find edge cases to every assignment. However, I was not prepared at all for the size of the last project and felt that with working 50-60 hours per week, it was nearly impossible for me to finish at the time. In retrospect, I really enjoyed this course and would make the difficulty ramp up earlier in the quarter so the students can get adjusted.
CS 162
This was another introductory course also taught by Tim Alcon. This course felt a bit harder, but still well structured with clear assignment descriptions (a gem in this program really). The last assignment was a large OOP assignment that really kicked my butt. Again I think it would be wise to do bigger and more difficult assignments that lead up to that one but I digress.
CS 271
This was a Computer Assembly and Architecture class. The class that took away my 4.0 GPA. I think the first two weeks are very intense if you really want to understand what the relationship between different parts on a motherboard are. I recommend taking the first few weeks seriously because this class builds on top of what you learn in those weeks while the rest are separate. I enjoyed the material and felt like I was starting to actually understand how a computer works, however I did not think the ramp up was going to be so short. I would say evening out material over the weeks would make this class better.
CS 290
This class was a web development class. This was the first class that I felt ahead on most things, but that’s largely due to the fact that I had taken a web development bootcamp MOOC course on Udemy. Had I not taken it, I doubt I would’ve done well. My peer’s reviews of this class are on the dot: messy, unstructured, old material, useless trivia quizzes and final. The pros I can find are that you learn a foundation that if followed on upon can lead to marketable skills. We learned Javascript, HTML, CSS which can lead to React, Angular, Vue, etc. I also really enjoyed web dev overall as I could see the changes I was making in real time, which is something you don’t get to do with other classes really. Also, this course has changed a lot since I took it and I have heard great things about the restructure. This review is definitely outdated and only my experience.
CS 261
This was the Data Structures class. I really enjoyed this class as it had a slow pace and really allowed you to dive into the data structure to understand it better. The assignments were within the difficulty level you’d expect and the TAs + instructors were always on top of the questions being asked. I wish the term had been longer so that we would’ve been able to learn more advanced data structures like AVL trees, Red/Black trees, etc. Overall, there is nothing surprising and the ramp up is quite nice. I actually found myself talking about this class during an interview for a FinTech startup. The interviewer was surprised I had said my favorite class so far had been data structures!
From these five classes, you can infer that my experience with learning how to program at Oregon State varied between classes and instructors. I think for the most part, classes like 161, 162, 271, and 261 do a great job at giving clear instructions and being open to discuss any issues that may arrive. I also think that these four classes do a great job of setting up objective grading criteria and the staff does a good job at taking a second look if something is off due to a typo. However, all of my learning did not come from these classes and I actually had to use external resources to really be able to hone down some of the material we were learning. I will be going over those in the next section.
How I Improved my Coding Abilities
Prior to starting Oregon State, I looked at resources online to learn what programming even was and had started doing Project Euler problems. Unfortunately, these types of problems don’t translate to Object Oriented Programming well. While everyone seemed to struggle with Discrete Math, I actually had a hard time wrapping my head around the interaction between objects. I searched how to learn OOP online but really learned while watching Corey Shafer’s channel on YouTube and Traversy Media’s channel on YouTube. They did a great job breaking down interactions between objects and showing different examples of the four pillars of OOP.
As for Computer Architecture, I also went to YouTube and found MIT OpenCourseware courses. However, this class already has great information provided to students so the extra lectures are not necessary. What did help me was doing mini projects apart from the homework assignments given. I felt getting more comfortable with the more I did these small side projects.
For Web Development, I completed a MOOC course on coursera: Colt Steele’s Web Development Bootcamp. This course went over what the class goes over and at a $15 price tag. I really enjoy how Colt breaks every concept down and then goes over examples while also giving out mini assignments for you to do. Highly recommend it!
Lastly, we have data structures. I actually think that the class does a great job of going over all the concepts but I also used CS Dojo’s Youtube channel and AlgoExpert (costs like $100 but I used a friend’s account). For me, it was more about learning how each data structure differed from the other like a stack vs queue vs list vs array vs double ended queue. I also did every assignment slowly while taking a look at the debugger a bunch.
Overcoming Imposter Syndrome
The title of this section is a bit misleading. I believe that imposter syndrome comes in waves. I felt it while doing CS 271 and realized that the only way to not feel it for me was to crank out side projects and get comfortable with the language I was using. This again happened later on in my OSU journey while taking Operating Systems in C. I had never coded in C yet there were students from the C++ intro course cohort in the class and I felt like I didn’t deserve to be in the same class. What helped me was taking a MOOC course for C programming and really trying to understand how C was different from Python (POINTERS and MEMORY MANAGEMENT 🙂 ). I actually ended up really enjoying that class and C. Actually while interviewing for different internship roles the following quarter, I thought about doing low-level programming and moving more into embedded, but that’s a story for another day.
I also felt imposter syndrome during my internship this past summer. Many of the other interns came from prestigious universities and seemed to know so much more about CS and Software Engineering in general. I reminded myself of all the other times I felt this way and again went the route I did in the past: auxiliary learning. There are many more facets to imposter syndrome like how it can cause anxiety, depressive thoughts, and an overall feeling of uselessness, but I will not be going into that here. All I can say is that, for me, working on my skills outside of the requirements given really helped me put my thoughts at ease and I hope this is also the case for any of the readers reading this section. It’s tough to overcome, even if momentarily. Just remember, we were all once beginners.
Conclusion
And, this wraps up my two part series on my background and my OSU experience. I hope you all enjoyed it. I will be writing more on different topics in the future and hope you all can learn from/enjoy reading my blog!
Hi again and welcome back to my blog. If this is your first time here, my name is Anthony. I like to talk about different technologies, projects, and for the first time in this blog, my experience finding Computer Science.
This will be part one of a two-part series (much like the Slack series). And don’t worry, it’s not another super technical post. Even the best of us need a little break from just reading about how to create X with Y technology. Here, I will be talking about my background and what led me to Oregon State’s Post-Bacc Computer Science program. In the second part, I will be discussing my experience at OSU and what helped me improve and overcome the feeling of not knowing what you are really doing (imposter syndrome).
My Background
There’s a lot to my background as I would guess is the case with most people. I was born in Lima, Peru and immigrated with my mother at age 6. I lived in Miami, Florida for a few years, but mainly grew up in a small town called Rancho Cucamonga within Southern California. Life in Rancho was very similar to any other stereotypical suburban town, yet I still hold my upbringing close to my heart and find myself reminiscing about the small gems in the city. But anywho, growing up I was never really interested in computer science or even computer science adjacent topics. You usually hear about how some of the brightest software engineers were coding by the age of 11 or something like that (yes, like Elon). Funny enough, I was quite the opposite. I got pretty frustrated every time I used my desktop because it was really slow and thought that it was not something I would ever find myself using everyday. I even remember timing my computer to see how fast it would load something. So, yeah, I was definitely not naturally attracted to the field, however, life seems to have had other plans in mind.
Highschool Days
Fast-forward to senior year in highschool and I found myself taking this new class called AP Computer Science because some of my best friends wanted to take another AP class for college admissions (real go-getters). In this class, I was introduced to the Java programming language. Let me tell you, this class felt like it was another foreign language course for me. The first few lessons were okay, but as it advanced and we began learning object oriented programming, I began to struggle. Coupled with the fact that it was my senior year and I was in the middle of sending out college apps, doing sports, and working part-time, I just about gave up on the course. I ended up getting like an A- or something in the course, but I knew that there was NO way that I would be pursuing this topic as a major in college the following year.
Bachelor’s Degree 1.0
The following year, I enrolled at the University of California, San Diego and majored in Physics. Yep, physics. Why physics? I had always been into different areas of physics growing up whether it be reading books like The Elegant Universe or Michio Kaku’s newest book. That year I found myself having a difficult time keeping up with my classmates in the Honors track for Physics. I also spent most of my time in the library trying to maintain a good enough grade for graduate school. Towards the middle of my second year, I realized that this was not the life I wanted to lead. I wanted to live my life.
That quarter I took a break by taking some social science classes (part of my college requirement). One of the classes was a class on power and justice. Learning about the power structures in different organizations and how life was influenced by such institutions piqued my interest. I took additional courses in Political Science and by the end of my sophomore year, I decided to change majors. Fast forwarding again to the end of my senior year, I decided to study abroad in Paris at one of the best Political Science schools in the world: Sciences Po. I had the idea of going to law school and took courses in contracts law and behavioral politics while applying to law school. Aaaand, I got into a few law schools with pretty massive scholarships. However, my time in Paris made me realize that law school wasn’t something I was truly passionate about.
Post-Grad Life and Direction
After the realization, I scrambled to find a new job and luckily was able to find a position at a consulting firm in San Francisco. Surprisingly the hours were okay, but the job was mundane at best. I kept remembering how much of a challenge physics was and almost missed the feeling of being challenged. This feeling grew more as I spent time hanging out with my friends that worked in the Tech industry as software engineers and always heard about what they were working on. I was getting the scoop on how their teams contributed to their company mission and almost always it had a direct impact on people. That was it. I wanted to be challenged in my work and be able to work on things that could directly impact people. It was both my experience during my stint in physics and my interest in understanding institutional impact on society while studying political science that made me realize that I should look into Software Engineering.
Leap of Faith
Shortly after, I found myself taking MOOC courses in SQL and Python and really enjoying it. I realized that if I wanted to really make this career switch, I’d have to look at all avenues on how to achieve just that. I researched on how to make the switch and read a lot on other people’s experience coming from an untraditional background. From what I gathered, there are 3 main paths: self-taught, bootcamps, and college. The bootcamp route seemed like the shortest path to the career I wanted, however I realized that my goal was not to just land a job. I wanted to really dive into computer science. I wanted to learn broadly so I could learn in depth. My decision to pursue a 2nd bachelors at Oregon State was mainly because I wanted to be able to learn the fundamentals in computer science while not having to move cities/states.
This is part 2 of creating a Slack app! Here I will be discussing how to set up a Bolt for Javascript backend with Node.js and what steps are necessary for your app to receive events and respond back to them. This again will serve as a compressed version of existing documentation and as a way to better explain certain topics.
If you have not read part 1 of this series, feel free to take a look at that first and then come back here to continue the journey! If you’re familiar with creating a Slack app and just need a refresher for how to set up the server, then come along for the ride!
What is Bolt?
Our definition here will be the definition found in the Bolt for Javascript documentation. Bolt is a Javascript framework that allows the user to build Slack apps with the latest platform features.
So what does this mean for us? It means that Bolt allows us to create a Slack app that listens to the “slack/events” endpoint to get all incoming requests. This is important because when we set up request URLs for our events, we should set it to end in “slack/events”. So when we do an action in the app and the action fires off an event, that event request is sent to the request URL that we set it to. Our app will be able to receive that request, and as a result we will be able to respond to it.
Now that we know this, we also want to know what type of events we will have access to. Well we will be describing this in the “How to subscribe to events” section, but for now let’s get our backend set up.
We will then take the example code from the documentation:
const { App } = require('@slack/bolt'); const app = new App({ signingSecret: process.env.SLACK_SIGNING_SECRET, token: process.env.SLACK_BOT_TOKEN, ); /* Add functionality here */ (async()=>{ // start the app await app.start(process.env.PORT || 3000); console.log('⚡️ Bolt app is running!'); })(); async () => { / Start the app await app.start(process.env.PORT || 3000); console.log('⚡️ Bolt app is running!'); )();
Now we will create an env file to store our environment variables which in this case are the signing secret and bot token. We can go back to our app’s management page and get these from the Basic Information page and OAuth & Permissions page, respectively.
With those two parts stored, we can now start our app by running:
node [app_name]
But, now that we have a working app, how do we make it communicate with Slack? Our app is currently running locally, so we will need a tunnel such as ngrok to be available to share the app publicly. Here is the link to download it or we can just do npm install ngrok in the command line.
When installed, we can create a tunnel by running on your terminal:
./ngrok http [custom_port_number]
Source: tunneling with Ngrok (https://api.slack.com/tutorials/tunneling-with-ngrok)
Then we can use the response url given in our next step “how to subscribe to events”.
How to subscribe to events:
We currently have a running app, so now we want to add some functionality to it.
As I previously mentioned, our app is able to listen to any event requests and with this information, we can now take a look at the various event types that are available within a Slack app, here.
After taking a look, we can enable event subscription by heading over to our app management page and clicking on “Event Subscriptions”.
When we get there, we will toggle the switch and we will see the following:
We can enter our ngrok response URL and concatenate “/slack/events” for all our subscribed event requests to be sent over to the URL we just input.
Since we know our app listens to any event types with the request url ending in “slack/events”, then we know our app will now be listening to the events we just subscribed to.
How to respond to events:
Now that we have subscribed to events, we want our app to not only listen to the request but also be able to respond to them. Here we will go over a single event type and will provide links to API docs for the others. This is due to the large number of events and the subtle but important differences that come with every one of them.
Anyways, we will now jump into responding to the “‘app_home_opened” event, which is the most used event type. This event type fires off a request every time a user navigates to either the home, about, or message tabs. I will provide the structure and then explain them one by one.
Structure:
app.event('app_home_opened', async ({ event, client, context }) => {
try {
/* view.publish is the method that your app uses to push a view to the Home tab */
const result = await client.views.publish({
/* the user that opened your app's app home */
user_id: event.user,
/* the view object that appears in the app home*/
view: {
type: 'home',
callback_id: 'home_view',
/* body of the view */
blocks: [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Welcome to your _App's Home_* :tada:"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "This button won't do much for now but you can set up a listener for it using the `actions()` method and passing its unique `action_id`. See an example in the `examples` folder within your Bolt app."
}
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "Click me!"
}
}
]
}
]
}
});
}
catch (error) {
console.error(error);
}
});
The first thing you see is the app.event(), this means that our application is listening for events instead of, for example, app.command() which listens to commands.
Then in the first parameter position we see “app_home_opened”, which is the type of event that it is.
In the second position we see async({event, client, context})=>{}); which is an async function that describes what will happen as a response to the app event type. Inside the JSON object within the async function, we see three variables: event, client, context. Event will hold the attributes type (specific name of event), event_ts (event timestamp), user (user ID of user that created this action), ts (timestamp of what the event describes), and item (data specific to the underlying object type being described). Usually, you will only care about the user here, but feel free to read up more on “event”: here. The client is the web api client which serves as a way for us to publish new content or to respond to someone in a group message, etc. The context here is the event context.
In the example above, the user is using the client to publish a new view and then grabs the user id. Inside the view, the user uses Slack blocks to create the UI for the view. We can see that in this case, context is not used so it can be left out. This is also true of event, since the user never utilizes the user id grabbed from event.
As you can tell, with any event, we will receive a certain set of parameters that we will use inside our response. Here is a list of parameters and descriptions of each.
TLDR:
To summarize the above, we can use Bolt for Javascript to make our app be able to listen and respond to events. To do this we install node, @slack/bolt, and ngrok. We use ngrok as a way for our app to be publicly shared so Slack’s event requests can get to our app. We subscribe to events by going to our app management then heading over to Event Subscriptions and toggling Enable App Events. After this, we can input our ngrok url + “/slack/events” so that our app knows to send the event requests to this URL. We scroll down and pick the events we want to subscribe to. Finally, we can respond to the requests inside our app. We see that the structure will be “app.event([event_type], async({param1, param2, param3,..,etc} =>{ functionality and response});”. Inside functionality, we can create new views, update views, message someone back, and a plethora of other actions.
What’s next?
This will conclude my series on getting a Slack app up and running. At this point, you can create any functionality needed by understanding what each event type will send in each request fired to your app. Additionally, you can learn more about different requests like actions, commands, etc and use these to make your app more dynamic, however all of these are similar in nature and explaining these will become redundant.
I hope you all have liked this series and learned more than things listed in the documentation given by Slack. I will be updating these two parts at some point, but for the meantime, I will be exploring different topics in this blog. See you all soon!
This will be part 1 of my Slack Journey where I will be covering the following:
Background with Slack
How to set up a Slack app
How to enable home tab and slash commands
How to distribute the app so that the app shows in the app directory
How to add long descriptions for the app in the about page and app directory
What is Slack?
If you’ve made it to this post then that means you know what Slack is! Well, I hope at least. However if you don’t, then here is a refresher straight from the source: Slack is a proprietary business communications platform owned by Salesforce.
If you’re like me, you would ask well then what is a business communications platform and how is this different from a regular communications platform like Discord or Facebook Messenger?
Well, Slack is more focused on organizations than communities. For example, there exists pricing tiers where organizations have access to more tooling that allows administrators to provision users and handle security aspects of your organization’s configuration.
If all that did not make sense and you do not know what Slack is yet, here is more information that will help you understand: click me!
Background
Now that you are back (if you left to read about the joys of Slack), I want to give a little background about my experience with Slack app development.
This past summer, I was a full-stack software engineer intern at Salesforce and became a Slack certified developer. My main intern project was to create a Slack app that would be able to integrate a natural language processing (NLP) chat bot, and have all the functionalities that the bot would provide the user.
So now that you know my background let’s jump straight into getting up and running with building a Slack App!
What do we want
For this part of the journey, we will follow this guide a bit but will diverge from it as we get deeper and deeper into the subject. Some things are bound to be the same regardless of how you want to get started and this is one of them! However, I hope that my explanations and descriptions help you better understand how to do these steps. I know I needed something like this when following the guide!
Our goal is an app that has a Home page, About page, Messages page, and an App Directory page. We want an enabled home page. In the about page, we want a long description of what the app is and also slash commands enabled (shortcuts for functions). In the messages page, we want to be able to send messages to users (need scope). In the app directory, we want images for our app and a long description of our app.
Create an App
The next step is to click on “create an app” and fill out your app name and pick the workspace you want your app on.
Your next step is to give your app the necessary scopes for it to do what you want it to do. In this case, we simply want to give it the ability to post to channels in your workspace so we go to OAuth & Permissions -> Bot Token Scopes -> Add an OAuth Scope -> Select chat:write.
Other scopes are also available depending on the situation. You can read more about them here.
Install Your App
Go to OAuth & Permissions -> Select Install App -> Click Allow
After this, you get redirected back to the OAuth & Permissions page. However, now you have a Bot User OAuth Access Token. This token is basically the installing user’s “okay” to all the requested scopes that your app asks during the OAuth flow (installation process). More on the OAuth flow here.
Enable App Home
Since your app will use the home tab, you will need to enable App home in the App Management page.
After this we can also enable slash commands by going to App Home -> Messages Tab -> check on “Allow users to send Slash commands and messages from the messages tab”. Slash commands are basically a shortcut to getting a response from your app in the messages tab. The slash commands are located in the about page and will look like the below:
When you click on the button, it will redirect you to the messages tab where you will have the option to add parameters to the command. These parameters help your backend understand what response to issue. Once you click on the arrow to send the message, your app will respond with the appropriate response indicated by your app’s backend.
Distribute App
To be able to add long descriptions to the app’s about page and app directory page listing, we need to do a couple of things. The first is to check that there is no hard coded information like OAuth tokens in your app. We confirm this by going to Manage Distribution -> Share Your App with Other Workspaces -> Remove Hard Coded Information.
Second, we have to add an OAuth redirect URL. This allows other workspaces to authorize use of your app. Manage Distribution -> Share Your App with Other Workspaces -> Add OAuth Redirect URL. This URL will be where Slack sends the events your app subscribes to. Think of these events like the events in a web app such as “on click” or “on submit”. This URL will almost always come from your app’s backend. This will be the url that your app is hosted on. We add “/slack/events” to the URL because Bolt for Javascript listens to all incoming requests are this route.
Once we have that done, we can subscribe to events. We will be walking through this in the next part!
Finally, we can go to Manage Distribution -> click on Activate Public Distribution.
Now we can add long descriptions to the App directory page and About page.
Add Long Descriptions
After the tsunami of steps in the previous section, I can safely assure you that this last section is probably the easiest and most satisfying. Looking back, I actually wish I had the previous section when creating my intern project. You’d be surprised how long it really takes to figure all these steps out (about 4 hours 🙂 ).
Onto the last step we go! Maneuver over to “Basic Information”->Display Information-> Long Description. Here we can add our app’s description. Below this, we can also add images to our app and other fun things.
Wrapping it up (aka TLDR)
I know what you’re probably thinking: “Anthony, this is way too much information all at once” aaaaand yes it is. At this point I have thrown terms like Access Token, OAuth flow, Bot Tokens, Scopes, and Slash commands at you and you might be wondering if you can even make an app in addition to all of these configuration steps. Well this is probably the most confusing part of creating an app. After this, you will mostly be trying to try different Slack APIs together to make sense of what you want your app to do.
Here is how all the concepts are tied together:
We create an app by naming it and deciding where the app will live. Then, we need to give permission (scopes) to our app to be able to do things like post in a channel or send a user a DM. After, we install the app so that we can get an access token that indicates the user is okay with you taking the actions that you are allowed to do (scopes) in the app. We then move to adding more content to our app by enabling the home app and slash commands. We also want to subscribe to our app to any events that happen inside the app with a redirect URL. This URL is where your app is hosted. We also want to avoid security concerns so we remove any hard coded info. Moving on, we want our app to have a long nice description so we have to publicly distribute it. After enabling distribution, we can then add long descriptions to our about page and app directory page.
And, that’s it! You made it! Part 2 will be out next week. We will discuss setting up a Bolt JS backend and subscribing/responding to events.
Hey! Welcome to my blog, my name is Anthony Ferrari. I will be using this space to talk about different technologies, projects, and my journey to becoming a FT SWE. Follow along and enjoy the ride!