This Blazor App demonstrates how to send and receive WhatsApp messages within an Blazor environment.
The goal is to provide a very easy quick-start application to send and receive WhatsApp messages via the Twilio API
We use the Twilio MessageResource API to send WhatsApp Messages. For receicing WhatsApp we use the sugessted Twilio WebHook approach
Find the complete article here: https://alexbierhaus.medium.com/twilio-api-whatsapp-net-blazor-example-f7d226da5367
The sample should also work with Twilio SMS, however, we did not test it yet.
- Follow the instructions on https://www.twilio.com/console/sms/whatsapp/sandbox to enable your sandbox
- Find your Account Sid and Token at twilio.com/console and set it in the appsettings.json
- Run the sample
- Open the send page and send yourself a WhatsApp
For receicing replies we need to configure the Twilio webhook. Note: It is necessary that your application is public available via the internet
- Deploy application to your webhoster
- Open https://www.twilio.com/console/sms/whatsapp/sandbox
- Set "WHEN A MESSAGE COMES IN" parameter with https://YOURDOMAINAPP.net/WhatsAppReceiver
The demo makes use of https://www.litedb.org/ to simple store the received WhatsApp. When you are using the code in your environmennt you might replace it with your database provider.