Back to arky.io

Notification

Send emails to audiences or individual recipients using templates

The Notification module lets you send emails using email templates. Send to entire audiences (newsletters) or trigger individual notification emails.

Trigger Notification

POST /v1/notifications/trigger
SDK: sdk.notification.trigger()

Send an email using an email template. You can send to all subscribers of an audience, or to specific recipients. The businessId is passed in the body, not the URL.

// Send newsletter to all audience subscribers
await sdk.notification.trigger({
channel: 'email',
businessId: 'biz_123',
emailTemplateId: 'tmpl_newsletter',
audienceId: 'aud_newsletter',
vars: {
  title: 'Weekly Update',
  content: 'Here is what happened this week...',
},
});

// Send to specific recipients
await sdk.notification.trigger({
channel: 'email',
businessId: 'biz_123',
emailTemplateId: 'tmpl_welcome',
recipients: ['user@example.com'],
vars: {
  name: 'John',
},
});

Parameters

Name Type Description
channel required string Notification channel (currently 'email')
businessId required string Business ID
emailTemplateId required string Email template ID to render
audienceId optional string Send to all subscribers of this audience
recipients optional string[] Send to specific email addresses
vars optional Record<string, any> Template variables passed to Handlebars
Note

Either audienceId or recipients should be provided. If audienceId is set, the email is sent to all active subscribers of that audience.

How Notifications Work

Notifications are typically triggered in two ways:

1. Via Workflows (Automated)

Default workflows automatically send notification emails when events occur:

  • Order created -> sends order confirmation to customer + notification to business
  • Booking created -> sends booking confirmation to customer + notification to business
  • Form submitted -> sends contact notification to business

These workflows call the notification trigger endpoint internally using the default email templates.

2. Via SDK (Manual)

Use sdk.notification.trigger() directly for:

  • Sending newsletters to an audience
  • Custom transactional emails
  • One-off notifications

Template Variables

Variables are passed as the vars parameter and rendered using Handlebars syntax ({{variable}}) in the email template body and subject.

// Template body: "<h1>Hello {{name}}</h1><p>Your code: {{code}}</p>"
await sdk.notification.trigger({
  channel: 'email',
  businessId: 'biz_123',
  emailTemplateId: 'tmpl_custom',
  recipients: ['user@example.com'],
  vars: {
    name: 'Jane',
    code: 'ABC123',
  },
});

See Email Templates for creating and managing templates.