Skip to content

Releases

Elastic Email Java SDK 4.4.0

Choose a tag to compare

@eeppodolak eeppodolak released this 13 Oct 11:50

📦 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/transactional
  • EmailsApi.emailsPost(EmailMessageData, String idempotencyKey): POST /emails
  • EmailsApi.emailsMergefilePost(MergeEmailPayload, String idempotencyKey): POST /emails/mergefile
  • The same extra idempotencyKey parameter on the ...WithHttpInfo, ...Async and ...Call variants. Pass null to 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 TransactionID and MessageID) with Idempotency-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: 503 with Retry-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

Choose a tag to compare

@eeppodolak eeppodolak released this 13 Oct 07:23

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/rotate replaces the signing secret of a signed webhook and returns the new one, only in that response

New and updated models

  • WebhookCreatePayload: new enableSigning, deliveryMethod. EnableSigning: true signs every request; DeliveryMethod: PostJson sends events as a POST with a JSON body instead of a GET with a query string
  • Webhook: new getSigningEnabled(), getDeliveryMethod(), getSigningSecret(). SigningSecret is returned only when a webhook is created with signing, or when its secret is rotated: store it safely
  • New WebhookDeliveryMethod enum: 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}")).

  1. Read the raw body before parsing it as JSON. A GET has no body.
  2. Reject the request if the timestamp is more than 5 minutes away from your clock.
  3. Compute the expected signature, using the request target exactly as received (still URL-encoded), and compare it with every v1= entry of X-ElasticEmail-Signature in constant time.
  4. 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

Choose a tag to compare

@eeppodolak eeppodolak released this 28 Sep 09:40

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 with webhookPost, webhookGet, webhookByPublicidGet, webhookByPublicidPut and webhookByPublicidDelete. New models: Webhook, WebhookCreatePayload, WebhookUpdatePayload.
  • Automations (CampaignsApi): new campaignsAutomationByNameTriggerPost(name, contactEmail) triggers an automation for a contact.
  • Sub-accounts (SubAccountsApi): new subaccountsByEmailApikeyGet(email) loads a sub-account's API key. The default API key created for a sub-account expires after 48 hours.
  • Domains: DomainData and DomainDetail gain CertificateExpiryDate, WasEverVerified and a DKIMRecord (new DKIMRecord model).
  • Campaigns: CampaignOptions gains SendAtLocalTime.
  • Enums: EventType adds ERROR, TRANSACTIONAL_UNSUBSCRIBE and SUPPRESS. CertificateValidationStatus adds IN_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

Choose a tag to compare

@radzawee radzawee released this 11 Mar 21:45

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

4.1.0

Choose a tag to compare

@radzawee radzawee released this 08 Jul 09:37
update to the latest API
Sponsor
SponsoredKunjungi sekarang
Promo