Documentation
¶
Overview ¶
Package iris sends transactional email through Iris (https://iris.orvlabs.com) and verifies its webhooks.
Index ¶
Examples ¶
Constants ¶
const DefaultBaseURL = "https://iris.orvlabs.com"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
Attachment content is base64; Iris accepts 10 MB decoded at most in total.
type Client ¶
Client calls the Iris API with one key. Use it from your server only: the key must stay secret.
func (*Client) SendEmail ¶
SendEmail queues an email. It has no idempotency key: retrying after a network timeout can send it twice.
Example ¶
package main
import (
"context"
"fmt"
iris "github.com/orvlabs/iris-go"
)
func main() {
client := iris.New("iris_test_xxxxxxxx")
_, err := client.SendEmail(context.Background(), iris.Email{
Sender: iris.Address{Email: "factures@boutique.sn"},
To: []iris.Address{{Email: "awa@example.sn"}},
Subject: "Votre facture",
HTMLContent: "<p>Votre facture est prête.</p>{{bloc_paiement}}",
Payment: &iris.Payment{
AmountXOF: 15000,
Reference: "FAC-2026-0042",
Description: "Facture FAC-2026-0042",
Methods: []string{"wave", "orange_money"},
},
})
fmt.Println(err != nil)
}
Output:
type Email ¶
type Email struct {
Sender Address `json:"sender"`
To []Address `json:"to,omitempty"`
Cc []Address `json:"cc,omitempty"`
Bcc []Address `json:"bcc,omitempty"`
ReplyTo *Address `json:"replyTo,omitempty"`
Subject string `json:"subject,omitempty"`
HTMLContent string `json:"htmlContent,omitempty"`
TextContent string `json:"textContent,omitempty"`
TemplateID int64 `json:"templateId,omitempty"`
Params map[string]any `json:"params,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Attachment []Attachment `json:"attachment,omitempty"`
ScheduledAt *time.Time `json:"scheduledAt,omitempty"`
BatchID string `json:"batchId,omitempty"`
Payment *Payment `json:"payment,omitempty"`
Unsubscribe bool `json:"unsubscribe,omitempty"`
}
type Error ¶
type Error struct {
Status int `json:"-"`
Code string `json:"code"`
Message string `json:"message"`
}
Error is an answer other than 2xx. Branch on Status and Code; Message is French text that may change.
type Event ¶
type Event struct {
ID string `json:"id"`
Type string `json:"type"`
CreatedAt time.Time `json:"createdAt"`
Data struct {
MessageID string `json:"messageId"`
Email string `json:"email"`
URL string `json:"url"`
} `json:"data"`
}
Event is an email event webhook. Deduplicate on ID: retries carry the same one.
type Payment ¶
type Payment struct {
AmountXOF int64 `json:"amountXof"`
Reference string `json:"reference"`
Description string `json:"description"`
ExpiresIn int `json:"expiresIn,omitempty"`
Methods []string `json:"methods,omitempty"`
}
Payment adds a 221 Pay link (Wave, Orange Money) of your linked merchant account. Amounts are whole CFA francs.