📋 Lists module Inbound API
Manage account-level lists.
Add List Entry method
Add an entry to an account-level blocklist or safelist.
Usage
ts
import { MailChannelsClient, Lists } from 'mailchannels-sdk'
const mailchannels = new MailChannelsClient('your-api-key')
const lists = new Lists(mailchannels)
const { data, error } = await lists.addListEntry({
listName: 'safelist',
item: 'name@domain.com'
})ts
import { MailChannels } from 'mailchannels-sdk'
const mailchannels = new MailChannels('your-api-key')
const { data, error } = await mailchannels.lists.addListEntry({
listName: 'safelist',
item: 'name@domain.com'
})Params
optionsListEntryOptionsrequired: Add list entry options.listName"blocklist" | "safelist" | "blacklist" | "whitelist"required: The list to add the item to.itemstringrequired: The item to add to the list. This can be a domain, email address, or IP address.
Response
dataListEntry | nullnullableaction"blocklist" | "safelist"guaranteeditemstringguaranteedtype"domain" | "email_address" | "ip_address"guaranteed
errorErrorResponse | nullnullable: Error information if the operation failed.messagestringguaranteed: A human-readable description of the error.statusCodenumber | nullnullable: The HTTP status code from the API, ornullif the error is not related to an HTTP request.
List Entries method
Get account-level list entries.
Usage
ts
import { MailChannelsClient, Lists } from 'mailchannels-sdk'
const mailchannels = new MailChannelsClient('your-api-key')
const lists = new Lists(mailchannels)
const { data, error } = await lists.listEntries('safelist')ts
import { MailChannels } from 'mailchannels-sdk'
const mailchannels = new MailChannels('your-api-key')
const { data, error } = await mailchannels.lists.listEntries('safelist')Params
listName"blocklist" | "safelist" | "blacklist" | "whitelist"required: The name of the list to fetch.
Response
dataListEntry[] | nullnullableaction"blocklist" | "safelist"guaranteeditemstringguaranteedtype"domain" | "email_address" | "ip_address"guaranteed
errorErrorResponse | nullnullable: Error information if the operation failed.messagestringguaranteed: A human-readable description of the error.statusCodenumber | nullnullable: The HTTP status code from the API, ornullif the error is not related to an HTTP request.
Delete List Entry method
Delete item from account-level list.
Usage
ts
import { MailChannelsClient, Lists } from 'mailchannels-sdk'
const mailchannels = new MailChannelsClient('your-api-key')
const lists = new Lists(mailchannels)
const { success, error } = await lists.deleteListEntry({
listName: 'safelist',
item: 'name@domain.com'
})ts
import { MailChannels } from 'mailchannels-sdk'
const mailchannels = new MailChannels('your-api-key')
const { success, error } = await mailchannels.lists.deleteListEntry({
listName: 'safelist',
item: 'name@domain.com'
})Params
optionsListEntryOptionsrequired: Add list entry options.listName"blocklist" | "safelist" | "blacklist" | "whitelist"required: The name of the list to remove an entry from.itemstringrequired: The list entry which should be removed. This can be a domain, email address, or IP address.
Response
successbooleanguaranteed: Whether the operation was successful.errorErrorResponse | nullnullable: Error information if the operation failed.messagestringguaranteed: A human-readable description of the error.statusCodenumber | nullnullable: The HTTP status code from the API, ornullif the error is not related to an HTTP request.
Type declarations
ts
class Lists {
constructor (protected mailchannels: MailChannelsClient);
async addListEntry (options: ListEntryOptions): Promise<ListEntryResponse>;
async listEntries (listName: ListNames): Promise<ListEntriesResponse>;
async deleteListEntry (options: ListEntryOptions): Promise<SuccessResponse>;
}All type declarations
Response type declarations
ts
interface ErrorResponse {
message: string;
statusCode: number | null;
}ts
type DataResponse<T> = {
data: T;
error: null;
} | {
data: null;
error: ErrorResponse;
};List Entry type declarations
ts
type ListNames = "blocklist" | "safelist" | "blacklist" | "whitelist";ts
interface ListEntryOptions {
listName: ListNames;
item: string;
}ts
interface ListEntry {
action: Extract<ListNames, "blocklist" | "safelist">;
item: string;
type: "domain" | "email_address" | "ip_address";
}ts
type ListEntryResponse = DataResponse<ListEntry>;ts
type ListEntriesResponse = DataResponse<ListEntry[]>;Source
Source • Playground • Docs