Go Quickstart
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
body, _ := json.Marshal(map[string]any{
"from": "hello@yourcompany.com",
"to": []string{"customer@example.com"},
"subject": "Welcome",
"html_body": "<h1>Welcome 👋</h1>",
"text_body": "Welcome.",
})
req, _ := http.NewRequest("POST",
"https://apis.splashifypro.com/api/v1/partner/email/send",
bytes.NewReader(body),
)
req.Header.Set("Authorization", "Bearer "+os.Getenv("SPLASHIFY_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
var out struct {
Success bool `json:"success"`
Results []struct {
MessageID string `json:"message_id"`
Status string `json:"status"`
} `json:"results"`
}
json.NewDecoder(res.Body).Decode(&out)
fmt.Println(out.Results[0].MessageID)
}