locked
Send messages to WhatsApp RRS feed

  • Question

  • User-1821287852 posted

    Hi all,

    I am developing an MVC ASP.Net application that needs to send messages to WhatsApp (WA).

    I have tried to use the WhatsAppAPI for .NET but I have this issue: I can't connect to WA. The connection method parameters include my nr and WA password, but WA does not have a password set, since I setup WA with my Facebook account.

    Is there any way of testing this API or knowing what value I must pass in order to be able to connect to WA within my controller?

    Code here:

            public static void SendWhatsAppMessage(
                string sMessage, 
                string sTo)
            {
                string sResponse = "";
                WhatsApp oWA = new WhatsApp("3519XXXXXX", "XXXXXXXX", "Test", true, false);
    
    
                if (oWA.ConnectionStatus == ApiBase.CONNECTION_STATUS.CONNECTED)
                {
                    oWA.SendMessage(sTo, sMessage);
                }
    
                //oWA.OnConnectSuccess += () =>
                //{
                //    sResponse = "Connect";
                //    oWA.OnLoginSuccess += (phno, data) =>
                //    {
                //        oWA.SendMessage(sTo, sMessage);
                //        sResponse = "Success";
                //    };
    
                //    oWA.OnLoginFailed += (data) =>
                //    {
                //        sResponse = "login failed" + data;
                //    };
                //    oWA.Login();
                //};
                //oWA.OnConnectFailed += (ex) =>
                //{
                //    sResponse = "connection failed";
                // };
            }



    Thanks,
    Bruno

    Friday, February 3, 2017 11:49 AM

Answers

  • User1027747708 posted

    Hi,

    I am currently looking for a way to send WhatsApp messages from a webservice and found this tool.

    WART @ C#-Corner

    It looks like you are getting a password when the registration of your number is completed.

    You could give it a try :)

    Kind regards,

    Jan

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, March 5, 2017 4:41 PM