【问题标题】:Azure Communication Services Simple SMSAzure 通信服务简单短信
【发布时间】:2022-03-18 21:41:04
【问题描述】:

ACS 新手,我只想发送 SMS 消息。官方的 MS 示例不起作用。我收到 401 未经授权的错误。我尝试像示例一样使用连接字符串构建客户端,并且尝试使用 DefaultAzureCredential。朝那个方向前进会导致未知错误。有没有人有任何建议如何让 ACS SMS SendAsync 呼叫正常工作或让我知道我做错了什么?

【问题讨论】:

标签: azure sms azure-communication-services


【解决方案1】:

确保将<from-phone-number> 设置为您之前使用电话号码功能sms:PhoneNumberCapabilityType.Outbound 注册的电话号码。

var capabilities = new PhoneNumberCapabilities(sms:PhoneNumberCapabilityType.Outbound);

// ... register the phone number and use it in the following code:

SmsSendResult sendResult = smsClient.Send(
    from: "<from-phone-number>",
    to: "<to-phone-number>",
    message: "Hello World via SMS"
);

【讨论】:

    猜你喜欢
    • 2012-06-08
    • 1970-01-01
    • 2020-05-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-30
    • 2018-02-02
    • 2021-01-31
    相关资源
    最近更新 更多