如何使用C#或VB.NET发送whatsapp消息 [英] How do I send whatsapp message using C# or VB.NET

查看:123
本文介绍了如何使用C#或VB.NET发送whatsapp消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



有没有办法从C#.Net或VB.Net发送whatsapp消息。我发现谷歌上有很多链接,比如

Hi All,

Is there any way to send whatsapp message from C#.Net or VB.Net. I found many link on google like

https://www.youtube.com/watch?v=4i4G7GBSgnI
http://www.c-sharpcorner.com/UploadFile/c4d11a/sending-whatsapp-message-using-C-Sharp-code/
https://www.codeproject.com/Questions/1195533/How-do-I-send-whatsapp-message-from-Csharp





但上述过程均无效。



非常感谢任何帮助

谢谢。



我的尝试:



我从nuget包安装了



but none of the above process are working.

Any help will be great appreciated
Thank you.

What I have tried:

I have Installed

whatsapp 

dll。

并使用下面的代码。 />

dll from nuget package.
and used the code bellow.

public JsonResult SendMessage(string sendTo,string message)
    {
        var response = false;
        string from = "91XXXXXXXXXX"; //(Enter Your Mobile Number)
        String password;
        var res = WhatsAppApi.Register.WhatsRegisterV2.RequestCode(from, out password);
        WhatsApp wa = new WhatsApp(from, password, "abc.com", false, false);
        wa.OnConnectSuccess += () =>
        {
            wa.OnLoginSuccess += (phonenumber, data) =>
            {
                wa.SendMessage(sendTo, message);
                response = true;
            };
            wa.OnLoginFailed += (data) =>
            {
                response = false;
            };
 
            wa.Login();
        };
        wa.OnConnectFailed += (Exception) =>
        {
            response = false;
        };
        return Json(response);
    }





但是我无法生成密码。



but I am unable to generate the password.

推荐答案

也许这个:如何用C#发送WhatsApp消息 [ ^ ]

但你的问题可能就是这样:

Maybe this one: How to send WhatsApp Messages in C#[^]
But your problem is probably this:
Quote:

在收件人收到你之前WhatsApp消息,她将需要注册WhatsMate WA网关

Before the recipient can receive your WhatsApp message, she will need to register with the WhatsMate WA Gateway

这篇关于如何使用C#或VB.NET发送whatsapp消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