Home / Companies / Twilio / Blog / Post Details
Content Deep Dive

Building an npm search bot with WhatsApp and Twilio

Blog post from Twilio

Post Details
Company
Date Published
Author
Dominik Kundel
Word Count
1,191
Language
English
Hacker News Points
-
Summary

To build an npm search bot with WhatsApp and Twilio, you need a Twilio account, the WhatsApp Sandbox Channel, and a webhook that responds to incoming HTTP requests. You can use Twilio Functions to host your webhook in a serverless function directly on Twilio. The bot will query the npm database using the axios package and reply with the name of the first package found. The response is formatted using a separate function that strips away whitespace and indentation, and joins the results into a neat string. The bot can be deployed to other channels like SMS without doing any code changes, making it a great example of how Twilio and WhatsApp can be used together.