# Notifications

Notifications

## Search for notifications on a tenant

> Search for notifications on a tenant\
> \
> Required permissions: INTERNAL\_PURCHASE\_ORDER, PURCHASE\_ORDER, RECEIVEMENT, RETURN\_ORDER, SALES\_ORDER, SERVICE\_ORDER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Notifications","description":"Notifications"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"NotificationResponse":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationResponseSchema"}}}}},"schemas":{"NotificationResponseSchema":{"title":"NotificationResponseSchema","type":"object","required":["messageType","recipient","message","subject","state","errorText","notificationUid","customerUid","orderUid","serviceOrderUid","serviceEventUid","tenantUserUid","supplierUid","receivementUid","purchaseOrderUid","createdBy","createdAt","lastModifiedBy","lastModifiedAt"],"properties":{"messageType":{"$ref":"#/components/schemas/MessageTypeENUM"},"recipient":{"type":"string"},"message":{"type":"string"},"subject":{"type":"string"},"state":{"$ref":"#/components/schemas/NotificationStateENUM"},"errorText":{"type":"string"},"notificationUid":{"$ref":"#/components/schemas/UID"},"customerUid":{"$ref":"#/components/schemas/OptionalUID"},"orderUid":{"$ref":"#/components/schemas/OptionalUID"},"serviceOrderUid":{"$ref":"#/components/schemas/OptionalUID"},"serviceEventUid":{"$ref":"#/components/schemas/OptionalUID"},"tenantUserUid":{"$ref":"#/components/schemas/OptionalUID"},"supplierUid":{"$ref":"#/components/schemas/OptionalUID"},"receivementUid":{"$ref":"#/components/schemas/OptionalUID"},"purchaseOrderUid":{"$ref":"#/components/schemas/OptionalUID"},"createdBy":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"lastModifiedBy":{"type":"string"},"lastModifiedAt":{"type":"string","format":"date-time"}}},"MessageTypeENUM":{"title":"MessageTypeENUM","type":"string","enum":["EMAIL","SMS"]},"NotificationStateENUM":{"title":"NotificationStateENUM","type":"string","enum":["NOT_STARTED","IN_PROGRESS","COMPLETE","FAILED"]},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"SortDirectionENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| ASC | Sort in ascending order|\n| DESC | Sort in descending order|\n","enum":["ASC","DESC"],"title":"SortDirectionENUM","type":"string"},"NotificationSearchSchema":{"title":"NotificationSearchSchema","type":"object","properties":{"messageType":{"$ref":"#/components/schemas/MessageTypeENUM"},"recipient":{"type":"string"},"message":{"type":"string"},"state":{"$ref":"#/components/schemas/NotificationStateENUM"},"errorText":{"type":"string"},"organizationUid":{"$ref":"#/components/schemas/UID"},"storeUid":{"$ref":"#/components/schemas/UID"},"customerUid":{"$ref":"#/components/schemas/UID"},"orderUid":{"$ref":"#/components/schemas/UID"},"serviceOrderUid":{"$ref":"#/components/schemas/UID"},"tenantUserUid":{"$ref":"#/components/schemas/UID"},"supplierUid":{"$ref":"#/components/schemas/UID"},"receivementUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"fromDateTime":{"type":"string","format":"date-time"},"toDateTime":{"type":"string","format":"date-time"},"query":{"type":"string","description":"Generic search. Searches both in messages an in recipient"}}}},"parameters":{"pageSizeQuery":{"description":"The number of items per page in a result set.","in":"query","name":"pageSize","required":false,"schema":{"type":"integer"}},"pageNumberQuery":{"description":"Reference to a specific page in a result set.","in":"query","name":"pageNumber","required":false,"schema":{"type":"integer"}},"sortByQuery":{"description":"Defines which field the resource list is sorted by.","in":"query","name":"sortBy","required":false,"schema":{"type":"string"}},"sortDirectionQuery":{"description":"Reference to a sort direction","explode":false,"in":"query","name":"sortDirection","schema":{"$ref":"#/components/schemas/SortDirectionENUM"},"style":"form"}},"requestBodies":{"NotificationSearchRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationSearchSchema"}}}}}},"paths":{"/tenants/{tenantUid}/notifications/search":{"post":{"summary":"Search for notifications on a tenant","operationId":"post-tenants-notifications-search","responses":{"200":{"$ref":"#/components/responses/NotificationResponse"}},"parameters":[{"$ref":"#/components/parameters/pageSizeQuery"},{"$ref":"#/components/parameters/pageNumberQuery"},{"$ref":"#/components/parameters/sortByQuery"},{"$ref":"#/components/parameters/sortDirectionQuery"}],"requestBody":{"$ref":"#/components/requestBodies/NotificationSearchRequest"},"description":"Search for notifications on a tenant\n\nRequired permissions: INTERNAL_PURCHASE_ORDER, PURCHASE_ORDER, RECEIVEMENT, RETURN_ORDER, SALES_ORDER, SERVICE_ORDER","tags":["Notifications"]}}}}
```

## List notifications for a store

> List notifications for a store\
> \
> Required permissions: INTERNAL\_PURCHASE\_ORDER, PURCHASE\_ORDER, RECEIVEMENT, RETURN\_ORDER, SALES\_ORDER, SERVICE\_ORDER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Notifications","description":"Notifications"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"NotificationListResponse":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/NotificationResponseSchema"}},"paging":{"$ref":"#/components/schemas/Paging"}},"required":["items","paging"]}}}}},"schemas":{"NotificationResponseSchema":{"title":"NotificationResponseSchema","type":"object","required":["messageType","recipient","message","subject","state","errorText","notificationUid","customerUid","orderUid","serviceOrderUid","serviceEventUid","tenantUserUid","supplierUid","receivementUid","purchaseOrderUid","createdBy","createdAt","lastModifiedBy","lastModifiedAt"],"properties":{"messageType":{"$ref":"#/components/schemas/MessageTypeENUM"},"recipient":{"type":"string"},"message":{"type":"string"},"subject":{"type":"string"},"state":{"$ref":"#/components/schemas/NotificationStateENUM"},"errorText":{"type":"string"},"notificationUid":{"$ref":"#/components/schemas/UID"},"customerUid":{"$ref":"#/components/schemas/OptionalUID"},"orderUid":{"$ref":"#/components/schemas/OptionalUID"},"serviceOrderUid":{"$ref":"#/components/schemas/OptionalUID"},"serviceEventUid":{"$ref":"#/components/schemas/OptionalUID"},"tenantUserUid":{"$ref":"#/components/schemas/OptionalUID"},"supplierUid":{"$ref":"#/components/schemas/OptionalUID"},"receivementUid":{"$ref":"#/components/schemas/OptionalUID"},"purchaseOrderUid":{"$ref":"#/components/schemas/OptionalUID"},"createdBy":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"lastModifiedBy":{"type":"string"},"lastModifiedAt":{"type":"string","format":"date-time"}}},"MessageTypeENUM":{"title":"MessageTypeENUM","type":"string","enum":["EMAIL","SMS"]},"NotificationStateENUM":{"title":"NotificationStateENUM","type":"string","enum":["NOT_STARTED","IN_PROGRESS","COMPLETE","FAILED"]},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"Paging":{"description":"totalCount The total number of items in the result set.\n\npageSize The number of items per page.\n\npageNumber The current page in the result set.","properties":{"pageNumber":{"type":"integer"},"pageSize":{"type":"integer"},"totalCount":{"type":"integer"}},"required":["totalCount","pageSize","pageNumber"],"title":"Paging","type":"object"},"SortDirectionENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| ASC | Sort in ascending order|\n| DESC | Sort in descending order|\n","enum":["ASC","DESC"],"title":"SortDirectionENUM","type":"string"}},"parameters":{"pageSizeQuery":{"description":"The number of items per page in a result set.","in":"query","name":"pageSize","required":false,"schema":{"type":"integer"}},"pageNumberQuery":{"description":"Reference to a specific page in a result set.","in":"query","name":"pageNumber","required":false,"schema":{"type":"integer"}},"sortByQuery":{"description":"Defines which field the resource list is sorted by.","in":"query","name":"sortBy","required":false,"schema":{"type":"string"}},"sortDirectionQuery":{"description":"Reference to a sort direction","explode":false,"in":"query","name":"sortDirection","schema":{"$ref":"#/components/schemas/SortDirectionENUM"},"style":"form"}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/notifications":{"get":{"summary":"List notifications for a store","tags":["Notifications"],"responses":{"200":{"$ref":"#/components/responses/NotificationListResponse"}},"operationId":"get-tenants-stores-notifications","description":"List notifications for a store\n\nRequired permissions: INTERNAL_PURCHASE_ORDER, PURCHASE_ORDER, RECEIVEMENT, RETURN_ORDER, SALES_ORDER, SERVICE_ORDER","parameters":[{"$ref":"#/components/parameters/pageSizeQuery"},{"$ref":"#/components/parameters/pageNumberQuery"},{"$ref":"#/components/parameters/sortByQuery"},{"$ref":"#/components/parameters/sortDirectionQuery"}]}}}}
```

## Send notification to recipient

> Send notification to recipient. If any of the optional fields \`customerUid\`, \`orderUid\` and \`serviceOrderUid\` is given in request, the ids MUST refer to an existing uid in the flow database.\
> \
> Either \`message\`-field or \`templateType\` field must be included in the request. If both are supplied, the content from the \`message\`-field will be used.\
> \
> Suppling a \`templateType\` can require the field \`customerUid\` or \`orderUid\` to be included as well. \
> \
> Required permissions: INTERNAL\_PURCHASE\_ORDER, PURCHASE\_ORDER, RECEIVEMENT, RETURN\_ORDER, SALES\_ORDER, SERVICE\_ORDER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Notifications","description":"Notifications"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"NotificationResponse":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationResponseSchema"}}}}},"schemas":{"NotificationResponseSchema":{"title":"NotificationResponseSchema","type":"object","required":["messageType","recipient","message","subject","state","errorText","notificationUid","customerUid","orderUid","serviceOrderUid","serviceEventUid","tenantUserUid","supplierUid","receivementUid","purchaseOrderUid","createdBy","createdAt","lastModifiedBy","lastModifiedAt"],"properties":{"messageType":{"$ref":"#/components/schemas/MessageTypeENUM"},"recipient":{"type":"string"},"message":{"type":"string"},"subject":{"type":"string"},"state":{"$ref":"#/components/schemas/NotificationStateENUM"},"errorText":{"type":"string"},"notificationUid":{"$ref":"#/components/schemas/UID"},"customerUid":{"$ref":"#/components/schemas/OptionalUID"},"orderUid":{"$ref":"#/components/schemas/OptionalUID"},"serviceOrderUid":{"$ref":"#/components/schemas/OptionalUID"},"serviceEventUid":{"$ref":"#/components/schemas/OptionalUID"},"tenantUserUid":{"$ref":"#/components/schemas/OptionalUID"},"supplierUid":{"$ref":"#/components/schemas/OptionalUID"},"receivementUid":{"$ref":"#/components/schemas/OptionalUID"},"purchaseOrderUid":{"$ref":"#/components/schemas/OptionalUID"},"createdBy":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"lastModifiedBy":{"type":"string"},"lastModifiedAt":{"type":"string","format":"date-time"}}},"MessageTypeENUM":{"title":"MessageTypeENUM","type":"string","enum":["EMAIL","SMS"]},"NotificationStateENUM":{"title":"NotificationStateENUM","type":"string","enum":["NOT_STARTED","IN_PROGRESS","COMPLETE","FAILED"]},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"GeneralNotificationRequestSchema":{"title":"GeneralNotificationRequestSchema","type":"object","required":["messageType","recipient"],"properties":{"messageType":{"$ref":"#/components/schemas/MessageTypeENUM"},"recipient":{"type":"string","description":"The recipient must be a valid phone number \nif the messageType is `SMS`, \nand a valid email if the messageType is `EMAIL`"},"subject":{"type":"string","description":"This is only valid for messageType `EMAIL`"},"message":{"type":"string","description":"The message that should be sent to the recipient"},"templateType":{"type":"string","description":"This must be a valid template type from the `/metadata/templates` endpoint"},"templateData":{"type":"array","description":"Optional overrides for template variables. Use the `name` values from `/metadata/templates`\n (e.g. `OrderNumber`). \n Server-filled values from `orderUid`, `customerUid`, etc. apply when a variable is still empty after merging.","items":{"type":"object","properties":{"key":{"type":"string"},"value":{"type":"string"}}}},"notificationUid":{"$ref":"#/components/schemas/UID"},"customerUid":{"$ref":"#/components/schemas/UID"},"orderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"receivementUid":{"$ref":"#/components/schemas/UID"}}}},"requestBodies":{"NotificationRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeneralNotificationRequestSchema"}}}}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/notifications":{"post":{"summary":"Send notification to recipient","operationId":"post-tenants-stores-notifications","responses":{"200":{"$ref":"#/components/responses/NotificationResponse"}},"requestBody":{"$ref":"#/components/requestBodies/NotificationRequest"},"description":"Send notification to recipient. If any of the optional fields `customerUid`, `orderUid` and `serviceOrderUid` is given in request, the ids MUST refer to an existing uid in the flow database.\n\nEither `message`-field or `templateType` field must be included in the request. If both are supplied, the content from the `message`-field will be used.\n\nSuppling a `templateType` can require the field `customerUid` or `orderUid` to be included as well. \n\nRequired permissions: INTERNAL_PURCHASE_ORDER, PURCHASE_ORDER, RECEIVEMENT, RETURN_ORDER, SALES_ORDER, SERVICE_ORDER","tags":["Notifications"]}}}}
```
