<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
        SYSTEM "https://resources.jetbrains.com/writerside/1.0/xhtml-entities.dtd">
<topic xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/topic.v2.xsd"
       title="Send a test progress alert for a department goal" id="sendDepartmentGoalProgressAlertTest">

    <!-- AUTO-GENERATED, DO NOT EDIT -->
    <p>This endpoint documentation is generated directly from <code>openapi.yaml</code>.</p>
    <chapter title="Endpoint" id="endpoint">
        <code-block lang="http">POST /goals/department/progress-alert/test</code-block>
    </chapter>
    <chapter title="Operation" id="operation">
        <p>Operation ID: <code>sendDepartmentGoalProgressAlertTest</code></p>
        <p>Sends a progress alert for a department goal to the destination defined in the goal&#x27;s criteria.

Permission required: `goals_department_progress_alert_test`.

Access control:
- The caller must be a superuser or belong to all departments targeted by the goal.

Behavior:
- Looks up the goal by `id`.
- Rebuilds the criteria from stored JSON and attaches the goal&#x27;s departments.
- Renders the alert using the server-side renderer (respecting progress type/style/format and destination limits).
- Sends the alert to Slack, Email, or SMS depending on `progress_alert_destination`, unless overridden.
</p>
    </chapter>
    <chapter title="Authentication" id="authentication">
        <p>Security requirements:</p>
        <table>
            <tr><td>Scheme</td><td>Scopes</td></tr>
            <tr><td>BearerAuth</td><td>-</td></tr>
        </table>
    </chapter>
    <chapter title="Request Body" id="request-body">
        <p>Required: yes.</p>
        <p>Content type: <code>application/json</code></p>
        <code-block lang="json">
{
  &quot;properties&quot;: {
    &quot;department_id&quot;: {
      &quot;description&quot;: &quot;Department id to use that department&#x27;s Slack webhook when destination is SLACK&quot;,
      &quot;example&quot;: 3,
      &quot;type&quot;: &quot;integer&quot;
    },
    &quot;email_to&quot;: {
      &quot;description&quot;: &quot;Email recipient when destination is EMAIL&quot;,
      &quot;example&quot;: &quot;tester@example.com&quot;,
      &quot;format&quot;: &quot;email&quot;,
      &quot;type&quot;: &quot;string&quot;
    },
    &quot;id&quot;: {
      &quot;description&quot;: &quot;The department goal id&quot;,
      &quot;example&quot;: 42,
      &quot;type&quot;: &quot;integer&quot;
    },
    &quot;overrideDestination&quot;: {
      &quot;description&quot;: &quot;Override the destination for this test&quot;,
      &quot;enum&quot;: [
        &quot;SLACK&quot;,
        &quot;EMAIL&quot;,
        &quot;SMS&quot;,
        &quot;NONE&quot;
      ],
      &quot;example&quot;: &quot;SLACK&quot;,
      &quot;type&quot;: &quot;string&quot;
    },
    &quot;slack_webhook&quot;: {
      &quot;description&quot;: &quot;Slack webhook URL when destination is SLACK&quot;,
      &quot;example&quot;: &quot;https://hooks.slack.com/services/T000/B000/XXX&quot;,
      &quot;type&quot;: &quot;string&quot;
    },
    &quot;sms_to&quot;: {
      &quot;description&quot;: &quot;One or more MSISDN recipients when destination is SMS&quot;,
      &quot;oneOf&quot;: [
        {
          &quot;description&quot;: &quot;Comma or semicolon separated list&quot;,
          &quot;example&quot;: &quot;+4512345678, +4598765432&quot;,
          &quot;type&quot;: &quot;string&quot;
        },
        {
          &quot;example&quot;: [
            &quot;+4512345678&quot;,
            &quot;+4598765432&quot;
          ],
          &quot;items&quot;: {
            &quot;type&quot;: &quot;string&quot;
          },
          &quot;type&quot;: &quot;array&quot;
        }
      ]
    },
    &quot;subject&quot;: {
      &quot;description&quot;: &quot;Optional email subject when destination is EMAIL&quot;,
      &quot;example&quot;: &quot;Dept Goal Progress Test&quot;,
      &quot;type&quot;: &quot;string&quot;
    }
  },
  &quot;required&quot;: [
    &quot;id&quot;
  ],
  &quot;type&quot;: &quot;object&quot;
}
        </code-block>
    </chapter>
    <chapter title="Responses" id="responses">
        <table>
            <tr><td>Status</td><td>Description</td><td>Content Types</td></tr>
            <tr><td>200</td><td>Alert sent successfully</td><td>application/json</td></tr>
            <tr><td>400</td><td></td><td></td></tr>
            <tr><td>401</td><td></td><td></td></tr>
            <tr><td>403</td><td></td><td></td></tr>
            <tr><td>404</td><td></td><td></td></tr>
            <tr><td>500</td><td></td><td></td></tr>
        </table>
        <p>Schema for response <code>200</code> (<code>application/json</code>):</p>
        <code-block lang="json">
{
  &quot;properties&quot;: {
    &quot;destination&quot;: {
      &quot;description&quot;: &quot;Final destination used&quot;,
      &quot;enum&quot;: [
        &quot;SLACK&quot;,
        &quot;EMAIL&quot;,
        &quot;SMS&quot;,
        &quot;NONE&quot;
      ],
      &quot;type&quot;: &quot;string&quot;
    },
    &quot;id&quot;: {
      &quot;description&quot;: &quot;Goal id&quot;,
      &quot;type&quot;: &quot;integer&quot;
    },
    &quot;message_preview&quot;: {
      &quot;description&quot;: &quot;Rendered message preview&quot;,
      &quot;type&quot;: &quot;string&quot;
    },
    &quot;provider_response&quot;: {
      &quot;description&quot;: &quot;Provider-specific response or status message&quot;
    },
    &quot;target&quot;: {
      &quot;description&quot;: &quot;The target used for delivery (email address, phone numbers, department id, or webhook)&quot;
    }
  },
  &quot;type&quot;: &quot;object&quot;
}
        </code-block>
    </chapter>
</topic>
