Development of Go language for short message Service
SMS Go Language Development
Alibaba Cloud-Cloud Communication-SMS service is adopted. The original Alibaba brand has been upgraded to "Alibaba Cloud Communication."
use
User registration, password recovery, user authentication, Captcha login, etc.
instructions for use
Replace accessKeyId, accessKeySecret, phoneNumbers, signName, templateCode, templateParam with yours and you can use it directly.
package main
import (
"fmt"
"github.com/KenmyZhang/aliyun-communicate/app"
)
var (
gatewayUrl = "http://dysmsapi.aliyuncs.com/"
accessKeyId = "*******"
accessKeySecret = "*************"
phoneNumbers = "1354*********"
signName = "KenmyZhang"
templateCode = "SMS_82045083"
templateParam = "{\"code\":\"1234\"}"
)
func main() {
smsClient := app.NewSmsClient(gatewayUrl)
if result, err := smsClient.Execute(accessKeyId, accessKeySecret, phoneNumbers, signName, templateCode, templateParam); err != nil {
fmt.Println("error:%v", err.Error())
} else {
for key, value := range result {
fmt.Println("key:%v", key, " value:",value)
}
}
}
Code archived at: github.com/KenmyZhang/aliyun-communicate