Skip to content

SDKs

The SDKs

Official libraries for Node and Bun, Python, PHP and Go: the same calls as the Resend SDKs, no dependencies, retries and pagination included.

LanguagePackageVersionRequiresDependencies
Node and Bun@deveryidea/voaaro0.6.0Node 18 or later, Bunnone (native fetch); ESM and CommonJS, TypeScript types
Pythonvoaaro0.4.0Python 3.9 or laternone (standard library), typed
PHPdeveryidea/voaaro0.4.0PHP 8.1 or laternone required (ext-curl recommended, or a PSR-18 client)
Gogithub.com/deveryidea/voaaro-go0.4.0Go 1.21 or laternone (standard library)

All four are under the MIT license.

What they cover

The four SDKs cover the same API; only the names follow each language's usage (camelCase in Node and PHP, snake_case in Python, PascalCase in Go).

NodePythonPHPGo
emails: sending, batches, reading, listing, scheduling, canceling, sharing, statisticsyesyesyesyes
attachments of sent emails, received emailsyesyesyesyes
sending event logyesyesyesyes
API keys, domainsyesyesyesyes
suppression listyesyesyesyes
contacts, segments (dynamic included), audiences, topics, properties, broadcasts, importsyesyesyesyes
newsletters: settings, overview, forms, statistics, A/B testing, templates, automations, events, cleanupyesyesyesyes
webhooks managed through the API: endpoints, rotation, test, deliveries, replayyesyesyesyes
webhook verification, with several secretsyesyesyesyes
subscribing and unsubscribing from the server and the browser (PublicForm, proof of work), campaign schedulingyesyesyesyes
organizations (operator key mko_…)yesyesyesyes

Common configuration

All four read VOAARO_API_KEY and VOAARO_BASE_URL from the environment if you do not pass them. Always give your instance's address (https://mail.example.com, with or without /api/v1): there is no central API.

Retries and idempotency

The four SDKs retry on their own a request that failed for a transient reason, twice by default:

  • after a network error, a 429 rate_limit_exceeded (600 requests per minute) or a 500, 502, 503 or 504 response;
  • never after 429 daily_quota_exceeded (the quota does not come back for hours) nor after another 4xx error: fix the request;
  • wait: the Retry-After header if given (60 seconds at most), otherwise 0.5 s, 1 s, 2 s… with some jitter, 8 seconds at most.

Each creation (POST) accepts an idempotency key. Without one, the SDK draws one (a UUID) for each POST, the same from one attempt to the next: a retry after a dropped connection never creates two objects (idempotency). Turning retries off (maxRetries: 0, or its equivalent) also turns off this automatic key.

Number of retriesIdempotency key
Nodenew Voaaro(key, { maxRetries: 2 }){ idempotencyKey } as the last argument
PythonVoaaro(..., max_retries=2) or voaaro.max_retries{"idempotency_key": …} as the last argument
PHPVoaaro::client(..., maxRetries: 2)option ['idempotencyKey' => …]
Govoaaro.WithMaxRetries(2)IdempotencyKey field, or voaaro.WithIdempotencyKey(ctx, key)

Pagination

Each cursor list has an iterator that asks for pages of 100 (or the limit given) and follows after as long as has_more is true, one page at a time. The list's filters apply to each page; the walk goes from newest to oldest (pagination).

Iterator
Nodefor await (const c of voaaro.contacts.iterate(params)); iterateEvents, iterateRecipients, iterateSignups, iterateRuns; voaaro.paginate(…) for any list
Pythonfor c in voaaro.Contacts.list_all(params); events_all, recipients_all, signups_all, runs_all, list_contacts_all
PHPforeach ($voaaro->contacts->all($options) as $c); allEvents, allSignups, allRuns, allContacts; $voaaro->paginate('/path', $filters)
Goit := client.Contacts.ListAll(ctx, opts) then it.Next(), it.Current(), it.Err() (type Iter[T]); EventsAll, RecipientsAll, SignupsAll, RunsAll, ListContactsAll

Errors, in each language's style

  • Node: each call returns { data, error } and never throws for an API error; error is { name, message, statusCode } (statusCode is null for a network error), with retryAfter when the service gave Retry-After. Only the iterators throw, a VoaaroApiError.
  • Python: typed exceptions, all subclasses of voaaro.VoaaroError (ValidationError, RateLimitError…), with retry_after.
  • PHP: exceptions that subclass Voaaro\Exceptions\ErrorException, with getErrorName(), getStatusCode() and getRetryAfter().
  • Go: err is a *voaaro.Error (StatusCode, Name, Message, RetryAfter) to read with errors.As, or to compare with errors.Is (voaaro.ErrRateLimit, ErrNotFound…).

The error names are those of the API (Errors). The error returned is the last attempt's, once the retries are exhausted.

Esc