go-sinch
is an API client for the Sinch APIs written in Go(Lang).
Download the package
go get github.com/thezmc/go-sinch
Send a message using the SMS client
package main
import (
"fmt"
"github.com/thezmc/go-sinch/pkg/api"
"github.com/thezmc/go-sinch/pkg/sms"
)
func main() {
apiClient := new(api.Client).WithAuthToken("YOUR_AUTH_TOKEN")
smsClient := new(sms.Client).WithPlanID("YOUR_PLAN_ID").WithSinchAPI(apiClient)
request := new(sms.BatchSendRequest).
To("RECIPIENT_PHONE_NUMBER").
From("SENDER_PHONE_NUMBER").
WithMessageBody("YOUR_MESSAGE_BODY")
response := new(sms.BatchSendResponse)
if err := smsClient.Do(request, response); err != nil {
panic(err)
}
fmt.Printf("Send Response: %+v", response)
}