我如何通过WhatsAppAPI将pdf文件发送到mvc中的whatsapp,在这里我分享我的whatsapp代码

时间:2019-07-02 06:55:46

标签: pdf whatsapp

我使用Whatsapp API发送短信,但如何发送PDF文件

当我以pdf格式下载水晶报表时,我以这种方式尝试了比我以API文本传递文件路径但未成功

private void button1_Click(对象发送者,EventArgs e)         {

        string apikey = "API key";
        string destination = "8989";
        string text = "My 890 message";
        string response = "";

        Uri uri = new Uri("http://panel.apiwha.com/send_message.php?apikey=" + System.Web.HttpUtility.UrlEncode(apikey) + "&number=" + System.Web.HttpUtility.UrlEncode(destination) + "&text=" + System.Web.HttpUtility.UrlEncode(text));


        HttpWebRequest requestFile = (HttpWebRequest)WebRequest.Create(uri);

        requestFile.ContentType = "application/json";

        HttpWebResponse webResp = requestFile.GetResponse() as HttpWebResponse;

        if (requestFile.HaveResponse)
        {
            if (webResp.StatusCode == HttpStatusCode.OK || webResp.StatusCode == HttpStatusCode.Accepted)
            {
                StreamReader respReader = new StreamReader(webResp.GetResponseStream(), Encoding.GetEncoding("utf-8"));

                response = respReader.ReadToEnd(); // This is the APIWHA response       

                //var result = response.write(response, "Notice",
                //             MessageBoxButtons.OK,
                //             MessageBoxIcon.Information);
            }
        }
    }

请根据我的代码提供帮助并提供解决方案

0 个答案:

没有答案