Skip to content

Email response

Steve Lebleu edited this page Feb 23, 2024 · 4 revisions

This section describe the email response format.

> Table of contents

> Error

Bootstrap discarded

If your .cliamrc.js contains some errors, the process is exited with code 0 and explicit error message:

> Error in .cliamrc.js: "consumer.name" is not allowed

Process error

Returned error have always the same format, regardless used mode or provider:

{
  statusCode: Number,
  statusText: String,
  errors: String[]
}

Validation error

{
  statusCode: 400,
  statusText: 'Validation error',
  errors: [ '"meta.to[0].email" must be a valid email' ]
}

Sending error

{
  statusCode: 403,
  statusText: 'Forbidden.',
  errors: [ '' ]
}

> Success

Returned success response has always the same format, regardless used mode or provider:

{
  mode: 'api',
  provider: 'sendgrid',
  server: 'apache',
  uri: 'https://www.provider.com/send/email',
  timestamp: 213456854,
  headers: {},
  messageId: '<[email protected]>',
  body: { from: '[email protected]', to: [ '[email protected]' ] },
  statusCode: 202,
  statusMessage: '250 2.0.0 Ok: queued as 4F6wl33N22zlh8T2',
}

ℹ️ Regarding the provider, some properties can be null.

Discuss on Slack

Clone this wiki locally