Zenziva SMS Online Gateway Library based on Zenziva Documentation with golang.
If you are using go mod, then you skip this installation step.
Simple install the package to your $GOPATH with the go tool from shell:
$ go get -u github.com/faytranevozter/zenziva-go-sms
Make sure Git is installed on your machine and in your system's PATH
.
Reguler type
import zen "github.com/faytranevozter/zenziva-go-sms"
sms := zen.Zenziva{
Username: "userkey",
Password: "passkey",
}
Masking type
sms := zen.Zenziva{
Username: "userkey",
Password: "passkey",
Type: "masking",
}
SMS Center type
sms := zen.Zenziva{
Username: "userkey",
Password: "passkey",
Type: "sms_center",
Subdomain: "mysubdomain",
}
Avalilable type: reguler, masking, sms_center, whatsapp_reguler (coming soon), whatsapp_center (coming soon)
Chaining method
res, err := sms.To("089765432123").Message("Helaw!").OTP(true).Send()
if err != nil {
fmt.Println("Failed:", err)
}
Simple method
res, err := sms.SimpleSend("089765432123", "Helaw!")
if err != nil {
fmt.Println("Failed:", err)
}
Simple method + otp
res, err := sms.SimpleSendOTP("089765432123", "Helaw!", true)
if err != nil {
fmt.Println("Failed:", err)
}
res, err := sms.SimpleSend("089765432123", "Helaw!")
if err != nil {
fmt.Println("Failed:", err)
}
if res.Status {
// sent
} else {
// failed
}
// print(res)
// {
// "message_id": "41",
// "to": "081111111111",
// "status": true,
// "message": "Success"
// }
Fahrur Rifai fahrur.dev
Twitter @faytranevozter
MIT License