teleren/devto huggingface dataset:
Building a Chatbot with NodeJS
Published: 2022-12-20 11:19:48

---
title: Building a Chatbot with NodeJS
published: true
description: 
tags: 
# cover_image: https://miro.medium.com/max/1400/1*j8wlAPZZVSH8FXQyyeTjcQ.png
# Use a ratio of 100:42 for best results.
# published_at: 2022-12-20 11:15 +0000
---

Building a WhatsApp Chatbot using Node.js
WhatsApp is one of the most popular messaging apps in the world, with over 2 billion monthly active users. As a business, being able to reach and communicate with your customers through WhatsApp can be a game-changer. One way to do this is by building a chatbot that can automatically respond to customer inquiries and requests.

In this tutorial, we will show you how to build a simple WhatsApp chatbot using Node.js. We will be using the Twilio API for WhatsApp to send and receive messages from your chatbot.

Prerequisites
Before we get started, you will need the following:

A Twilio account and a WhatsApp sandbox: You can sign up for a Twilio account here and set up a WhatsApp sandbox here.
Node.js and npm: You can download and install Node.js here and npm will be installed along with it.
A text editor: We recommend using Visual Studio Code, but you can use any text editor of your choice.
Setting up your project
First, create a new folder for your project and navigate to it in your terminal. Then, run the following command to create a package.json file:

```npm init -y```
This will create a package.json file with default values. Next, we will install the required dependencies for our project. Run the following command to install the Twilio npm package:

```npm install twilio```
This will install the Twilio library that we will use to send and receive messages from our chatbot.

Sending a message from your chatbot
Now that we have everything set up, let's write some code to send a message from your chatbot.

First, require the Twilio library in your project:

```const twilio = require('twilio');```
Next, set up your Twilio credentials and the phone number that you will be sending the message from (which should be the phone number you registered with your WhatsApp sandbox). You can find your Twilio Account SID and Auth Token in the Twilio Console.

```
const accountSid = 'your-twilio-account-sid';
const authToken = 'your-twilio-auth-token';
const fromNumber = 'your-twilio-phone-number';
```
Now, let's create a function that sends a message to a given phone number:

```
function sendMessage(toNumber, message) {
  const client = new twilio(accountSid, authToken);
  client.messages
    .create({
      body: message,
      from: fromNumber,
      to: toNumber
    })
    .then(message => console.log(message.sid))
    .done();
}
```
To test this out, call the sendMessage function from whatsapp.
The Case for Using Professional Tools for Side Projects
Tags: career, sideprojects, personaldevelopment
Published: 2022-12-20 11:02:00

I have started (and abandoned) countless side projects over the years.  Usually, they are unplanned, and coded off the cuff.  And, usually, they never see the light of day.


![Girl robot writing code on a large screen](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gacsfgfznupn8wi7337h.png)

And, that's actually fine.  Side projects, for me, are a way to play with new tools, explore creative ideas, and advance my learning.  And yet, there is a certain level of dissatisfaction with never completing anything.

Furthermore, part of growing as a software engineer is learning how to manage projects to completion. It's learning how to budget time and resources and actually ship a product.  But, at work, I don't always have access to the administrative side of the tools we use for planning and change management.  So, what better way to build up my skills than to add a bit of discipline to my extracurricular coding?

