0

我正在尝试通过存储在谷歌驱动器中的 WhatsApp Business API 发送 pdf,但我收到一个错误“12300 - Invalid Content-Type”你能帮我我哪里出错了,我想知道如何发送来自我本地存储的 MediaUrl 中的 pdf。我尝试使用 Twilio Assets,但它也无法正常工作。这是我的代码:

 static void Main(string[] args)
{
    var accountSid = " ";
    var authToken = " ";
    TwilioClient.Init(accountSid, authToken);
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
    var mediaUrl = new[] {
        new Uri("google drive link")
    }.ToList();
    
    var messageOptions = new CreateMessageOptions(
        new PhoneNumber("whatsapp:+91XXXXXX"));
    messageOptions.From = new PhoneNumber("whatsapp:+XXXXXXXX");
    messageOptions.Body = "Hello how are you?";
    messageOptions.MediaUrl = mediaUrl;
    var message = MessageResource.Create(messageOptions);
    Console.WriteLine(message.Body);
    Console.ReadLine();

}
4

0 回答 0