@agentisend/sdk-node
Typed Node client for the AgentiSend API. Node 20 or newer,
ESM, no runtime dependencies.
npm install @agentisend/sdk-node
Send
import { AgentiSend } from '@agentisend/sdk-node';
const agentisend = new AgentiSend(process.env.AGENTISEND_API_KEY);
const { id } = await agentisend.emails.send({
from: 'you@yourdomain.com',
to: 'someone@example.com',
subject: 'Hello from AgentiSend',
text: 'Ten minutes, start to sent.',
});
console.log(id);
That block is run by the test suite against a local AgentiSend server, so a
snippet that stops working fails the tests rather than your first send.
Every mutating call takes an idempotency key. Pass one whenever a retry is
possible: agentisend.emails.send(payload, { idempotencyKey: idempotencyKey('welcome-email', 'user_123') }).
The same key with the same body replays the first response instead of sending twice.
Errors throw AgentiSendError, which carries code, message, fix and
docsUrl. fix names what to do and which endpoint to call; on a 429 the
error also carries retryAfterSeconds.
Coming from Resend
@agentisend/sdk-node/compat-resend exports a Resend class covering the
email, domain, key, contact, segment, topic, broadcast, template,
suppression, automation and webhook methods, with the same { data, error }
return shape, so most of a migration is the import line:
import { Resend } from '@agentisend/sdk-node/compat-resend';
const resend = new Resend(process.env.AGENTISEND_API_KEY);
const { data, error } = await resend.emails.send({ from, to, subject, html });
Where AgentiSend is stricter than Resend, the shim warns on stderr instead of
changing what it does. A member with no AgentiSend counterpart answers
{ data: null, error: { name: 'not_supported', ... } } rather than being
undefined — coverage is enforced in CI against a real resend package
instance. See Migrating from Resend
for what differs.
CLI
The package installs an agentisend binary.
npx @agentisend/sdk-node emails send --to someone@example.com \
--from you@yourdomain.com --subject Hi --text "Sent from the CLI"
emails send / get / list / cancel | The send path from a shell. |
emails explain <id> | Everything that happened to one message, in order. |
domains list / verify | Sending domains and a re-check of their DNS. |
webhooks listen --forward-to <url> | Verify deliveries locally and forward the raw bytes to your app. |
receiving listen | Not open yet. The command exists; receiving mail at your own domain does not. |
limits kill / resume | Stop a key sending, and undo it. |
trust standing | This account's standing and the reasons behind it. |
doctor | Check the key, the domains and the DNS in one pass. |
profile list / use / set | Named key and base-URL profiles. |
completions <shell> | bash, zsh or fish. |
AGENTISEND_API_KEY is read from the environment. Piped or redirected output is
JSON; a terminal gets the table.
Verifying webhooks
@agentisend/sdk-node/webhook-signing is the same implementation that signs the
delivery, so a signature that verifies here verified on the wire.
import { verifyWebhookSignature, SIGNATURE_HEADER } from '@agentisend/sdk-node/webhook-signing';
const ok = verifyWebhookSignature(secret, req.headers[SIGNATURE_HEADER], rawBody);
Pass the raw request body, byte for byte. Re-serialising parsed JSON changes the
bytes and therefore the HMAC.
Docs
agentisend.com/docs. Problems: hello@agentisend.com.