> ## Documentation Index
> Fetch the complete documentation index at: https://docs.p36-csq.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Notifications

> Configure custom notifications for deviations and events

## Overview

In the notification section, you can configure how you are notified in case of deviations that occur during continuous qualification of the cloud services in your use case. As an Admin user or Use Case Designer, you can configure individual notifications to be triggered in such cases.

<Info>
  Notifications help you stay informed about critical events and deviations in
  real-time, ensuring prompt response to issues.
</Info>

## Notification Types

The CSQ Platform supports two main types of notifications:

<CardGroup cols={2}>
  <Card title="HTTP(S) Notifications" icon="globe">
    Send structured data to external systems via HTTP/HTTPS requests
  </Card>

  <Card title="Email Notifications" icon="mail">
    Send formatted email alerts to specified recipients
  </Card>
</CardGroup>

## HTTP(S) Notifications

Configure webhook-style notifications to integrate with external systems.

<Tabs>
  <Tab title="Creating HTTPS Notifications">
    ### Adding a New HTTPS Notification

    <Steps>
      <Step title="Add Notification">
        Click the ➕ icon to add a new notification or select an existing notification for editing
      </Step>

      <Step title="Configure Core Attributes">
        * Set the **Name** and **TID** (Technical Identifier)
        * Set **Request Type** to "HTTPS Request"
        * Use the toggle switch for **Is active** to enable or disable
      </Step>

      <Step title="Set Trigger Configuration">
        * Specify trigger events (e.g., Deviation Creation, Deviation Update)
        * Select applicable risk classes (High, Medium, Low)
      </Step>

      <Step title="Configure Request Settings">
        * Choose authentication method from dropdown
        * Fill out **Request URL** with destination endpoint
        * Select **Request Method** (POST, GET, etc.)
        * Specify **Content Type** (e.g., application/json)
        * Enter request **Body** using JSON format
      </Step>
    </Steps>

    ### HTTPS Request Configuration

    ```json theme={null}
    {
      "event": "deviation_created",
      "deviation": {
        "id": "{{deviation.id}}",
        "status": "{{deviation.status}}",
        "service": "{{deviation.service}}"
      },
      "useCase": {
        "name": "{{useCase.name}}",
        "id": "{{useCase.id}}"
      },
      "risks": [
        {
          "level": "{{risk.level}}",
          "description": "{{risk.description}}"
        }
      ]
    }
    ```

    <Note>
      Use the Structure and Syntax views to validate the payload format and ensure all required fields are properly populated with dynamic values.
    </Note>
  </Tab>

  <Tab title="Authentication Methods">
    ### Available Authentication Options

    * **No Authentication**: For open endpoints
    * **OAuth 2.0**: Standard OAuth authentication
    * **Basic Authentication**: Username/password combination

    ### Security Best Practices

    <Warning>
      Always use HTTPS endpoints when transmitting sensitive notification data to ensure secure communication.
    </Warning>

    * Store credentials securely
    * Use least-privilege access principles
    * Regularly rotate authentication tokens
    * Monitor notification delivery logs
  </Tab>

  <Tab title="Payload Structure">
    ### Dynamic Field Mapping

    The notification payload can include dynamic fields that are automatically populated:

    | Field Category        | Available Variables                                               |
    | --------------------- | ----------------------------------------------------------------- |
    | **Event Information** | `{{event.type}}`, `{{event.timestamp}}`                           |
    | **Deviation Data**    | `{{deviation.id}}`, `{{deviation.status}}`, `{{deviation.count}}` |
    | **Use Case Info**     | `{{useCase.name}}`, `{{useCase.id}}`, `{{useCase.version}}`       |
    | **Risk Details**      | `{{risk.level}}`, `{{risk.priority}}`, `{{risk.description}}`     |
    | **Service Data**      | `{{service.name}}`, `{{service.type}}`, `{{service.status}}`      |

    ### Validation Tools

    * **Structure View**: Check JSON structure and syntax
    * **Syntax Validation**: Ensure proper formatting
    * **Test Payload**: Validate with sample data
  </Tab>
</Tabs>

## Email Notifications

Configure email alerts for deviation events and qualification updates.

