Build WhatsApp chatbot using NodeJS – part4

Step 13. Handle user’s input:-

So here we’ve created another folder called “pdf” and inside that we’ve created another file called Index.js in which we’ve written this function called ” getQuotation ” to transform data as per our needs.

Step 14. Create invoice

Here we’ll be writing createInvoice.js file inside pdf folder and we’ll using pdfkit & nodemailer in nodeJs to create pdf file and send this file to recipients.

Step 14. Deploy your code

Now we’ve our code ready to generate an invoice for us. Let’s deploy this code on aws lambda function. So this function can be invoked on demand

Below line of code would deploy your code and you’ll be ready to use your WhatsApp chatbot

sls deploy

Watch the below video to understand how WhatsApp chat-bot is generating invoice on demand.

Kindly note that always create  separate folders and files for different tasks to make your code modular and easy to use.

End Notes:-

I hope that now you have a basic understanding of how to build a basic chatbot in real time .This one simple proof of concept should help you to implement some of the more sophisticated techniques available today in NLP and chatbots area.
Did you find this article helpful? Please share your opinions/thoughts in the comments section below.If you have any questions, feel free to post them below.

I encourage you to checkout my GitHub repository for this project on below link. Feel free to clone the repository and try this from your end.


Leave a Reply