Repository navigation
Releases
Elastic Email Java SDK 4.4.0
📦 JitPack: https://jitpack.io/#ElasticEmail/elasticemail-java/4.4.0
implementation 'com.github.ElasticEmail:elasticemail-java:4.4.0'What's in this release
Optional Idempotency-Key header on the three send endpoints, so a send can be retried after a timeout or a dropped connection without the email going out (or being charged) twice. Without the key, sends work exactly as before.
New overloads
EmailsApi.emailsTransactionalPost(EmailTransactionalMessageData, String idempotencyKey):POST /emails/transactionalEmailsApi.emailsPost(EmailMessageData, String idempotencyKey):POST /emailsEmailsApi.emailsMergefilePost(MergeEmailPayload, String idempotencyKey):POST /emails/mergefile- The same extra
idempotencyKeyparameter on the...WithHttpInfo,...Asyncand...Callvariants. Passnullto send no key.
The existing signatures without the key are unchanged, so code built against 4.3.0 keeps compiling and running without changes.
Retry a send safely
// One key per logical send; reuse it only to retry that same send.
String idempotencyKey = UUID.randomUUID().toString();
EmailSend result = emails.emailsTransactionalPost(message, idempotencyKey);
// After a timeout or network error: call it again with the same message and idempotencyKey.How the key behaves
- Same key and the same request (same endpoint, byte-identical body) within 24 hours: you get the stored response back (same status, same
TransactionIDandMessageID) withIdempotency-Replayed: true, and 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. Retry a little later. - Invalid key (it must be 1-255 printable ASCII characters):
400. Key couldn't be confirmed:503withRetry-After(seconds). Retry with the same key. - If the first request fails (4xx or 5xx), the key is released, so a corrected retry with the same key runs normally.
- Keys are scoped to your account (subaccounts are separate) and kept for 24 hours from the first request.
Elastic Email Java SDK 4.3.0
Elastic Email Java SDK 4.3.0
📦 JitPack: https://jitpack.io/#ElasticEmail/elasticemail-java/4.3.0
implementation 'com.github.ElasticEmail:elasticemail-java:4.3.0'What'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(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: newenableSigning,deliveryMethod.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
WebhookDeliveryMethodenum:GET,POST_JSON
Create a signed webhook
WebhookCreatePayload payload = new WebhookCreatePayload()
.name("my-webhook")
.URL("https://your-app.example.com/webhook")
.notificationForSent(true)
.enableSigning(true)
.deliveryMethod(WebhookDeliveryMethod.POST_JSON);
Webhook created = new WebhookApi(client).webhookPost(payload);
// Returned only now - store it in your secret manager.
System.out.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.
4.2.0
Elastic Email Java SDK 4.2.0
This release adds the Webhooks API and aligns the Java SDK's version number with the other Elastic Email SDKs (4.2.0 everywhere).
📦 JitPack
Maven (add the https://jitpack.io repository first):
<dependency>
<groupId>com.github.ElasticEmail</groupId>
<artifactId>elasticemail-java</artifactId>
<version>4.2.0</version>
</dependency>Gradle (with maven { url 'https://jitpack.io' } in repositories):
implementation 'com.github.ElasticEmail:elasticemail-java:4.2.0'What's in this release
- Webhooks (
WebhookApi): new. Create, list, load, update and delete webhooks withwebhookPost,webhookGet,webhookByPublicidGet,webhookByPublicidPutandwebhookByPublicidDelete. New models:Webhook,WebhookCreatePayload,WebhookUpdatePayload. - Automations (
CampaignsApi): newcampaignsAutomationByNameTriggerPost(name, contactEmail)triggers an automation for a contact. - Sub-accounts (
SubAccountsApi): newsubaccountsByEmailApikeyGet(email)loads a sub-account's API key. The default API key created for a sub-account expires after 48 hours. - Domains:
DomainDataandDomainDetailgainCertificateExpiryDate,WasEverVerifiedand aDKIMRecord(newDKIMRecordmodel). - Campaigns:
CampaignOptionsgainsSendAtLocalTime. - Enums:
EventTypeaddsERROR,TRANSACTIONAL_UNSUBSCRIBEandSUPPRESS.CertificateValidationStatusaddsIN_PROGRESS.
No classes, methods or enum values were removed. Upgrading from 4.1.1 needs no code changes.
Compatibility
- Java 8+ (OkHttp 4.12.0, Gson 2.10.1)
- Elastic Email REST API v4
Full changelog: 4.1.1...4.2.0
4.1.1
update access levels, generated using OpenApiGenerator 7.11
Full Changelog: 4.1.0...4.1.1
dependencies:
gson-2.10.1
gson-fire-1.9.0
kotlin-stdlib-1.8.21
kotlin-stdlib-common-1.9.10
okhttp-4.12.0
okio-3.6.0
okio-jvm-3.6.0