Constructor
new GroupClient(auth)
- Description:
Constructs a new GroupClient instance.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
auth |
Authentication object implementing IAuth or a raw token string. |
Classes
Methods
(async) containsEmailInGroup(groupId, email)
- Description:
Checks whether an email exists in a group.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
groupId |
The unique identifier of the group. |
|
email |
The email address to check. |
Returns:
Promise that resolves to true if the email exists in the group; false otherwise.
(async) deleteEmailFromGroup(groupId, email)
- Description:
Deletes an email from a group.
Important: Emails can only be removed if they were added at least 30 minutes ago.
- Source:
Example
const client = new GroupClient("your_api_key");
await client.deleteEmailFromGroup("groupId", "info@example.com");
Parameters:
Name | Type | Description |
---|---|---|
groupId |
The unique identifier of the group. |
|
email |
The email address to remove from the group. |
Returns:
Promise that resolves to true on success, otherwise rejects with an Error.
(async) insertEmailIntoGroup(groupId, email, failHandling)
- Description:
Inserts one or multiple email records into a group.
- Source:
Example
const client = new GroupClient("your_api_key");
// Single email as simple string
await client.insertEmailIntoGroup("groupId", { email: "info@example.com" });
// With display name and substitutions
await client.insertEmailIntoGroup("groupId", {
email: { email: "john@example.com", name: "John Doe" },
substitutions: { firstName: "John" }
});
// Multiple records
await client.insertEmailIntoGroup("groupId", [
{ email: "a@example.com" },
{ email: { email: "b@example.com", name: "User B" }, substitutions: { plan: "pro" } },
]);
Parameters:
Name | Type | Default | Description |
---|---|---|---|
groupId |
The unique identifier of the group. |
||
email |
A single EmailRecord or an array of EmailRecord objects. |
||
failHandling |
ABORT
|
Strategy on individual insert failure. One of the keys of FailureHandler (e.g. "ABORT"). |
Returns:
Promise that resolves to true on success, otherwise rejects with an Error.