DEV Community

Cover image for WhatsApp Custom Link Message
Alexandre Freire
Alexandre Freire

Posted on • Updated on

WhatsApp Custom Link Message

Make custom link messages to Whatsapp with nuget package.

var waComposer = new WaComposer();
waComposer.WriteText("Pedido",1,1);
//Observation: this 1,1 is break line. 1 before and 1 after

waComposer.WriteText("Item One");

//can format - available options: Italic, Bold, Strikethrough, Monospace.
waComposer.WriteText(WaFormat.Bold("Two")); 
waComposer.WriteText(WaFormat.Italic("Example Number: ") + "3");

var textResult = waComposer.GetText();

var whatsAppLink = WaSender.GetLink("PHONE_NUMBER_HERE",textResult);

//example output of whatsAppLink 
"https://wa.me/123/?text=THE_MESSAGE_FORMATED_BY_PACKAGE_HERE"
or on mobile 
"whatsapp://send?text=THE_MESSAGE_FORMATED_BY_PACKAGE_HERE&phone=123"

Enter fullscreen mode Exit fullscreen mode

being able to stay like this for example:

Image description

Available on https://www.nuget.org/packages/WhatsAppLink/
Github https://github.com/oalexandrefreire/WhatsAppLinkCSharp

Top comments (0)