{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/novu/main/json-schema/novu-subscriber-response-dto-schema.json",
  "title": "SubscriberResponseDto",
  "description": "JSON Schema for Novu SubscriberResponseDto.",
  "type": "object",
  "properties": {
    "_id": {
      "type": "string",
      "description": "The internal ID generated by Novu for your subscriber. This ID does not match the `subscriberId` used in your queries. Refer to `subscriberId` for that identifier."
    },
    "firstName": {
      "type": [
        "string",
        "null"
      ],
      "description": "The first name of the subscriber."
    },
    "lastName": {
      "type": [
        "string",
        "null"
      ],
      "description": "The last name of the subscriber."
    },
    "email": {
      "type": [
        "string",
        "null"
      ],
      "description": "The email address of the subscriber."
    },
    "phone": {
      "type": [
        "string",
        "null"
      ],
      "description": "The phone number of the subscriber."
    },
    "avatar": {
      "type": [
        "string",
        "null"
      ],
      "description": "The URL of the subscriber's avatar image."
    },
    "locale": {
      "type": [
        "string",
        "null"
      ],
      "description": "The locale setting of the subscriber, indicating their preferred language or region."
    },
    "channels": {
      "description": "An array of channel settings associated with the subscriber.",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "providerId": {
            "type": "string",
            "description": "The provider identifier for the credentials",
            "enum": [
              "slack",
              "discord",
              "msteams",
              "mattermost",
              "ryver",
              "zulip",
              "grafana-on-call",
              "getstream",
              "rocket-chat",
              "whatsapp-business",
              "chat-webhook",
              "novu-slack",
              "telegram",
              "fcm",
              "apns",
              "expo",
              "one-signal",
              "pushpad",
              "push-webhook",
              "pusher-beams",
              "appio"
            ]
          },
          "integrationIdentifier": {
            "type": "string",
            "description": "The integration identifier"
          },
          "credentials": {
            "description": "Credentials payload for the specified provider",
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "webhookUrl": {
                    "type": "string",
                    "description": "Webhook URL used by chat app integrations. The webhook should be obtained from the chat app provider.",
                    "example": "https://example.com/webhook"
                  },
                  "channel": {
                    "type": "string",
                    "description": "Channel specification for Mattermost chat notifications.",
                    "example": "general"
                  },
                  "deviceTokens": {
                    "description": "Contains an array of the subscriber device tokens for a given provider. Used on Push integrations.",
                    "example": [
                      "token1",
                      "token2",
                      "token3"
                    ],
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "alertUid": {
                    "type": "string",
                    "description": "Alert UID for Grafana on-call webhook payload.",
                    "example": "12345-abcde"
                  },
                  "title": {
                    "type": "string",
                    "description": "Title to be used with Grafana on-call webhook.",
                    "example": "Critical Alert"
                  },
                  "imageUrl": {
                    "type": "string",
                    "description": "Image URL property for Grafana on-call webhook.",
                    "example": "https://example.com/image.png"
                  },
                  "state": {
                    "type": "string",
                    "description": "State property for Grafana on-call webhook.",
                    "example": "resolved"
                  },
                  "externalUrl": {
                    "type": "string",
                    "description": "Link to upstream details property for Grafana on-call webhook.",
                    "example": "https://example.com/details"
                  }
                }
              }
            ]
          },
          "_integrationId": {
            "type": "string",
            "description": "The unique identifier of the integration associated with this channel."
          }
        },
        "required": [
          "providerId",
          "credentials",
          "_integrationId"
        ]
      }
    },
    "topics": {
      "description": "An array of topics that the subscriber is subscribed to.",
      "deprecated": true,
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "isOnline": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "Indicates whether the subscriber is currently online."
    },
    "lastOnlineAt": {
      "type": [
        "string",
        "null"
      ],
      "description": "The timestamp indicating when the subscriber was last online, in ISO 8601 format."
    },
    "__v": {
      "type": "number",
      "description": "The version of the subscriber document."
    },
    "data": {
      "type": [
        "object",
        "null"
      ],
      "description": "Additional custom data for the subscriber",
      "additionalProperties": true
    },
    "timezone": {
      "type": [
        "string",
        "null"
      ],
      "description": "Timezone of the subscriber"
    },
    "subscriberId": {
      "type": "string",
      "description": "The identifier used to create this subscriber, which typically corresponds to the user ID in your system."
    },
    "_organizationId": {
      "type": "string",
      "description": "The unique identifier of the organization to which the subscriber belongs."
    },
    "_environmentId": {
      "type": "string",
      "description": "The unique identifier of the environment associated with this subscriber."
    },
    "deleted": {
      "type": "boolean",
      "description": "Indicates whether the subscriber has been deleted."
    },
    "createdAt": {
      "type": "string",
      "description": "The timestamp indicating when the subscriber was created, in ISO 8601 format."
    },
    "updatedAt": {
      "type": "string",
      "description": "The timestamp indicating when the subscriber was last updated, in ISO 8601 format."
    }
  },
  "required": [
    "subscriberId",
    "_organizationId",
    "_environmentId",
    "deleted",
    "createdAt",
    "updatedAt"
  ]
}