---
displayed_sidebar: servicesSidebar
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# NotificationService
## constructor
### Parameters
___
## Properties
`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "__container__",
"type": "`any`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "__moduleDeclaration__",
"type": "`Record`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "attachmentGenerator_",
"type": "`unknown`",
"description": "",
"optional": false,
"defaultValue": "null",
"expandable": false,
"children": []
},
{
"name": "container_",
"type": "`InjectedDependencies` & `object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "logger_",
"type": "[Logger](../../medusa/types/medusa.Logger.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager_",
"type": "`EntityManager`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "notificationProviderRepository_",
"type": "Repository<[NotificationProvider](../../entities/classes/entities.NotificationProvider.mdx)>",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "notificationRepository_",
"type": "Repository<[Notification](../../entities/classes/entities.Notification.mdx)>",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "subscribers_",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "{}",
"expandable": false,
"children": []
},
{
"name": "transactionManager_",
"type": "`undefined` \\| `EntityManager`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
___
## Accessors
### activeManager\_
#### Returns
___
## Methods
### atomicPhase\_
Wraps some work within a transactional block. If the service already has
a transaction manager attached this will be reused, otherwise a new
transaction manager is created.
#### Type Parameters
#### Parameters
Promise<TResult>",
"description": "the transactional work to be done",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationOrErrorHandler",
"type": "`IsolationLevel` \\| (`error`: `TError`) => Promise<void \\| TResult>",
"description": "the isolation level to be used for the work.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "maybeErrorHandlerOrDontFail",
"type": "(`error`: `TError`) => Promise<void \\| TResult>",
"description": "Potential error handler",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
___
### handleEvent
Handles an event by relaying the event data to the subscribing providers.
The result of the notification send will be persisted in the database in
order to allow for resends. Will log any errors that are encountered.
#### Parameters
`",
"description": "the data the event was sent with",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
___
### list
Retrieves a list of notifications.
#### Parameters
#### Returns
___
### listAndCount
Retrieves a list of notifications and total count.
#### Parameters
#### Returns
___
### registerAttachmentGenerator
Registers an attachment generator to the service. The generator can be
used to generate on demand invoices or other documents.
#### Parameters
#### Returns
___
### registerInstalledProviders
Takes a list of notification provider ids and persists them in the database.
#### Parameters
#### Returns
___
### resend
Resends a notification by retrieving a prior notification and calling the
underlying provider's resendNotification method.
#### Parameters
#### Returns
___
### retrieve
Retrieves a notification with a given id
#### Parameters
#### Returns
___
### retrieveProvider\_
Finds a provider with a given id. Will throw a NOT\_FOUND error if the
resolution fails.
#### Parameters
#### Returns
___
### send
Sends a notification, by calling the given provider's sendNotification
method. Persists the Notification in the database.
#### Parameters
`",
"description": "the data the event was sent with",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "providerId",
"type": "`string`",
"description": "the provider that should handle the event.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
___
### shouldRetryTransaction\_
#### Parameters
` \\| `object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
___
### subscribe
Subscribes a given provider to an event.
#### Parameters
#### Returns
___
### withTransaction
#### Parameters
#### Returns