Another factor is brought up by [this great talk by Simon Willison](https://www.youtube.com/watch?v=GLkRK2rJGB0), where he advocates extensive documentation of side projects to facilitate context switching and managing many projects at once.


![A girl robot juggling laptops](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hotlrqq1kowipsjznljf.png)

To that end, I'm playing with a personal Jira account. I'm configuring road maps for my projects with a series of epics for the various project parts.  I've connected Jira to Github, and am playing with setting up my own CI pipeline using actions.

I'm treating the "work" I'm doing in a more disciplined manner, but still allowing myself to play and have fun while doing so.  

I find Test Driven Development on these little projects to be quite satisfying.  The red/green cycle of getting the tests passing is a dopamine hit like nothing else.  

I'm using linting and code standards now to enforce cleaner code.  But, because it's MY code, I get to pick the standards - and I get to pick my toolset.

I also get to do things like writing my documentation in markdown, and keeping it committed with the code, and other little things I wish we did at work.  It's a bit like 'playing business' like we played house or school when we were kids.  I'm finding that doing these things because I want to and not because somebody dictated it makes it more fun to learn best practices.  

I honestly do not know if this practice will help me actually complete a side project.  But, I do know it's helping me become a better developer.  I have a better understanding of what our tool chain can do.  And, I think I'm writing better code because of it.
An AWS Community Builders holiday story
Tags: cbchristmas2022
Published: 2022-12-20 11:00:00

Hi all!

I love the initiative that the 'HotChowSprings' crew thought up. There has been a lot of love been given to the community from the community leaders which immediately moves into the first question!  

### What surprises you most about the community builders program?

I've been surprised by the level of interaction between the community leaders and the community builders. But also, and this activity is just a public example, of the community builders giving back to the program. 

I love the Slack community. The help we give each other from technical and mindset, to education and training. It's spectacular. 



### What’s your background and your experience with AWS?

I've been working with AWS for years. I started together with my then company going from datacenter to AWS. 

I started as a Windows engineer when the cloud project started. But by stepping up and proposing, designing the method of migrating Splunk into AWS using IaC. The company gave me the trust to implementing it and I succeeded without downtime and under time/budget. 

Over the years, I've designed an implemented more and more workloads on AWS. Moved companies and now I do architecture for a living!

### What’s the biggest benefit you see from the program?

The biggest benefit I feel is the connection with like-minded people all over the world. You need to apply to get into the Community Builders. And everyone that made it in has put in a good amount effort to bring AWS to the world. 

By speaking with other Community Builders, I get inspiration in my own work. And I've helped people out with technical and architectural advice. 

### What’s the next swag item that you would like to get?
I am such a hoodie-hoarder. I wear them every day. My 2020 hoodie has been worn down that my wife is complaining. 

This year, at Re:Invent I was able to bribe my colleague for his hoodie so I could bring back two and could switch them.

So, in case it wasn't obvious, I'd like a lanyard... No, a hoodie! CB Hoodie! GIEV! ;)

### What are you eating for dinner today? Share the recipe!
Tonight I'm making Chinese Mushroom Noodle Soup!

The base recipe is here:
https://www.errenskitchen.com/chinese-mushroom-noodle-soup/

I'm adding a bit of spring onion and pak choi to it for some more veggies!

### Is there anything else you would like to say about the community builders program in 2022?

Thank you for existing. Your public and private presentations and interactions are amazing, the events are great and the community is awesome. I love being part of it. Giving us this platform on dev.to is great, even though I haven't used it much. (a blog is coming though!) If I were to give any comment, especially for our use of dev.to, it would be to inspire for quality over quantity.
Hardening ssh service on Ubuntu/Linux server
Tags: devops, linux, ubuntu
Published: 2022-12-20 10:40:43

Checklist:

- Disable ssh login for root user
- Disable password login

## 1. Create new user

```bash
adduser <username>
```

Add user to `sudo` group:

```bash
usermod -aG sudo <username>
```

or add this line to file `/etc/sudoers.d/90-cloud-init-users` (sudo without password)

```bash
<username> ALL=(ALL) NOPASSWD:ALL
```

## 2. Add ssh key for new user

Add ssh key to file `/home/<username>/.ssh/authorized_keys`

## 3. Disable root login and password based login

Edit file `/etc/ssh/sshd_config`, Find `ChallengeResponseAuthentication` and set to `no`:

```bash
ChallengeResponseAuthentication no
```

find `PasswordAuthentication` set to `no`:

```bash
PasswordAuthentication no
```

Search for `UsePAM` and set to `no`:

```bash
UsePAM no
```

Finally look for `PermitRootLogin` and set it to `no`:

