Skip to Content
Notification APIDocs
Messages

Send a message

POST
/api/v1/companies/{companyId}/projects/{projectId}/messages

Accepts a message; dispatches are created as pending for the publisher.

Required permission: messages.send. See the guide for details.

Error codes:

  • 400 validation.failed
  • 404 project.not_found, message.channel_not_found, message.template_not_found, attachment.not_found
  • 422 message.company_inactive, message.project_inactive, message.push_requires_device_tokens, message.no_active_provider, message.otp_not_supported, message.missing_variables, message.attachments_not_supported, message.attachments_too_large

Every endpoint can also answer 401 (missing or invalid key), 403 (route outside the key's project or permission) and 429 rate_limit.exceeded.

Authorization

ApiKey
headerX-Api-Key<token>

Project API key: nb_<prefix>_<secret>.

Path Parameters

companyId*string

Id of the company that owns the project (shown with the API key in the dashboard).

Formatuuid
projectId*string

Id of the project the API key belongs to.

Formatuuid

Request Body

application/json
  1. body
channel*string

Channel code: email, sms or push.

recipients*array<>

1 to 10,000 recipients, counted before duplicates are removed. Duplicates (after normalization) are sent once.

Items1 <= items <= 10000
templateId?|

Template to render. It must belong to the project and to the same channel.

Formatuuid
content?|

Message body. Required without templateId; overrides the template body when both are given. Up to 1,000,000 characters.

Lengthlength <= 1000000
variables?|

Values for {{ key }} placeholders of the template, at most 100. Recipient variables override these.

priority?unknown

Delivery priority. Default Normal.

Value in"Critical""Normal""Bulk"
idempotencyKey?|

Up to 128 characters. Sending the same key again in this project returns the original message instead of creating a new one.

Lengthlength <= 128
scheduledAt?|

Send later: a future time, at most 90 days ahead (ISO 8601).

Formatdate-time
subject?|

Subject line (email). Overrides the template subject. Up to 998 characters.

Lengthlength <= 998
attachmentIds?|array<>

Ids of uploaded attachments (email only). At most 10 files and 20 MB in total, template attachments included.

Itemsitems <= 10
isOtp?boolean

One-time password message. Only on the sms channel and only when the project has an OTP-capable SMS provider.

Defaultfalse
data?|

Provider-specific JSON object (for example push payload data), up to 16 KB. String values may contain placeholders when a template is used.

Response Body

Accepted

application/json
  1. response
message*
content*string

Message-level content (template body or the request content).

subject*null|string
variables*
idempotencyKey*null|string
apiKeyId*|

The API key that sent the message, if any.

Formatuuid
dispatches*

Number of dispatches per status; statuses with no dispatch are left out.

attachments*array<>
data*|

Provider-specific JSON object, or null.

Example Request
curl -X POST 'https://api.gbnotification.dokploy.geobilgi.net/api/v1/companies/497f6eca-6276-4993-bfeb-53cbbbba6f08/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/messages' \  -H 'Content-Type: application/json' \  -d '{  "channel": "email",  "recipients": [    {      "type": "Email",      "value": "jane@example.com"    }  ],  "subject": "Your order has shipped",  "content": "<p>Hi Jane, your order is on its way.</p>",  "priority": "Normal",  "idempotencyKey": "order-1042-shipped"}'
Example Response
{  "message": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "channel": "string",    "priority": "Critical",    "status": "Pending",    "messageTemplateId": null,    "recipientCount": 0,    "scheduledAt": null,    "isOtp": true,    "createdAt": "2019-08-24T14:15:22Z",    "templateName": null,    "subject": null,    "firstRecipient": null  },  "content": "string",  "subject": null,  "variables": {    "property1": "string",    "property2": "string"  },  "idempotencyKey": null,  "apiKeyId": null,  "dispatches": {    "property1": 0,    "property2": 0  },  "attachments": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "fileName": "string",      "contentType": "string",      "sizeBytes": 0,      "source": "Template"    }  ],  "data": null}