Created
October 25, 2018 11:37
-
-
Save souvikhaldar/0a1f3c88ce647fedf649738811679850 to your computer and use it in GitHub Desktop.
sending sms to a phone number using gobudgetsms golang library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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