如何从C#发送whatsapp消息 [英] How do I send whatsapp message from C#

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

问题描述

我已经从nuGet包管理器安装了WhatsApp API并尝试实现代码,但无法通过WART(WhatsApp注册工具)注册我的手机号码。它提供错误LIKE {状态:失败,原因:Bad_Request}所有时间。我搜索了很多。但是这个问题没有任何解决办法。只有工具即WART进行注册。



有没有新的更新或WART仍然有效?



我尝试过什么:



I have installed WhatsApp API from nuGet package manager and tried to implement code but could not register my mobile number through WART(WhatsApp Registration Tool).Its giving error LIKE {Status:"Failed",Reason:"Bad_Request"} all the time. I have searched a lot.But there is no any solution to this issue. There is only tool i.e. WART for registration.

Is there any new updates OR WART is still working?

What I have tried:

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);
    }

推荐答案

以下是youtube中Whatsmate dot net视频的链接,它将逐步指导您。


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

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