Introduction | laravel-mailcoach-sdk-go | Spatie       

 SPATIE  

laravel-mailcoach-sdk-go
========================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-mailcoach-sdk-go](https://spatie.be/docs/laravel-mailcoach-sdk-go/v1)  Introduction

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/laravel-mailcoach-sdk-go/v1) 

  Introduction    
- [ Introduction ](https://spatie.be/docs/laravel-mailcoach-sdk-go/v1/introduction)
- [ Installation and setup ](https://spatie.be/docs/laravel-mailcoach-sdk-go/v1/installation-and-setup)
- [ Usage ](https://spatie.be/docs/laravel-mailcoach-sdk-go/v1/usage)
- [ Testing ](https://spatie.be/docs/laravel-mailcoach-sdk-go/v1/testing)
- [ Changelog ](https://spatie.be/docs/laravel-mailcoach-sdk-go/v1/changelog)
- [ Support us ](https://spatie.be/docs/laravel-mailcoach-sdk-go/v1/support-us)

  Laravel-mailcoach-sdk-go 
==========================

 Work with the Mailcoach API from Go and Laravel Go 

### Useful links

- [Repository](https://github.com/spatie/laravel-mailcoach-sdk-go)
- [Discussions](https://github.com/spatie/laravel-mailcoach-sdk-go/discussions)

Introduction
------------

This package contains the Go SDK to work with [Mailcoach](https://mailcoach.app). Both self-hosted Mailcoach (v6 and up) and Mailcoach Cloud are supported. Using this package you can manage email lists, subscribers and campaigns.

Here are a few examples:

```
func sendTest(ctx context.Context, client *mailcoach.Client) error {
    campaign, err := client.CreateCampaign(ctx, mailcoach.Attributes{
        "email_list_uuid": "list-uuid",
        "name": "My new campaign",
        "fields": map[string]any{
            "title": "The title on top of the newsletter",
            "content": "# Welcome to my newsletter",
        },
    })
    if err != nil {
        return err
    }
    return client.SendTest(ctx, campaign.UUID, "john@example.com")
}
```

Creating a campaign does not send it to the list. Call `client.Send(ctx, campaign.UUID)` when you are ready to send it.

The package makes it easy to work with paginated resources. Call `page.Next(ctx)` to get the next page. See [handling pagination](usage#handling-pagination) for an example that lists all subscribers.

Start with [installation and setup](installation-and-setup), then read [usage](usage).

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
