Repository navigation
Releases
Elastic Email Go SDK 4.4.0
📦 Go module: https://pkg.go.dev/github.com/elasticemail/elasticemail-go/v4@v4.4.0
go get github.com/elasticemail/elasticemail-go/v4@v4.4.0What's in this release
Optional Idempotency-Key on email sends, so a send can be retried after a timeout or network error without going out (or being charged) twice. Without a key, sends behave exactly as before.
Updated endpoints
EmailsAPI.EmailsTransactionalPost,EmailsAPI.EmailsPostandEmailsAPI.EmailsMergefilePost: new optional builder methodIdempotencyKey(key string), sent as theIdempotency-Keyheader (1-255 printable ASCII characters)- The same three endpoints now document
400,409,422and503responses
Existing code compiles and behaves the same: the key is a new optional builder method, nothing else changed.
Retry a send safely
key := uuid.NewString() // github.com/google/uuid: one new key per logical send
result, httpRes, err := client.EmailsAPI.EmailsTransactionalPost(ctx).
EmailTransactionalMessageData(*message).
IdempotencyKey(key).
Execute()
if err != nil {
// Timeout or 5xx: retry with the same key and the same message.
}
if httpRes != nil && httpRes.Header.Get("Idempotency-Replayed") == "true" {
fmt.Println("Already sent earlier:", result.GetTransactionID())
}How the key behaves
- Same key and the same request (same endpoint, byte-identical body) within 24 hours: you get the stored response of the first request (same status,
TransactionIDandMessageID) withIdempotency-Replayed: true. Nothing is sent or charged again. - Same key with a different body or endpoint:
422. - Same key while the first request is still running:
409. - Invalid key:
400. Key couldn't be confirmed:503withRetry-After(seconds); retry with the same key. - If the first request fails (4xx/5xx), the key is released, so a corrected retry with the same key runs.
- Keys are scoped per account (subaccounts are separate) and kept for 24 hours from the first request.
Generate a new key (e.g. a UUID v4) for each logical send and reuse it only to retry that send, with the message built the same way.
Elastic Email Go SDK 4.3.0
Elastic Email Go SDK 4.3.0
📦 Go module: https://pkg.go.dev/github.com/elasticemail/elasticemail-go/v4@v4.3.0
go get github.com/elasticemail/elasticemail-go/v4@v4.3.0What's in this release
Opt-in HMAC-SHA256 webhook signing and POST + JSON webhook delivery. Both are chosen when a webhook is created and can't be changed later. Webhooks created without them keep working exactly as before (unsigned GET).
New endpoint
WebhookAPI.WebhookByPublicidSecretRotatePost(ctx, publicid):POST /webhook/{publicid}/secret/rotatereplaces the signing secret of a signed webhook and returns the new one, only in that response
New and updated models
WebhookCreatePayload: newSetEnableSigning,SetDeliveryMethod.EnableSigning: truesigns every request;DeliveryMethod: PostJsonsends events as aPOSTwith a JSON body instead of aGETwith a query stringWebhook: newGetSigningEnabled,GetDeliveryMethod,GetSigningSecret.SigningSecretis returned only when a webhook is created with signing, or when its secret is rotated: store it safely- New
WebhookDeliveryMethodwithWEBHOOKDELIVERYMETHOD_GETandWEBHOOKDELIVERYMETHOD_POST_JSON
Create a signed webhook
payload := ElasticEmail.NewWebhookCreatePayload("my-webhook", "https://your-app.example.com/webhook")
payload.SetNotificationForSent(true)
payload.SetEnableSigning(true)
payload.SetDeliveryMethod(ElasticEmail.WEBHOOKDELIVERYMETHOD_POST_JSON)
created, _, err := client.WebhookAPI.WebhookPost(ctx).WebhookCreatePayload(*payload).Execute()
// Returned only now - store it in your secret manager.
fmt.Println(created.GetSigningSecret())Verifying requests
Signed requests carry X-ElasticEmail-Timestamp, X-ElasticEmail-Signature: v1=<hex> and X-ElasticEmail-Webhook-Id. The signature is hex(HMAC-SHA256(secret, "{timestamp}\n{METHOD}\n{path and query}\n{raw body}")).
- Read the raw body before parsing it as JSON. A
GEThas no body. - Reject the request if the timestamp is more than 5 minutes away from your clock.
- Compute the expected signature, using the request target exactly as received (still URL-encoded), and compare it with every
v1=entry ofX-ElasticEmail-Signaturein constant time. - If nothing matches, return
401. The notification is retried for up to 24 hours, signed with the current secret.
Signed and POST webhooks don't follow redirects, so point the webhook at the final URL.
Elastic Email Go SDK 4.2.0
Elastic Email Go SDK 4.2.0
This is the first GitHub Release of the Go SDK. It brings the version in line with the other Elastic Email client libraries and is the first version published as a proper Go module under /v4.
go get github.com/elasticemail/elasticemail-go/v4@v4.2.0What's in this release
- Webhooks (
WebhookAPI): full CRUD for webhooks:WebhookGet,WebhookPost,WebhookByPublicidGet,WebhookByPublicidPutandWebhookByPublicidDelete. New models:Webhook,WebhookCreatePayload,WebhookUpdatePayload. - Automations (
CampaignsAPI):CampaignsAutomationByNameTriggerPost(POST /campaigns/automation/{name}/trigger) triggers an automation for a contact. - Subaccounts (
SubAccountsAPI):SubaccountsByEmailApikeyGet(GET /subaccounts/{email}/apikey) returns a subaccount's API key. - Domains: new
DKIMRecordmodel.DomainDataandDomainDetailgainCertificateExpiryDate,WasEverVerifiedandDKIMRecord. - Campaigns:
CampaignOptionsgainsSendAtLocalTime. - Enums:
CertificateValidationStatusaddsInProgress.EventTypeaddsError,TransactionalUnsubscribeandSuppress. - Docs:
SecurityAPInow notes that a subaccount's default API key expires after 48 hours. - Package version set to 4.2.0 (previously 4.0.31). The default
User-Agentis nowOpenAPI-Generator/4.2.0/go.
Breaking changes
-
The module path now ends in
/v4. Earlier tags (4.0.x) had novprefix and a module path without a major-version suffix, so Go tooling never saw them as releases. Update your imports:// before import ElasticEmail "github.com/elasticemail/elasticemail-go" // after import ElasticEmail "github.com/elasticemail/elasticemail-go/v4"
Then run
go get github.com/elasticemail/elasticemail-go/v4@v4.2.0andgo mod tidy. The package name (ElasticEmail) and the API surface are otherwise unchanged.
Compatibility
- Go 1.18 or later, no third-party runtime dependencies
- Elastic Email REST API v4
Full changelog: 4.0.31...v4.2.0