<Tabs>
  <Tab title="Creating Email Notifications">
    ### Setting Up Email Notifications

    <Steps>
      <Step title="Add Email Notification">
        Use the ➕ icon to create a new email notification or select an existing one for editing
      </Step>

      <Step title="Configure Core Attributes">
        * Define the **Name** and **TID**
        * Set **Request Type** to "Email Request"
        * Enable or disable using the **Is active** toggle
      </Step>

      <Step title="Set Trigger Events">
        Select trigger events:

        * Deviation Creation
        * Deviation Update
        * Deviation Resolution
        * Qualification Status Changes
      </Step>

      <Step title="Configure Risk Classes">
        Choose applicable risk classes that should trigger the notification:

        * High Risk
        * Medium Risk
        * Low Risk
      </Step>
    </Steps>
  </Tab>

  <Tab title="Email Configuration">
    ### Email Request Settings

    #### Notification Recipients

    * Specify multiple email addresses separated by commas
    * Support for distribution lists
    * Role-based recipient selection

    #### Email Content Configuration

    * **Notification Subject**: Dynamic subject line with variables
    * **Notification Template (HTML)**: Custom HTML content for email body
    * **Send HTML emails**: Toggle to enable/disable HTML formatting
    * **Include Evidence**: Option to attach evidence files

    ### Email Template Example

    ```html theme={null}
    <!DOCTYPE html>
    <html>
    <head>
        <title>CSQ Deviation Alert</title>
    </head>
    <body>
        <h2>Deviation Alert: {{deviation.id}}</h2>
        <p><strong>Use Case:</strong> {{useCase.name}}</p>
        <p><strong>Service:</strong> {{service.name}}</p>
        <p><strong>Risk Level:</strong> {{risk.level}}</p>
        <p><strong>Description:</strong> {{deviation.description}}</p>
        <p><strong>Timestamp:</strong> {{event.timestamp}}</p>
    </body>
    </html>
    ```
  </Tab>

  <Tab title="Advanced Options">
    ### Email Features

    <CardGroup cols={2}>
      <Card title="HTML Templates" icon="code">
        Create rich, formatted email content with HTML templates
      </Card>

      <Card title="Evidence Attachments" icon="paperclip">
        Include test execution evidence and logs as attachments
      </Card>

      <Card title="Dynamic Content" icon="wand-sparkles">
        Use variables to personalize email content with real-time data
      </Card>

      <Card title="Delivery Tracking" icon="chart-line">
        Monitor email delivery status and engagement metrics
      </Card>
    </CardGroup>

    ### Template Variables

    Use these variables in your email templates:

    ```html theme={null}
    Subject: [CSQ Alert] Deviation in {{useCase.name}} - {{risk.level}} Risk

    Body:
    Dear Team,

    A {{risk.level}} risk deviation has been detected:
    - Use Case: {{useCase.name}}
    - Service: {{service.name}}
    - Deviation ID: {{deviation.id}}
    - Occurrence Time: {{event.timestamp}}

    Please review and take appropriate action.
    ```
  </Tab>
</Tabs>

## Best Practices

<CardGroup cols={2}>
  <Card title="Notification Strategy" icon="target">
    Design different notification strategies for different risk levels and
    audiences
  </Card>

  <Card title="Avoid Spam" icon="shield-check">
    Configure appropriate filtering to prevent notification overload
  </Card>

  <Card title="Test Thoroughly" icon="flask-conical">
    Test all notification configurations before deploying to production
  </Card>

  <Card title="Monitor Delivery" icon="eye">
    Regularly check notification delivery status and effectiveness
  </Card>
</CardGroup>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Notifications Not Sending">
    * Verify notification is marked as "Active"
    * Check trigger configuration matches actual events
    * Validate authentication credentials
    * Review network connectivity and firewall settings
  </Accordion>

  {" "}

  <Accordion title="Email Delivery Issues">
    * Confirm recipient email addresses are correct - Check spam/junk folders -
      Verify SMTP configuration if using custom email server - Review email
      formatting and template syntax
  </Accordion>

  <Accordion title="HTTP/HTTPS Request Failures">
    * Validate endpoint URL and availability
    * Check authentication method and credentials
    * Review request payload format and structure
    * Verify SSL/TLS certificate validity for HTTPS endpoints
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Reporting" icon="chart-bar" href="/use-cases/reporting">
    Set up reports to complement your notifications
  </Card>

  <Card title="Dashboard" icon="layout-dashboard" href="/dashboard/overview">
    Monitor deviations and qualification status from the dashboard
  </Card>
</CardGroup>
