Skip to content

Latest commit

 

History

History
executable file
·
38 lines (30 loc) · 820 Bytes

README.md

File metadata and controls

executable file
·
38 lines (30 loc) · 820 Bytes

go-sinch

go-sinch is an API client for the Sinch APIs written in Go(Lang).

Quickstart

Download the package

go get github.com/thezmc/go-sinch

SMS

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)
}