MailerAddProvider¶
POST mailer/provider
Registers a provider in the global catalogue. A provider record links an adapter in the module
to the profiles that hold credentials: name must match an adapter name from
MailerGetProviderAdapters.
The catalogue is global — brand-specific settings live in provider profiles.
Access Control¶
Allowed role: provider.
Request¶
POST https://{broker_domain}/mailer/provider
{
"name": "postmark",
"status": "ENABLED",
"description": "Postmark transactional email",
"options": {
"serverToken": "string",
"messageStream": "string?"
},
"supportedUpdateModes": [
"WEBHOOK"
]
}
{
"command": "MailerAddProvider",
"extID": "1",
"data": {
"name": "postmark",
"status": "ENABLED",
"description": "Postmark transactional email",
"options": {
"serverToken": "string",
"messageStream": "string?"
},
"supportedUpdateModes": [
"WEBHOOK"
]
}
}
const res = await platform.MailerAddProvider({
name: "postmark",
status: "ENABLED",
description: "Postmark transactional email",
options: {
serverToken: "string",
messageStream: "string?"
},
supportedUpdateModes: [
"WEBHOOK"
]
});
Request Data¶
| Field | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | Adapter name, lowercase without spaces (postmark, ses, smtp) |
status |
enum | Yes | ENABLED or DISABLED |
description |
string | No | Provider description for the UI |
icon |
string | file | No | Icon hash or an uploaded file |
url |
string | No | Provider site or panel link |
options |
object | Yes | Credential field description for the UI; usually the adapter credentialsSchema |
supportedUpdateModes |
array | Yes | Which delivery event modes this provider allows: NONE, REQUEST, WEBHOOK |
Behavior¶
- A provider cannot declare a mode its adapter does not implement. Otherwise profiles would be created whose emails stay in
SENTforever, with no bounce or complaint ever recorded. - Creating a provider whose name was soft-deleted restores the old record and answers
restored: true— the name is unique in storage, so otherwise it would stay taken forever.
Response Data¶
The provider record is returned flat. message also carries the warning when the named adapter is not implemented in the running module.
{
"id": 1,
"name": "postmark",
"status": "ENABLED",
"description": "Postmark transactional email",
"options": { "serverToken": "string", "messageStream": "string?" },
"supportedUpdateModes": ["WEBHOOK"],
"adapterImplemented": true,
"capabilities": { "sendEmail": true, "statusRequest": true, "webhook": true, "balance": false, "domainCheck": true },
"restored": false,
"message": "Provider postmark has been created."
}
Errors¶
| Code | Error | Description |
|---|---|---|
400 |
VALIDATION_ERROR |
name is not lowercase, or a required field is missing |
400 |
UPDATE_MODE_NOT_SUPPORTED |
The adapter cannot do a declared mode |
409 |
PROVIDER_EXISTS |
An active provider with this name already exists |