# Notifications

Notifications for currently authenticated users.

# Notification Object

Name Type Comment
id string A unique notification identifier.
type string Notification type.
data array Notification meta-data.
author object A basic info about the user who generated the notification (if applicable). Contains the following attributes: id, name, avatar.
read_at datetime A timestamp when the notification has been read by the user.
created_at datetime Comment creation timestamp.
updated_at datetime Comment update timestamp.

Notification can have one of the following types represented by the type attribute:

Type Description
Tickets.CommentAdded Fired when a comment is added to a ticket.
Tickets.TicketAssigned Fired when admin assigns a ticket to an agent.
Tickets.TicketClosedByAgent Fired when ticket is closed by support agent.
Tickets.TicketClosedByCustomer Fired when ticket is closed by customer.
Tickets.TicketCreated Fired when ticket is created.
Tickets.TicketCreatedByAgent Fired when ticket is created by agent, in behalf of the customer.
Customers.NoteAdded Fired when customer note is added.
Import.ImportCompletedSuccessfully Fired when import job completed successfully.
Import.ImportFailed Fired when import job failed.

# Paginate Notifications

GET
/notifications

# Request

curl --location --request GET 'https://yoursubdomain.support-hub.io/api/notifications' \
--header 'Accept: aplication/json'

# Example Response

{
    "data": [
      {
        "id": "00037dd2-c4b6-441a-bf6d-f346b62e8256",
        "type": "Tickets.TicketCreated",
        "data": {
          "ticket": {
            "id": 12345,
            "title": "Random Ticket"
          },
          "category": {
            "id": 74,
            "name": "Some Category Name"
          }, 
          "author_id": 8360
        },
        "author": {
          "id": 8360,
          "name": "John Doe",
          "avatar": "https://api.adorable.io/avatars/285/abott@adorable.png"          
        },
        "read_at": null,
        "created_at": "2019-09-19 09:06:51",
        "updated_at": "2019-09-19 09:06:51"
      },
      //...
    ],
    "links": {
        //...
    },
    "meta": {
        //...
    }
}

# View a Notification

GET
/notifications/{id}

# Example Request

curl --location --request GET 'https://yoursubdomain.support-hub.io/api/notifications/{id}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'

# Example Response

{
  "data": {
      "id": "00037dd2-c4b6-441a-bf6d-f346b62e8256",
      "type": "Tickets.TicketCreated",
      "data": {
        "ticket": {
          "id": 12345,
          "title": "Random Ticket"
        },
        "category": {
          "id": 74,
          "name": "Some Category Name"
        }, 
        "author_id": 8360
      },
      "author": {
        "id": 8360,
        "name": "John Doe",
        "avatar": "https://api.adorable.io/avatars/285/abott@adorable.png"          
      },
      "read_at": null,
      "created_at": "2019-09-19 09:06:51",
      "updated_at": "2019-09-19 09:06:51"
  }
}

# Mark as Read

POST
/notifications/{id}/read

# Example Request

curl --location --request POST 'https://yoursubdomain.support-hub.io/api/notifications/{id}/read' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'

# Example Response





















 





{
  "data": {
      "id": "00037dd2-c4b6-441a-bf6d-f346b62e8256",
      "type": "Tickets.TicketCreated",
      "data": {
        "ticket": {
          "id": 12345,
          "title": "Random Ticket"
        },
        "category": {
          "id": 74,
          "name": "Some Category Name"
        }, 
        "author_id": 8360
      },
      "author": {
        "id": 8360,
        "name": "John Doe",
        "avatar": "https://api.adorable.io/avatars/285/abott@adorable.png"          
      },
      "read_at": "2020-01-10 10:33:12",
      "created_at": "2019-09-19 09:06:51",
      "updated_at": "2019-09-19 09:06:51"
  }
}

# Mark as Unread

DELETE
/notifications/{id}/read

# Example Request

curl --location --request DELETE 'https://yoursubdomain.support-hub.io/api/notifications/{id}/read' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'

# Example Response





















 





{
  "data": {
      "id": "00037dd2-c4b6-441a-bf6d-f346b62e8256",
      "type": "Tickets.TicketCreated",
      "data": {
        "ticket": {
          "id": 12345,
          "title": "Random Ticket"
        },
        "category": {
          "id": 74,
          "name": "Some Category Name"
        }, 
        "author_id": 8360
      },
      "author": {
        "id": 8360,
        "name": "John Doe",
        "avatar": "https://api.adorable.io/avatars/285/abott@adorable.png"          
      },
      "read_at": null,
      "created_at": "2019-09-19 09:06:51",
      "updated_at": "2019-09-19 09:06:51"
  }
}

# Paginate Unread

GET
/notifications/{id}/unread

# Example Request

curl --location --request GET 'https://yoursubdomain.support-hub.io/api/notifications/{id}/unread' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'

# Example Response

{
    "data": [
      {
        "id": "00037dd2-c4b6-441a-bf6d-f346b62e8256",
        "type": "Tickets.TicketCreated",
        "data": {
          "ticket": {
            "id": 12345,
            "title": "Random Ticket"
          },
          "category": {
            "id": 74,
            "name": "Some Category Name"
          }, 
          "author_id": 8360
        },
        "author": {
          "id": 8360,
          "name": "John Doe",
          "avatar": "https://api.adorable.io/avatars/285/abott@adorable.png"          
        },
        "read_at": null,
        "created_at": "2019-09-19 09:06:51",
        "updated_at": "2019-09-19 09:06:51"
      },
      //...
    ],
    "links": {
        //...
    },
    "meta": {
        //...
    }
}

# Mark All as Read

Mark all unread notifications as read.

DELETE
/notifications/{id}/unread

# Example Request

curl --location --request DELETE 'https://yoursubdomain.support-hub.io/api/notifications/{id}/unread' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'

# Example Response

{
   Status: 200 OK
}