Skip to content

WhatsApp

Send WhatsApp notifications directly from your application using the Twilio API with the TwilioWhatsAppHook class.

You need to sign up for Twilio and get your AccountSid, AuthToken, and the phone number from which messages will be sent before you can start sending WhatsApp messages.

Guide

The class internally uses the HttpClient to make requests to the Twilio API. Before dispatching a message, it sets the authorization header using the provided AccountSid and AuthToken. The message is then sent to the specified recipient.

Example:

var whatsappHook = new TwilioWhatsAppHook(accountSid, authToken, 
    fromPhoneNumber, toPhoneNumber);

await whatsappHook.SendAsync("Your message here");