---
displayed_sidebar: servicesSidebar
---

import ParameterTypes from "@site/src/components/ParameterTypes"

# Notification

A notification is an alert sent, typically to customers, using the installed Notification Provider as a reaction to internal events such as `order.placed`. Notifications can be resent.

## constructor

`**new Notification**()`

A notification is an alert sent, typically to customers, using the installed Notification Provider as a reaction to internal events such as `order.placed`. Notifications can be resent.

___

## Properties

<ParameterTypes parameters={[
  {
    "name": "created_at",
    "type": "`Date`",
    "description": "The date with timezone at which the resource was created.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "customer",
    "type": "[Customer](Customer.mdx)",
    "description": "The details of the customer that this notification was sent to.",
    "optional": false,
    "defaultValue": "",
    "expandable": true,
    "children": []
  },
  {
    "name": "customer_id",
    "type": "`null` \\| `string`",
    "description": "The ID of the customer that this notification was sent to.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "data",
    "type": "`Record<string, unknown>`",
    "description": "The data that the Notification was sent with. This contains all the data necessary for the Notification Provider to initiate a resend.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "event_name",
    "type": "`string`",
    "description": "The name of the event that the notification was sent for.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "id",
    "type": "`string`",
    "description": "The notification's ID",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "parent_id",
    "type": "`string`",
    "description": "The notification's parent ID",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "parent_notification",
    "type": "[Notification](Notification.mdx)",
    "description": "The details of the parent notification.",
    "optional": false,
    "defaultValue": "",
    "expandable": true,
    "children": []
  },
  {
    "name": "provider",
    "type": "[NotificationProvider](NotificationProvider.mdx)",
    "description": "The notification provider used to send the notification.",
    "optional": false,
    "defaultValue": "",
    "expandable": true,
    "children": []
  },
  {
    "name": "provider_id",
    "type": "`string`",
    "description": "The ID of the notification provider used to send the notification.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "resends",
    "type": "[Notification](Notification.mdx)[]",
    "description": "The details of all resends of the notification.",
    "optional": false,
    "defaultValue": "",
    "expandable": true,
    "children": []
  },
  {
    "name": "resource_id",
    "type": "`string`",
    "description": "The ID of the resource that the Notification refers to.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "resource_type",
    "type": "`string`",
    "description": "The type of resource that the Notification refers to.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "to",
    "type": "`string`",
    "description": "The address that the Notification was sent to. This will usually be an email address, but can represent other addresses such as a chat bot user ID.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "updated_at",
    "type": "`Date`",
    "description": "The date with timezone at which the resource was updated.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

___

## Methods

### beforeInsert

`Private **beforeInsert**(): void`

#### Returns

`void`

<ParameterTypes parameters={[
  {
    "name": "void",
    "type": "`void`",
    "optional": true,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />
