Go SDK
Install and configure the Informly Go SDK
Installation
go get github.com/informlyco/informly-goInitialize the Client
package main
import (
"context"
informly "github.com/informlyco/informly-go"
)
func main() {
client := informly.NewClient(
informly.WithToken("YOUR_API_TOKEN"),
)
ctx := context.Background()
// Use client...
}Configuration
| Option | Type | Default | Description |
|---|---|---|---|
WithToken | string | — | Your API token (required) |
WithBaseURL | string | http://api.informly.co/api/v1 | API base URL |
WithHTTPClient | *http.Client | http.DefaultClient | Custom HTTP client |
Error Handling
contact, err := client.Contacts.GetContact(
ctx,
&informly.GetContactRequest{ID: "contact-id"},
)
if err != nil {
var apiErr *informly.APIError
if errors.As(err, &apiErr) {
fmt.Printf("Status: %d\n", apiErr.StatusCode)
fmt.Printf("Message: %s\n", apiErr.Message)
}
}For endpoint usage examples, see the API Reference — each endpoint includes a Go tab with SDK code.
Last updated on