This project provides a Go client for interacting with the Klaviyo API. It's a partial implementation, tailored to specific features that were required. It's designed to be simple, efficient, and idiomatic.
- Profile Management: Fetch, create, update, and delete profiles.
- Built-in retry mechanisms for better reliability.
- Structured error handling.
- Easily extendable for additional endpoints.
go get -u github.com/monetha/go-klaviyo
First, create a client:
import "github.com/monetha/go-klaviyo"
client := klaviyo.New(API_KEY, logger)
profiles, err := client.GetProfiles(ctx)
newProfile := &profile.NewProfile{
// populate your profile data
}
createdProfile, err := client.CreateProfile(ctx, newProfile)
fetchedProfile, err := client.GetProfile(ctx, PROFILE_ID)
updates := []updater.Profile{
// your updaters
}
updatedProfile, err := client.UpdateProfile(ctx, PROFILE_ID, updates...)
All errors returned by the client are structured. You can inspect the error to get more details:
if errors.Is(err, klaviyo.ErrProfileAlreadyExists) {
// Handle specific error
}
Contributions are welcome! Please feel free to submit a pull request, report an issue, or suggest additional features.
This project is licensed under the MIT License - see the LICENSE file for details.