# Get notifications

GET https://services.leadconnectorhq.com/calendars/{calendarId}/notifications

Get calendar notifications based on query

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `calendars/events.readonly`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `calendarId` | string | Yes | Calendar ID |

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `isActive` | boolean | No | Filter by active status |
| `deleted` | boolean | No | Include deleted notifications |
| `limit` | number | No | Number of records to return |
| `skip` | number | No | Number of records to skip |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "LeadConnector API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/calendars/{calendarId}/notifications": {
      "get": {
        "summary": "Get notifications",
        "operationId": "getNotifications",
        "description": "Get calendar notifications based on query",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          },
          {
            "name": "calendarId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "example": "ocQHyuzHvysMo5N5VsXc"
            },
            "description": "Calendar ID"
          },
          {
            "name": "isActive",
            "required": false,
            "in": "query",
            "schema": {
              "type": "boolean",
              "example": true
            },
            "description": "Filter by active status"
          },
          {
            "name": "deleted",
            "required": false,
            "in": "query",
            "schema": {
              "type": "boolean",
              "example": false
            },
            "description": "Include deleted notifications"
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Number of records to return",
            "schema": {
              "default": 100,
              "type": "number",
              "example": 20
            }
          },
          {
            "name": "skip",
            "required": false,
            "in": "query",
            "description": "Number of records to skip",
            "schema": {
              "default": 0,
              "type": "number",
              "example": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetNotificationsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": [
              "calendars/events.readonly"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "GetNotificationsResponse": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "_id": {
              "type": "string",
              "description": "Notification ID",
              "example": "629a5d0a8c3f2b001f3d4e5a"
            },
            "receiverType": {
              "type": "string",
              "example": "contact",
              "enum": [
                "contact",
                "guest",
                "assignedUser",
                "emails",
                "phoneNumbers",
                "business"
              ],
              "description": "Notification recipient type"
            },
            "additionalEmailIds": {
              "example": [
                "example1@email.com",
                "example2@email.com"
              ],
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Additional email addresses to receive notifications"
            },
            "additionalPhoneNumbers": {
              "example": [
                "+919876744444",
                "+919876744445"
              ],
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Additional phone numbers to receive notifications"
            },
            "channel": {
              "type": "string",
              "example": "email",
              "enum": [
                "email",
                "inApp",
                "sms",
                "whatsapp"
              ],
              "description": "Notification channel"
            },
            "notificationType": {
              "type": "string",
              "example": "confirmation",
              "enum": [
                "booked",
                "confirmation",
                "cancellation",
                "reminder",
                "followup",
                "reschedule"
              ],
              "description": "Notification type"
            },
            "isActive": {
              "type": "boolean",
              "example": true,
              "description": "Whether the notification is active"
            },
            "additionalWhatsappNumbers": {
              "example": [
                "+919876744444",
                "+919876744445"
              ],
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Additional WhatsApp numbers to receive notifications"
            },
            "templateId": {
              "type": "string",
              "example": "0as9d8as0d",
              "description": "Template ID for the notification"
            },
            "body": {
              "type": "string",
              "example": "This is a test notification",
              "description": "Notification body content"
            },
            "subject": {
              "type": "string",
              "example": "Test Notification",
              "description": "Notification subject line"
            },
            "afterTime": {
              "example": [
                {
                  "timeOffset": 1,
                  "unit": "hours"
                }
              ],
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "timeOffset": {
                    "type": "number",
                    "description": "Time offset value for the notification schedule",
                    "example": 1
                  },
                  "unit": {
                    "type": "string",
                    "description": "Unit of time for the offset",
                    "example": "hours"
                  }
                },
                "title": "SchedulesDTO"
              },
              "description": "Time schedules after which follow-up notifications are sent"
            },
            "beforeTime": {
              "example": [
                {
                  "timeOffset": 1,
                  "unit": "hours"
                }
              ],
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "timeOffset": {
                    "type": "number",
                    "description": "Time offset value for the notification schedule",
                    "example": 1
                  },
                  "unit": {
                    "type": "string",
                    "description": "Unit of time for the offset",
                    "example": "hours"
                  }
                },
                "title": "SchedulesDTO"
              },
              "description": "Time schedules before which reminder notifications are sent"
            },
            "selectedUsers": {
              "example": [
                "user1",
                "user2"
              ],
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Selected user IDs for the notification"
            },
            "deleted": {
              "type": "boolean",
              "example": false,
              "description": "Whether the notification is deleted"
            }
          },
          "title": "CalendarNotificationResponseDTO"
        }
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X GET 'https://services.leadconnectorhq.com/calendars/<calendarId>/notifications' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3'
```

**Node.js**

```javascript
const options = {
  method: 'GET',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3'
  }
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/calendars/<calendarId>/notifications', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/calendars/{calendarId}/notifications"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v3"
}

response = requests.get(url, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/calendars/<calendarId>/notifications',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
  ],
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/calendars/<calendarId>/notifications")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .asString();
```

**Go**

```go
package main

import (
  "fmt"
  "net/http"
  "io"
)

func main() {
  url := "https://services.leadconnectorhq.com/calendars/<calendarId>/notifications"
  req, _ := http.NewRequest("GET", url, nil)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/calendars/<calendarId>/notifications")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"

response = http.request(request)
puts response.read_body
```

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v3"
}

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/calendars/<calendarId>/notifications' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
