Skip to content

Instantly share code, notes, and snippets.

@souvikhaldar
Created October 25, 2018 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save souvikhaldar/0a1f3c88ce647fedf649738811679850 to your computer and use it in GitHub Desktop.
Save souvikhaldar/0a1f3c88ce647fedf649738811679850 to your computer and use it in GitHub Desktop.
sending sms to a phone number using gobudgetsms golang library
import (
"github.com/souvikhaldar/gobudgetsms"
"fmt"
)
var smsConfig gobudgetsms.Details
func init() {
smsConfig = gobudgetsms.SetConfig(BsmsUsername, BsmsUserId, BsmsHandle, "", 1, 0, 0)
}
// sendmessage will send sms using gobudgetsms
func sendmessage(toNumber string, otpMessage string) error{
message := "Your OTP for xyz is " + otpMessage
res, err := gobudgetsms.SendSMS(smsConfig, message, toNumber, "xyz")
if err != nil {
return err
}
fmt.Println("The response after sending sms is ", res)
return nil
}
if e := sendmessage(phoneNumber, otp); e!= nil{
c.JSON(500,e.Error())
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment