⚙️ Service module Inbound API
Get information about the service.
Status method
Retrieve the condition of the service.
Usage
ts
import { MailChannelsClient, Service } from 'mailchannels-sdk'
const mailchannels = new MailChannelsClient('your-api-key')
const service = new Service(mailchannels)
const { success, error } = await service.status()ts
import { MailChannels } from 'mailchannels-sdk'
const mailchannels = new MailChannels('your-api-key')
const { success, error } = await mailchannels.service.status()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.
Subscriptions method
Get a list of your subscriptions to MailChannels Inbound.
Usage
ts
import { MailChannelsClient, Service } from 'mailchannels-sdk'
const mailchannels = new MailChannelsClient('your-api-key')
const service = new Service(mailchannels)
const { data, error } = await service.subscriptions()ts
import { MailChannels } from 'mailchannels-sdk'
const mailchannels = new MailChannels('your-api-key')
const { data, error } = await mailchannels.service.subscriptions()Response
dataobject[] | nullnullableactivebooleanguaranteedactiveAccountsCountnumberguaranteedhandlestringguaranteedlimitsobject[]guaranteedfeatureHandlestringguaranteedvaluestringguaranteed
planobjectguaranteedhandlestringguaranteednamestringguaranteed
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.
Report method
Submit a false negative or false positive report.
Usage
ts
import { MailChannelsClient, Service } from 'mailchannels-sdk'
const mailchannels = new MailChannelsClient('your-api-key')
const service = new Service(mailchannels)
const { success, error } = await service.report({
type: 'false_positive',
messageContent: 'Your message content'
})ts
import { MailChannels } from 'mailchannels-sdk'
const mailchannels = new MailChannels('your-api-key')
const { success, error } = await mailchannels.service.report({
type: 'false_positive',
messageContent: 'Your message content'
})Params
optionsServiceReportOptionsrequired: The report options.type"false_negative" | "false_positive"required: The type of report. Can be eitherfalse_positiveorfalse_negative.messageContentstringrequired: The full, unaltered message content in accordance with the RFC 2822 specifications without dot stuffing.smtpEnvelopeInformationobjectoptional: The SMTP envelope information.ehlostringguaranteedmailFromstringguaranteedrcptTostringguaranteed
sendingHostInformationobjectoptional: The sending host information.namestringguaranteed
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 Service {
constructor (protected mailchannels: MailChannelsClient);
async status (): Promise<SuccessResponse>;
async subscriptions (): Promise<ServiceSubscriptionsResponse>;
async report (options: ServiceReportOptions): 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;
};ts
interface SuccessResponse {
success: boolean;
error: ErrorResponse | null;
}Subscriptions type declarations
ts
type ServiceSubscriptionsResponse = DataResponse<{
active: boolean;
activeAccountsCount: number;
handle: string;
limits: {
featureHandle: string;
value: string;
}[];
plan: {
handle: string;
name: string;
};
}[]>;Report type declarations
ts
interface ServiceReportOptions {
type: "false_negative" | "false_positive";
messageContent: string;
smtpEnvelopeInformation?: {
ehlo: string;
mailFrom: string;
rcptTo: string;
};
sendingHostInformation?: {
name: string;
};
}Source
Source • Playground • Docs