使用ASP.NET Core通过Twilio向WhatsApp组发送消息 [英] Sending a message to whatsapp groups through twilio with asp.net core

查看:173
本文介绍了使用ASP.NET Core通过Twilio向WhatsApp组发送消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过twilio将whatsapp商业api用于我的应用程序.我已经阅读了whatsapp商业api的文档.我的问题是,我们是否可以使用twilio将消息基于id发送到不同的whatsapp组. 例如,如果我有3个组,例如学生,教授,助理,并且基于每个不同的组,我想发送特定的消息,例如向学生打招呼",向教授打招呼和向助理打招呼. 到目前为止,我所知道的是Whatsapp可以区分具有特定ID的所有内容,例如chat.whatsapp.com/DeUzzel9O13231

我还使用了twilio和whatsapp api,您可以在其中将消息从twilio编号发送到您的whatsapp编号,如下所示

using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;


class Program 
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Token at twilio.com/console
        // DANGER! This is insecure. See http://twil.io/secure
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        var message = MessageResource.Create(
            body: "Join Earth's mightiest heroes. Like Kevin Bacon.",
            from: new Twilio.Types.PhoneNumber("+15017122661"),
            to: new Twilio.Types.PhoneNumber("+15558675310")
        );

        Console.WriteLine(message.Sid);
    }
}

上面的代码仅用于将消息发送到特定号码.我可以对小组做同样的事情吗?如果是,如何?是否有任何相关文档?

谢谢.

解决方案

看起来还不是受支持的功能.

"我可以向WhatsApp组发送消息还是管理组?

当前,我们的API不支持与之通信或管理 WhatsApp组.我们希望将来会增加对群组的支持."

来源:

The code above is only for sending a message to a specific number. Can I do the same thing with the groups? If yes, How? Is there any documentation for that?

Thanks.

解决方案

Doesn't look like a supported feature just yet.

"Can I send messages to WhatsApp groups or manage groups?

Currently, our API does not support messaging with or managing WhatsApp groups. We expect to add support for groups in the future."

Source: https://www.twilio.com/docs/sms/whatsapp/best-practices-and-faqs#frequently-asked-questions-on-whatsapp-integrations

这篇关于使用ASP.NET Core通过Twilio向WhatsApp组发送消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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