{"id":18111936,"url":"https://github.com/philnash/whatsapp-bot-capabilities","last_synced_at":"2025-07-24T17:03:28.440Z","repository":{"id":37972102,"uuid":"267256827","full_name":"philnash/whatsapp-bot-capabilities","owner":"philnash","description":"An example of a WhatsApp bot that can respond to location messages and can send images, vcards and location messages","archived":false,"fork":false,"pushed_at":"2023-02-03T07:51:24.000Z","size":449,"stargazers_count":21,"open_issues_count":1,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-27T17:37:05.404Z","etag":null,"topics":["nodejs","twilio","twilio-api","twilio-functions","twilio-whatsapp","twiml","whatsapp","whatsapp-api"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/philnash.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-27T07:55:59.000Z","updated_at":"2024-08-12T20:01:57.000Z","dependencies_parsed_at":"2023-02-08T20:15:19.151Z","dependency_job_id":null,"html_url":"https://github.com/philnash/whatsapp-bot-capabilities","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philnash%2Fwhatsapp-bot-capabilities","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philnash%2Fwhatsapp-bot-capabilities/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philnash%2Fwhatsapp-bot-capabilities/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philnash%2Fwhatsapp-bot-capabilities/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/philnash","download_url":"https://codeload.github.com/philnash/whatsapp-bot-capabilities/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248816257,"owners_count":21166053,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nodejs","twilio","twilio-api","twilio-functions","twilio-whatsapp","twiml","whatsapp","whatsapp-api"],"created_at":"2024-11-01T01:08:44.389Z","updated_at":"2025-04-14T03:34:11.971Z","avatar_url":"https://github.com/philnash.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Building with the Twilio API for WhatsApp\n\nThis example code is from the [how to build a location-aware WhatsApp application Twilio webinar](https://ahoy.twilio.com/location-aware-whatsapp-apac-webinar) and the [Building with the Twilio API for WhatsApp](https://www.twilio.com/go/whatsapp-webinar-may2021-apac-1). It demonstrates how to build a WhatsApp bot that reacts to different inputs, including location. It can send messages that include text, images, files and locations.\n\nThis bot responds to a number of commands:\n\n- **contact**: sends a VCard with Phil's contact details\n- **picture**: sends a picture of Alex, the Twilio developer evangelism team mascot\n- If you send your **location**, it looks up restaurants from the Foursquare API and sends you an image, description and location of a nearby restaurant\n- If you send anything else it will respond with a default message\n\n* [Running this bot yourself](#running-this-bot-yourself)\n  * [Setup the Twilio Sandbox for WhatsApp](#setup-the-twilio-sandbox-for-whatsapp)\n  * [Running the bot locally](#running-the-bot-locally)\n  * [Deploying to Twilio Functions](#deploying-to-twilio-functions)\n* [Further resources](#further-resources)\n\n## Running this bot yourself\n\nTo run this bot yourself you will need:\n\n- A Twilio account ([sign up for a free Twilio account here](https://www.twilio.com/try-twilio))\n- [Node.js](https://nodejs.org/en/download/)\n- A WhatsApp account\n- [A Foursquare developer account](https://developer.foursquare.com/)\n\nThen, clone the repository:\n\n```bash\ngit clone https://github.com/philnash/whatsapp-bot-capabilities.git\ncd whatsapp-bot-capabilities\n```\n\nInstall the dependencies:\n\n```bash\nnpm install\n```\n\nCopy the `.env.example` file to `.env`:\n\n```bash\ncp .env.example .env\n```\n\nGet your Twilio Account Sid and Auth Token from your [Twilio console](https://www.twilio.com/console) and enter them in `.env`.\n\nCreate a Foursquare application and get your Foursquare API client ID and secret from the [Foursquare developers portal](https://developer.foursquare.com/) and enter them in `.env`.\n\n### Setup the Twilio Sandbox for WhatsApp\n\nGo to your Twilio account and [follow the prompts to set up the Twilio Sandbox for WhatsApp](https://www.twilio.com/console/sms/whatsapp/learn)\n\n### Running the bot locally\n\nYou can run the bot locally, which will use ngrok to tunnel through to your account. Start the application with:\n\n```bash\nnpm start -- --ngrok\n```\n\nThen take the URL for the `/whatsapp` function (which should look like `https://RANDOM_SUBDOMAIN.ngrok.io/whatsapp`) and paste it into the [Twilio WhatsApp Sandbox configuration](https://www.twilio.com/console/sms/whatsapp/sandbox).\n\nThen send your bot a message.\n\n### Deploying to Twilio Functions\n\nTo deploy the function, you can run:\n\n```bash\nnpm run deploy\n```\n\nWhen the script is finished you will see a URL that looks like `https://whatsapp-bot-webinar-XXXX-dev.twil.io/whatsapp`. Take that URL and paste it into the [Twilio WhatsApp Sandbox configuration](https://www.twilio.com/console/sms/whatsapp/sandbox).\n\nThen send your bot a message.\n\n## Further resources\n\n- [Twilio API for WhatsApp docs](https://www.twilio.com/docs/whatsapp/api)\n- [WhatsApp guide for getting opt-in from your users](https://developers.facebook.com/docs/whatsapp/guides/opt-in/)\n- [Build a WhatsApp chatbot with Ruby, Sinatra and Twilio](https://www.twilio.com/blog/whatsapp-chatbot-ruby-sinatra-twilio)\n- [Build a location-aware WhatsApp weather bot with Ruby, Sinatra and Twilio](https://www.twilio.com/blog/location-aware-whatsapp-bot-ruby-sinatra-twilio)\n- [Using Location Data in WhatsApp to find nearby healthy restaurants using Twilio and JavaScript](https://www.twilio.com/blog/glorious-food)\n- [Using WhatsApp with the Twilio Conversations API](https://www.twilio.com/docs/conversations/using-whatsapp-conversations)\n- [Using WhatsApp with Twilio Autopilot](https://www.twilio.com/docs/autopilot/channels/whatsapp)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilnash%2Fwhatsapp-bot-capabilities","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphilnash%2Fwhatsapp-bot-capabilities","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilnash%2Fwhatsapp-bot-capabilities/lists"}