Documentation Index
Fetch the complete documentation index at: https://docs.usesend.com/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Using SDK
Initialize SDK
Get the API key from the useSend dashboard and initialize the SDKimport { UseSend } from "usesend-js";
const usesend = new UseSend("us_12345");
If you are running a self-hosted version of useSend, pass the base URL as the
second argument:const usesend = new UseSend("us_12345", "https://app.usesend.com");
Send Email
usesend.emails.send({
to: "[email protected]",
from: "[email protected]",
subject: "useSend email",
html: "<p>useSend is the best open source product to send emails</p>",
text: "useSend is the best open source product to send emails",
headers: {
"X-Campaign": "welcome",
},
});
Custom headers are forwarded as-is. useSend only manages the X-Usesend-Email-ID and References headers.
Add contacts
usesend.contacts
.create("clzeydgeygff", {
email: "[email protected]",
firstName: "Koushik",
lastName: "KM",
})
Update contact
usesend.contacts.update("clzeydgeygff", contactId, {
firstName: "Koushik",
lastName: "KM",
});