Skip to content

TwilioDevEd/whatsapp-media-tutorial-csharp-aspnet

Repository files navigation

Twilio

Receive, Download, and Reply with media in WhatsApp Messages. Powered by Twilio - C#/Asp.NET

Use Twilio to receive WhatsApp media messages. For a step-by-step tutorial see the Twilio docs.

Local development

To run the app locally:

  1. Clone this repository and open the solution in Visual Studio 2019.

    git clone git@github.com:TwilioDevEd/whatsapp-media-tutorial-csharp-aspnet.git
    cd whatsapp-media-tutorial-csharp-aspnet
  2. In the Package-Manager Console run:

    nuget restore
  3. Run the application with f5. Ignore the 404 error you will see on the browser since you only need the server.

  4. Expose your application to the wider internet using ngrok. This step is important because the application won't work as expected if you run it through localhost.

    ngrok http -host-header=localhost 8081

    Note: You can read this blog post for more details on how to use ngrok.

  5. Configure Twilio's Sandbox for WhatsApp to call your webhook URL

    You will need to configure your Twilio Sandbox for WhatsApp to call your application (exposed via ngrok) when your Sandbox number receives an incoming message. Your URL will look something like this:

    http://6b5f6b6d.ngrok.io/WhatsAppMedia/Create
    

    Here are detailed instructions for Twilio Sandbox for WhatsApp

How to Demo

  1. Send a message with a media attachment to your WhatsApp Sandbox phone number

  2. Your ASP.NET application should handle the incoming request from Twilio and download the images to the App_Data directory. In a few moments, you should get back a WhatsApp reply.

Meta

  • No warranty expressed or implied. Software is as is. Diggity.
  • MIT License
  • Lovingly crafted by Twilio Developer Education.

About

No description or website provided.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published