6 comments.

  1. Fernando Silva

    is very simple! You can use the Launcher documentation.

    bool supportsUri = await Launcher.Default.CanOpenAsync($"whatsapp://send?phone=+{phoneNumber}"); if (supportsUri) await Launcher.Default.OpenAsync($"whatsapp://send?phone=+{phoneNumber}&text=Hello World!"); else await App.Current.MainPage.DisplayAlert("Alert", "Was not possible open the WhatsApp.", "OK");
  2. Konrad Talik

    The only official way of sending a WhatsApp message from one number to another requires WhatsApp Business API. Having that, your company (or your client's) will have an official WhatsApp account that can be used for messaging with consumers.

    WhatsApp Business API requires some developer effort, but there are also different WhatsApp API based solutions that make this whole process a lot easier.

    One of them is get.chat WhatsApp Business Team Inbox & WhatsApp Integration API which will help you to integrate with WhatsApp much faster. Plus, it will enable access to non-technical people in your team/company, too!

    Check this easy guide about WhatsApp Business API, including 2 minute video simple explanation.

    I am a co-founder and CTO so I am open to answer any questions if you want to know more about our solution. Here is also a link to the docs if you're interested in learning more by yourself.

    1. Mohamed Kamel

      Thank you but i want to send the message to normal WhatsApp not WhatsApp Business if it is possible , any way thank you

    2. Konrad Talik

      @MohamedKamel the only official way of sending a message to normal WhatsApp is from WhatsApp Business API

    3. Maahi

      Another official way is using WhatsApp Cloud API.

  3. Gabic

    I remembered that I was able to do this when using Xamarin, so I checked the decompiled file of the Xamarin.Forms.OpenWhatsApp.Chat class and adapted the code to work for MAUI:

    public static async void SendWhatsApp(string phoneNumber, string message = null) { try { string text = "whatsapp://send?phone=" + phoneNumber; if (!string.IsNullOrWhiteSpace(message)) { text = text + "&text=" + message; } await Browser.Default.OpenAsync(new Uri(text), BrowserLaunchMode.External); } catch (Exception ex) { throw new Exception(ex.Message); } }

    It worked on my phone (Samsung S10Plus with Android 10). Just remember that:

    The device MUST have WhatsApp installed, so it didn't work on Visual Studio emulator The phone number must be in the correct format, as described in WhatsApp's Help Center: a plus sign (+) followed by the country code, city code, and local phone number.

Add a new comment.