```bash
PermitRootLogin no
PermitRootLogin prohibit-password
```

Save and close the file. Reload or restart the ssh server on Linux:

```bash
service ssh restart
```
Backdrop-filters, (With examples)
Tags: codepen, css, html
Published: 2022-12-20 10:26:58

<p>Backdrop filters in CSS. This project demonstrates how CSS backdrop filters can be used to create a professional-looking backdrop. The backdrop-filter CSS property lets you apply graphical effects such as blurring or color shifting to the area behind an element. Because it applies to everything behind the component, you must make the element or its background at least partially transparent to see the effect.</p>

{% codepen https://codepen.io/Amiru-Weerathunga/pen/qBKgOYg %}
How Bitcoin (really) works?
Published: 2022-12-20 10:19:05



### 1. Discovering seed nodes

Bitcoin nodes discover other nodes from a few hardcoded DNS servers.

![discover seed nodes](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bzjsjdac1rek4fei3kss.png)

Script: https://github.com/liveduo/bitcoin-scripts/blob/main/1-discover-nodes.js*

*33 lines of code (no npm dependencies)

### 2. Connecting to a node

Bitcoin messages are sent over TCP and contain a payload and some metadata (type, length and checksum).

![connect to node](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8xx08bs1jp8ldz7ui3g8.png)

The first messages sent are "version" and "verack" messages are used to establish a connection. Then, "ping" / "pong" messages are sent periodically to signal the connection is still active.

![establishing a connection](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u50pwc5ypx4xgz0ho4oq.png)

Script: https://github.com/liveduo/bitcoin-scripts/blob/main/2-connect-node.js* 

*90 lines of code (no npm dependencies)

### 3. Creating an address

Bitcoin addresses are derived from private keys (or seed phrases). Mainnet and testnet addresses have different formats (for most address types).

![create a bitcoin address](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ocvexraxtfj36ulyioyh.png)

Script: https://github.com/liveduo/bitcoin-scripts/blob/main/3-create-address.js*

*67 lines of code (depends on `bs58` and `secp256k1` npm packages)

### 4. Creating a transaction

Transactions contain inputs and outputs. Inputs validate the owner of the transaction and outputs indicate where the coins should go.

![create a bitcoin tx](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u8cdod0hqd33tt4mhr99.png)

Script: https://github.com/liveduo/bitcoin-scripts/blob/main/4-create-tx.js*

*65 lines of code (no npm dependencies)

### 5. Broadcasting a transaction

Node advertise block and tx hashes with "inv" messages. Interested nodes ask for the data with "getdata" messages and receive them as "tx" or "block" messages.

![broadcast bitcoin tx](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1ufndrhv4cd2cvu1sys6.png)

Script: https://github.com/liveduo/bitcoin-scripts/blob/main/5-broadcast-tx.js*

*163 lines of code (no npm dependencies)

### What's next

Find more details on:
https://www.tzionis.com/bitcoin-protocol-in-45-minutes

PS: There are embedded Repl.it scripts that you can run right within the blog post so you don't have to setting up anything locally
Don't join companies who screen you with their corporate values compatibility on the first call
Tags: leadership, management, culture
Published: 2022-12-20 10:08:44

Especially if you fancy creativity and accountable freedom at work. 

If you like joining isolated tribes with big EGOs but no balls to make collaborative and collective decisions effectively, you do enjoy a lot of bureaucracy just to prove the point you hearing 'NO' way or 'MY' way, often, and you accept the fact that your first mistake is your last one, then carry on. Prove your compatibility with their sophisticated values, even before you understand if your essential competences can become anyhow a fit for the needs to fulfill any goals.

People should be hired on top of hard competences and fired if they lack soft competences to fit the already performing team, and over a period of time, not instantly. Not the total opposite. 

And if a company interviewers allow you and even encourage you to assume too much instead of asking questions and verify facts, then it's another strong warning that they do assume a lot on their daily, regular basis. 

And as we all know... assumption is the mother of all ... [things you don't want to experience (at the end)].

Unfortunately, even big tech and sometimes especially big tech companies do approach candidates this way. 

No wonder they need to acquire start-ups to catch up with the innovative edge. They brainwash their own internal talent to stay focused on values instead of providing the clarity about the goals, setting up the teams to collaborate and to effectively create a collective that can grow in all competences (both hard and soft) and get things done!
Community Builders – My Experience
Tags: cbchristmas2022
Published: 2022-12-20 10:08:30

**What surprises you most about the community builders program?**
_This is one of the greatest programs started by AWS and I feel really great to be part of this program. Blogs, events, gifts etc. are really helpful to enhance knowledge about AWS and helps to gain latest AWS features and this helps you to be ahead of others in discussions._
**What’s your background and your experience with AWS?**
_I am AWS security solution architect and AWS security specialist certified. I work with various AWS services to create a secure environment for customers when they move to AWS._
**What’s the biggest benefit you see from the program?**
_Knowledge about AWS services, features, that gives you edge during discussions with customers._
**What’s the next swag item that you would like to get?**
_Hoddie, jacket, tshirt etc. that I can use my daily routine and show to the same to others that this is my real brand LOL._
**What are you eating for dinner today? Share the recipe!**
_I am going to have glass of wine with roasted chicken and fish._
**Is there anything else you would like to say about the community builders program in 2022?**
_I thank CB team to give me another chance to stay with this awesome program, this is really beneficial program from various aspects and anyone who is involved with AWS should join this program and this really helps to get edge of solution design, discussion and creating impressive solution presentation to customer and overall it help to win the business. I am always ready to help my fellow CBs and other freshers to get knowledge about AWS_
Improve your pull request workflow using pull-request-codecommit
Published: 2022-12-20 10:02:12

In my previous [blog](https://binx.io/blog/2022/02/10/commit-messages-done-the-right-way/) post, I wrote why it is important to write good commit messages.  
In this post I will highlight an example how this works in your advantage. Using an AWS CodeCommit repository.

Working example
---------------

Alright, lets assume we have a project that uses a `main` branch. In combination with feature branches.  
We want to add a feature to our project, so we create a branch called: `feat/my-feature`.
Let say we manage to get the feature working in a single commit. The commit message would look something like this:

> feat: add support for x
> 
> By adding support for x we allow x users to adopt this tool in their workflow.
> 
> Issue: #123

Now it is time to create a pull request! I have created a tool called [pull-request-codecommit](https://github.com/Nr18/pull-request-codecommit).  
This tool looks at the differences between the current branch. And the target branch and proposes a pull request message.
So if you want to create a pull request you type:

```bash
git pr
```

The default editor is opened. And in this editor you will see:

```txt
feat: add support for x (#123)

By adding support for x we allow x users to adopt this tool in their workflow.

Issue: #123
```

The first line will be used as the title and the rest as a description.  
You can alter the message to your liking, but if you use a proper commit message this is spot on already.  
When you save the proposal the pull request is created for you:

![git pr command example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n2h8ufaw82ve372letng.png)

For convenience the link is displayed and the eventual message. When you open the link the pull request will look like this:

![CodeCommit example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9clxvjyry3jceg3s4hhi.png)

What about many commits?
------------------------

When many commits are used the tool tries to propose a good pull request message. When you split your commits.  
And you used proper messages it looks something like this:

![git pr example with multiple commits](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o2ds57djgyewxzp702ro.png)

As you can see, the first commit is used as the title. The rest of the commit titles are shown as a list in the description.

Conclusion
-----------

When you write proper commit messages, you help your self. It makes it easier for you to draft pull requests.  
And it allows you to start using tools because you use standards.
Operation Merry Christmas
Tags: cbchristmas2022, winterseason, holiday
Published: 2022-12-20 10:00:00

## What surprises you most about the community builders program?

The people, I mean - I've had the pleasure of meeting community builders live at two ReInvents now. Both times these guys amaze me. We're all givers, not takers.

The warm hearted welcome and inclusion, and crazy ideas that we come up with when put together.

It keeps surprising me time after time.

## What’s your background and your experience with AWS?

I've got some 23+ years of IT career behind me, started out at a helpdesk on an ISP, went on to Linux system administration and datacenter management at the next ISP, and after cloud became the thing - left old style datacenters - to work with **someone else's datacenter**.

AWS experience for 8+years, 5 and 1/2 years fully just in cloud.

I love working with datacenters, specially someone else's. I don't anymore have to care if the A/C works or not, someone does it for me.
 
## What’s the biggest benefit you see from the program?

This pretty much circles around to my answer to the first question, the people, the community. I hope to see more of all you guys. Not to mention any by name, but you guys know who you are - taking part in this operation.

## What’s the next swag item that you would like to get?

I'm not a big fan of swag, as it a lot of time tends to be something not so usable. So took me a while to think of what would be useful, a travel power adapter would be great. Something that adapts to power my devices from all sockets around the world.

Or maybe invite to some live community event. Maybe one on every continent?

## What are you eating for dinner today? Share the recipe!

Dinner tonite, impossible to say - but I know I will be baking before Christmas, so want to share my favourite pie at the moment - the version I make of Key Lime Pie.

### Ingredients:

Base:
200g digestive cookies
75g melted butter

Filling:
4-7 fresh limes
5 egg yokes
1 can condensed milk

On top:
2dl whipping cream
1 1/2 tee spoons sugar
1 1/2 tee spoons vanilja sugar
1 lime

### What to do:

Base:
Crush the cookies in a blender, melt butter and combine with cookiecrumble. Spread onto a cake pan, covering the bottom and 1,5cm from the sides.
Preface in 150 celcius for 10min, while preparing the filling.

Filling:
Wash the limes, and grate the peel. Squeeze the juice into a cup (you'll need about 1dl in total, doesn't hurt to put more).
Separate the egg yokes.
Combine all ingredients in a bowl and whisk em together. 
Put the filing into the cake pan.

Cook at 150 celsius for 15minutes, let the pie cool in room temperature, and then put it into refrigerator for 3h or overnight.

Topping:
Whisk the cream with the sugars, grate lime peel for nice visual on top of the whipped cream while plating.

Enjoy.


## Is there anything else you would like to say about the community builders program in 2022?

I hope it'll continue in 2023, and the next years. And that I'll have a chance to participate even more.

Big thanks to the AWS team working with us. 

And Merry Christmas.
AWS Community Builders - Christmas Edition
Tags: cbchristmas2022, aws, awscommunity
Published: 2022-12-20 09:56:02

## What surprises you most about the community builders program?
It is phenomenal how many sharp-witted talented individuals are in the Community Builders program and everyone is so willing to share their knowledge. It really feels like we are one big family of engineers. 

## What’s your background and your experience with AWS?
Originally, I was a Busincess Science major in College until I made a risky decision to program switch to Computer Science. Long story short, I was lucky and got a remote software engineer job in Belize during my second semester of college. The company had an enterprise support plan and was a part of the AWS Partner Network. I was introduced to AWS by the Account Manager and Solution Architects through Immersion Days. I was immediately inspired by the power of the cloud. My curiosity led me to start building small side projects on AWS. 

Fast forward to today, I am now a Serverless Developer who's on the journey of making a career transition to become a Data Scientist. I would describe my experience with AWS as intermediate, there is always room for improvement. Learning never stops!


## What’s the biggest benefit you see from the program?
I would say the best benefit of the program is accessibility to a comprehensive network and vast learning resources. 

## What’s the next swag item that you would like to get?
I would love to have a CB Bomber Jacket!

##What are you eating for dinner today? Share the recipe!
### Tacos 
- Corn tortilla 
- Beef 
- Cheese 
- Tomatoes 
- Onion 
- Cilantro

##Is there anything else you would like to say about the community builders program in 2022?
Many thanks for giving us the resources and a platform for us to educate and influence others in our local communities and international.