# eFood Notification Service
This service is to notify users (customers, merchants, heroes) regarding any information (offers, discounts etc) that an admin wants to send.
In development, notification base url : `http://api-dev.evaly.com.bd/efood-notification`
### Create Notification
- `Description:`
This api creates a new notification to send to the target group of user.
- `Endpoint` : `/api/v1.0.0//notifications`
- `Method` : `POST`
- `Headers` :
- `SERVICE` : < service type here >
- `SECRET-KEY`: < evaly secret key here>
- `Query Parameters` : `N/A`
- `Request Body` :
```json=
{
"notification_body": "Notification from shipu",
"notification_title": "Test Notification",
"notification_type": "food",
"invoice_no": "321",
"to": "01800000000"
}
```
- `Response Body` :
```json=
{
"success": true,
"message": "Created",
"data": {
"body": "Notification from shipu",
"title": "Test Notification",
"type": "food",
"resource_id": "321",
"icon": null,
"redirect_url": null,
"misc": null
}
}
```
`Message` field contains "Created" or error log for unsuccessful requests. `Data` field contains the description, title and other information regarding the notification.
### Update Notification Status
- `Description:`
This api used to update status of a notification as read.
- `Endpoint` : `/api/v1.0.0/notifications`
- `Method` : `PUT`
- `Headers` :
- `Authorization` : < access token here >
- `Query Parameters` : `N/A`
- `Request Body` :
```json=
{
"ids": ["5fdf180bc50efae4302420b5"]
}
```
- `Response Body` :
```json=
{
"success": true,
"message": "notifications are marked as seen",
"data": {}
}
```
`Message` field describes the success of the request.
### Custom Send Notification
- `Description:`
This api creates a new notification to send to a specific user.
- `Endpoint` : `/api/v1.0.0/bulk/notifications`
- `Method` : `POST`
- `Headers` :
- `Authorization` : < access token here >
- `SECRET-KEY` : < evaly secret key here>
- `Query Parameters` : `N/A`
- `Request Body` :
```json=
{
"notification_body": "edrheg asdf esadf sadf asdf asf adsf sadf sadf sadf sadf↵ sdaf ↵asdf sad↵f sdf↵ s",
"notification_title": "Title of the notification",
"notification_type": "hero_promotion",
"notification_topic": "hero",
"image_url": "https://s3-ap-southeast-1.amazonaws.com/media.evaly.com.bd/media/images/2f3ef0b0e986-isupportimg_1539524689349.png",
"to": ["01920520407"]
}
```
- `Response Body` :
```json=
{
"success": true,
"message": "Notification Send. It's takes few minutes",
"data": {}
}
```
`Message` field contains information regarding the sent notification.
### Notification Subscription
- `Description:`
Creates subscription for a specific group.
- `Endpoint` : `/api/v1.0.0/subscriptions`
- `Method` : `POST`
- `Headers` :
- `Authorization` : < access token here >
- `EV_NOTIFICATION_TOPIC` : < notification topic here >
- `Query Parameters` : `N/A`
- `Request Body` :
```json=
{
"subscription_token": "cLwWOomkov4HxWc0fD0Fyj:APA91bEOTknStHzaxv3t5dAbtwa7XArhtJb4PE4ePyg_a7CxoBDIWu2jmDkzg1nMuAtBnJnJb5BIPmLAizRLshqv-p3DuFYu_66eI0r3xhqSP6CTuHREj6_ptjBn-3_1zUhJ_NQ9JIkc",
"unsubscription_token": null,
"notification_topic": "hero_admin_all",
"to": null
}
```
- `Response Body` :
```json=
{
"success": true,
"message": "token successfully subscribe",
"data": {}
}
```
`Message` field contains success message or error log for unsuccessful requests.
### Delete Notification
- `Description:`
This API deletes all the notification of users keeping only the latest 5 notifications.
- `Endpoint` : `/api/v1.0.0/delete/notifications`
- `Method` : `POST`
- `Headers` :
- `SECRET-KEY` : < evaly secret key here>
- `Query Parameters` : `N/A`
- `Request Body` : `N/A`
- `Response Body` :
```json=
{
"success": true,
"message": "Status OK",
"data": [
{
"to": "01300000000",
"deleted_count": 75
},
{
"to": "01911111111",
"deleted_count": 93
},
{
"to": "01300000044",
"deleted_count": 9
},
{
"to": "77777777770",
"deleted_count": 468
},
{
"to": "88888888885",
"deleted_count": 1
},
{
"to": "01313131313",
"deleted_count": 109
},
{
"to": "01747021966",
"deleted_count": 54
},
{
"to": "25111111111",
"deleted_count": 13
},
{
"to": "88888888883",
"deleted_count": 13
},
{
"to": "01920520407",
"deleted_count": 103
},
{
"to": "dev_hero_admin_all",
"deleted_count": 1095
},
{
"to": "01800000000",
"deleted_count": 151
},
{
"to": "01723878203",
"deleted_count": 4
},
{
"to": "01311111111",
"deleted_count": 18
},
{
"to": "01999999990",
"deleted_count": 14
},
{
"to": "01300000005",
"deleted_count": 602
},
{
"to": "shanto",
"deleted_count": 4
},
{
"to": "dev_efood_admin_all",
"deleted_count": 1092
},
{
"to": "shipu",
"deleted_count": 5
},
{
"to": "01822222222",
"deleted_count": 68
},
{
"to": "01711111111",
"deleted_count": 7
},
{
"to": "01683193505",
"deleted_count": 284
},
{
"to": "01300000043",
"deleted_count": 86
},
{
"to": "01742001078",
"deleted_count": 2
},
{
"to": "01703811371",
"deleted_count": 23
},
{
"to": "01730445665",
"deleted_count": 40
},
{
"to": "01938504111",
"deleted_count": 82
},
{
"to": "01678691763",
"deleted_count": 14
},
{
"to": "77777777771",
"deleted_count": 71
},
{
"to": "dev_hero_all",
"deleted_count": 23
},
{
"to": "01700000001",
"deleted_count": 4
},
{
"to": "dev_evaly_admin_all",
"deleted_count": 7
},
{
"to": "01751977045",
"deleted_count": 11
},
{
"to": "01313131300",
"deleted_count": 2
},
{
"to": "01750265167",
"deleted_count": 40
},
{
"to": "01310101010",
"deleted_count": 6
},
{
"to": "01700000011",
"deleted_count": 51
},
{
"to": "01932062088",
"deleted_count": 669
}
]
}
```
`Message` field contains the `Status OK` or error log for unsuccessful requests. `Data` field contains the informations regarding the notification receiver and the deleted count for that user.
### Get Notification
- `Description:`
Lets an user view the list of their notifications.
- `Endpoint` : `/api/v1.0.0/notifications`
- `Method` : `GET`
- `Headers` :
- `Authorization` : < service type here >
- `X-EVALY-NOTIFICATION-TOPIC` : < notification topic here >
- `Query Parameters` : `N/A`
- `Request Body` :
- `Response Body` :
```json=
{
"success": true,
"message": "Status OK",
"data": [
{
"_id": "5fdf180bc50efae4302420b5",
"status": "unread",
"body": "Notification from shipu",
"title": "Test Notification",
"type": "food",
"resource_id": "321",
"misc": null,
"timestamp": "2020-12-20T09:23:23.966564+06:00"
},
{
"_id": "5fdf0e2bc50efae4302420b0",
"status": "unread",
"body": "Order EVF0000020668 is accepted by an Evaly hero",
"title": "Order Status Update",
"type": "order_status_update",
"resource_id": "EVF0000020668",
"misc": null,
"timestamp": "2020-12-20T08:41:15.614212+06:00"
},
{
"_id": "5fdf0e2ace77f1736ff8b603",
"status": "unread",
"body": "Order EVF0000020668 is accepted by an Evaly hero",
"title": "Order Status Update",
"type": "order_status_accepted",
"resource_id": "EVF0000020668",
"misc": null,
"timestamp": "2020-12-20T08:41:14.575051+06:00"
},
{
"_id": "5fdf0e11c50efae4302420ae",
"status": "unread",
"body": "Order EVF0000020668 is confirmed",
"title": "Order Status Update",
"type": "order_status_update",
"resource_id": "EVF0000020668",
"misc": null,
"timestamp": "2020-12-20T08:40:49.849462+06:00"
},
{
"_id": "5fdf0e11ce77f1736ff8b602",
"status": "unread",
"body": "Order EVF0000020668 is confirmed",
"title": "Order Status Update",
"type": "order_status_confirmed",
"resource_id": "EVF0000020668",
"misc": null,
"timestamp": "2020-12-20T08:40:49.769321+06:00"
},
{
"_id": "5fdf0cc3c50efae4302420ab",
"status": "unread",
"body": "Order EVF0000020522 is confirmed",
"title": "Order Status Update",
"type": "order_status_update",
"resource_id": "EVF0000020522",
"misc": null,
"timestamp": "2020-12-20T08:35:15.101073+06:00"
},
{
"_id": "5fdf0cc2ce77f1736ff8b601",
"status": "unread",
"body": "Order EVF0000020522 is confirmed",
"title": "Order Status Update",
"type": "order_status_confirmed",
"resource_id": "EVF0000020522",
"misc": null,
"timestamp": "2020-12-20T08:35:14.942598+06:00"
}
]
}
```
`Message` field contains the `Status OK` or error log for unsuccessful requests. `Data` field contains the informations regarding the received notification.
### Base Request
- `Description:`
List of all type of push notification service.
- `Endpoint` : `/swagger.json`
- `Method` : `GET`
- `Headers` : `N/A`
- `Query Parameters` : `N/A`
- `Request Body` : `N/A`
- `Response Body` :
```json=
{
"swagger": "2.0",
"info": {
"description": "All type of push notification service",
"version": "v1.0.0",
"title": "Notification Service"
},
"host": "api-dev.evaly.com.bd",
"basePath": "/efood-notification",
"tags": [
{
"name": "Notification Service",
"description": ""
}
],
"schemes": [
"https"
],
"paths": {
"/": {
"get": {
"tags": [
"Notification Service"
],
"summary": "Base Request",
"responses": {
"200": {
"description": "successful operation"
}
}
}
},
"/api/v1.0.0/bulk/notifications": {
"post": {
"tags": [
"Notification Service"
],
"summary": "Custom Send Notification",
"consumes": [
"application/json"
],
"parameters": [
{
"name": "Authorization",
"in": "header",
"type": "string",
"description": "",
"required": true
},
{
"name": "Content-Type",
"in": "header",
"type": "string",
"description": "",
"required": true
},
{
"name": "SECRET-KEY",
"in": "header",
"type": "string",
"description": "",
"required": false
}
],
"responses": {
"200": {
"description": "successful operation"
}
}
}
},
"/api/v1.0.0/delete/notifications": {
"post": {
"tags": [
"Notification Service"
],
"summary": "Delete Notification",
"parameters": [
{
"name": "SECRET-KEY",
"in": "header",
"type": "string",
"description": "",
"required": true
}
],
"responses": {
"200": {
"description": "successful operation"
}
}
}
},
"/api/v1.0.0/groups": {
"post": {
"tags": [
"Notification Service"
],
"summary": "Create Group",
"consumes": [
"application/json"
],
"parameters": [
{
"name": "Authorization",
"in": "header",
"type": "string",
"description": "",
"required": true
},
{
"name": "Content-Type",
"in": "header",
"type": "string",
"description": "",
"required": true
}
],
"responses": {
"200": {
"description": "successful operation"
}
}
}
},
"/api/v1.0.0/groups/5f61e141314078660cffc711": {
"get": {
"tags": [
"Notification Service"
],
"summary": "Get Group",
"parameters": [
{
"name": "Authorization",
"in": "header",
"type": "string",
"description": "",
"required": true
}
],
"responses": {
"200": {
"description": "successful operation"
}
}
}
},
"/api/v1.0.0/groups/5f61f00d5c0bb0c6d6650aa0": {
"put": {
"tags": [
"Notification Service"
],
"summary": "Update Group",
"consumes": [
"application/json"
],
"parameters": [
{
"name": "Authorization",
"in": "header",
"type": "string",
"description": "",
"required": true
},
{
"name": "Content-Type",
"in": "header",
"type": "string",
"description": "",
"required": true
}
],
"responses": {
"200": {
"description": "successful operation"
}
}
}
},
"/api/v1.0.0/groups/5f61fc85ec5ec14c128c006b": {
"delete": {
"tags": [
"Notification Service"
],
"summary": "Delete Group",
"parameters": [
{
"name": "Authorization",
"in": "header",
"type": "string",
"description": "",
"required": true
}
],
"responses": {
"200": {
"description": "successful operation"
}
}
}
},
"/api/v1.0.0/notifications": {
"put": {
"tags": [
"Notification Service"
],
"summary": "Update Notification Status",
"consumes": [
"application/json"
],
"parameters": [
{
"name": "Content-Type",
"in": "header",
"type": "string",
"description": "",
"required": true
},
{
"name": "Authorization",
"in": "header",
"type": "string",
"description": "",
"required": true
}
],
"responses": {
"200": {
"description": "successful operation"
}
}
},
"post": {
"tags": [
"Notification Service"
],
"summary": "Create Notification",
"consumes": [
"application/json"
],
"parameters": [
{
"name": "Content-Type",
"in": "header",
"type": "string",
"description": "",
"required": true
},
{
"name": "Authorization",
"in": "header",
"type": "string",
"description": "",
"required": true
},
{
"name": "EV_NOTIFICATION_TOPIC",
"in": "header",
"type": "string",
"description": "",
"required": true
},
{
"name": "SERVICE",
"in": "header",
"type": "string",
"description": "",
"required": true
},
{
"name": "EV_NOTIFICATION_USERNAME",
"in": "header",
"type": "string",
"description": "",
"required": true
},
{
"name": "SECRET-KEY",
"in": "header",
"type": "string",
"description": "",
"required": true
}
],
"responses": {
"200": {
"description": "successful operation"
}
}
},
"get": {
"tags": [
"Notification Service"
],
"summary": "Get Notification",
"parameters": [
{
"name": "Authorization",
"in": "header",
"type": "string",
"description": "",
"required": true
},
{
"name": "X-EVALY-PLATFORM",
"in": "header",
"type": "string",
"description": "",
"required": true
},
{
"name": "SECRET-KEY",
"in": "header",
"type": "string",
"description": "",
"required": true
},
{
"name": "X-EVALY-NOTIFICATION-TOPIC",
"in": "header",
"type": "string",
"description": "",
"required": true
}
],
"responses": {
"200": {
"description": "successful operation"
}
}
}
},
"/api/v1.0.0/subscriptions": {
"post": {
"tags": [
"Notification Service"
],
"summary": "Subscription",
"consumes": [
"application/json"
],
"parameters": [
{
"name": "Authorization",
"in": "header",
"type": "string",
"description": "",
"required": true
},
{
"name": "Content-Type",
"in": "header",
"type": "string",
"description": "",
"required": true
},
{
"name": "EV_NOTIFICATION_TOPIC",
"in": "header",
"type": "string",
"description": "",
"required": true
}
],
"responses": {
"200": {
"description": "successful operation"
}
}
}
}
}
}
```