Skip to content

⚙️ 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

  • success boolean guaranteed: Whether the operation was successful.
  • error string | null nullable

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

  • data object[] | null nullable
    • active boolean guaranteed
    • activeAccountsCount number guaranteed
    • handle string guaranteed
    • limits object[] guaranteed
      • featureHandle string guaranteed
      • value string guaranteed
    • plan object guaranteed
      • handle string guaranteed
      • name string guaranteed
  • error string | null nullable

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

  • options ServiceReportOptions required: The report options.
    • type "false_negative" | "false_positive" required: The type of report. Can be either false_positive or false_negative.
    • messageContent string required: The full, unaltered message content in accordance with the RFC 2822 specifications without dot stuffing.
    • smtpEnvelopeInformation object optional: The SMTP envelope information.
      • ehlo string guaranteed
      • mailFrom string guaranteed
      • rcptTo string guaranteed
    • sendingHostInformation object optional: The sending host information.
      • name string guaranteed

Response

  • success boolean guaranteed: Whether the operation was successful.
  • error string | null nullable

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

Responses

ts
interface DataResponse<T> {
  data: T | null;
  error: string | null;
}
ts
interface SuccessResponse {
  success: boolean;
  error: string | 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

SourcePlaygroundDocs

Released under the MIT License.