[英]Sending images to a whatsapp number with Twilio
使用https://github.com/twilio/twilio-go我正在嘗試將多張圖片(4 張圖片)發送到用戶的電話號碼。
我怎樣才能做到這一點? 我瀏覽了文檔並嘗試使用 Twilio 提供的文檔創建解決方案,但無法正確執行。
誰能幫忙。
謝謝
嘗試使用 mediaURL
// Download the helper library from https://www.twilio.com/docs/go/install
package main
import (
"fmt"
"github.com/twilio/twilio-go"
api "github.com/twilio/twilio-go/rest/api/v2010"
)
func main() {
// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
client := twilio.NewRestClient()
params := &api.CreateMessageParams{}
params.SetBody("This is the ship that made the Kessel Run in fourteen parsecs?")
params.SetFrom("+15017122661")
params.SetMediaUrl([]string{"https://c1.staticflickr.com/3/2899/14341091933_1e92e62d12_b.jpg"})
params.SetTo("+15558675310")
resp, err := client.Api.CreateMessage(params)
if err != nil {
fmt.Println(err.Error())
} else {
if resp.Sid != nil {
fmt.Println(*resp.Sid)
} else {
fmt.Println(resp.Sid)
}
}
}
您可以在文檔中找到更多語言。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.