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

# Messaging and Alerting

export const LwTemplate = ({title = "Key questions to get you started", icon = "sparkles", cta = "Powered by Agent Studio", linkHref = "https://lucidworks.com/demo/?utm_source=docs&utm_medium=referral&utm_campaign=docs_cta_ai"}) => {
  const [isLoaded, setIsLoaded] = useState(false);
  useEffect(() => {
    const timer = setTimeout(() => {
      setIsLoaded(true);
    }, 500);
    return () => clearTimeout(timer);
  }, []);
  return <div className="lw-template-container">
      <Card title={title} icon={icon}>
        {isLoaded && <span dangerouslySetInnerHTML={{
    __html: `<lw-template id="a029c1a9-28be-427e-b0e1-5d918920246a"></lw-template
            >`
  }} />}
        <Link href={linkHref} className="agent-studio-link text-left text-gray-600 gap-2 dark:text-gray-400 text-sm font-medium flex flex-row items-center hover:text-primary dark:hover:text-primary-light group-hover:text-primary group-hover:dark:text-primary-light">Powered by Lucidworks Agent Studio</Link>
      </Card>
    </div>;
};

[localhost link]: http://localhost:3000/docs/4/fusion-server/concepts/system/monitoring/messaging-services

[mintlify link]: https://doc.lucidworks.com/docs/4/fusion-server/concepts/system/monitoring/messaging-services

[old doc.lw link]: https://doc.lucidworks.com/fusion/5.9/135

Fusion’s messaging services provide implementations to send messages and alerts to any application or device capable of displaying the supported message types. Read a primer on Fusion’s messaging services on our
[blog](https://lucidworks.com/post/alerts-lucidworks-fusion//).

<LwTemplate />

## Supported Message Types

Fusion supports these types of messages and alerts:

* **logging**

  This service logs any message sent to it in the configured logger. You can use it in an [index pipeline](/docs/4/fusion-server/reference/pipeline-stages/indexing/logging-message-index-stage) or a [query pipeline](/docs/4/fusion-server/reference/pipeline-stages/query/logging-query-stage).
* **Slack**

  [Slack](http://www.slack.com) is a team messaging service with document integration and a focus on collaborative communication. See the [Slack Index Stage](/docs/4/fusion-server/reference/pipeline-stages/indexing/slack-index-stage) and the [Slack Query Stage](/docs/4/fusion-server/reference/pipeline-stages/query/slack-query-stage).
* **SMTP**

  Email, via the Simple Mail Transfer Protocol. See the [Email Index Stage](/docs/4/fusion-server/reference/pipeline-stages/indexing/email-index-stage) and the [Email Query Stage](/docs/4/fusion-server/reference/pipeline-stages/query/email-query-stage).
* **PagerDuty**

  Alerting and monitoring. See the [PagerDuty Index Stage](/docs/4/fusion-server/reference/pipeline-stages/indexing/pagerduty-index-stage) and the [PagerDuty Query Stage](/docs/4/fusion-server/reference/pipeline-stages/query/pagerduty-query-stage).

## Messaging Service Configuration

The Message Services as a whole can be configured via the [Configurations API](/docs/4/fusion-server/reference/api/system-admin-apis/configurations-api) with these attributes:

| Attribute          | Description                                                                                                                                                                                                                                                                                                          |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `rateLimit`        | The time, in milliseconds, to wait between sending messages on a per-second basis. This does not synchronize throttling between requests.                                                                                                                                                                            |
| `storeAllMessages` | Boolean flag that indicates whether messages should be indexed and stored. By default, only scheduled messages are stored, as they need to be retrieved by the scheduler at a later time. Storing all messages can be useful for auditing the system, but it will have an impact on the system storage requirements. |

### Enabling Messaging Services

The logging service is enabled by default, but messaging services must be explicitly enabled.

You can do this through the UI at **System > System > Messaging Services**, or through the [Messaging API](/docs/4/fusion-server/reference/api/messaging-api).

**How to see which messaging services are currently enabled:**

```bash wrap  theme={"dark"}
curl -u USERNAME:PASSWORD http://localhost:8764/api/messaging/service
```

### String Templates

String templates are libraries used for structured text generation outputs. They are a powerful way of doing variable substitution into a provided template using values contained in documents, requests, and contexts. String templates are made available in the Messaging Service System setup, where users can fill in these portions with document or query values from the working system.

See [Messaging Services Templates](/docs/4/fusion-server/reference/template-expressions/messaging-service-variables) for details.

## Triggering Messages and Alerts

The messaging services can be invoked in several ways:

* Via the [Scheduler API](/docs/4/fusion-server/reference/api/scheduler-api) to send messages at designated intervals.
* Via the [Messaging API](/docs/4/fusion-server/reference/api/messaging-api).
* Through an index or query pipeline; see [Messaging and Alerting Pipeline Stages](#messaging-and-alerting-pipeline-stages) below.

<Note>
  By default, only scheduled messages are stored. To configure Fusion to store all messages, see [Messaging Service Configuration](#messaging-service-configuration) above. The default collection for message storage is system\_messages, which is created on startup.
</Note>

### Messaging and Alerting Pipeline Stages

The Messaging Service supports these pipeline stages:

* [Email Message Query Stage](/docs/4/fusion-server/reference/pipeline-stages/query/email-query-stage)
* [Email Message Index Stage](/docs/4/fusion-server/reference/pipeline-stages/indexing/email-index-stage)
* [PagerDuty Message Query Stage](/docs/4/fusion-server/reference/pipeline-stages/query/pagerduty-query-stage)
* [PagerDuty Message Index Stage](/docs/4/fusion-server/reference/pipeline-stages/indexing/pagerduty-index-stage)
* [Slack Message Query Stage](/docs/4/fusion-server/reference/pipeline-stages/query/slack-query-stage)
* [Slack Message Index Stage](/docs/4/fusion-server/reference/pipeline-stages/indexing/slack-index-stage)
* [SetPropertyIndex Stage](/docs/4/fusion-server/reference/pipeline-stages/indexing/set-property-index-stage)

The pipeline stages above send messages and alerts when specific conditions are met. Conditions can be specified using regular expressions, database lookups, and more. Any upstream stage can affect how Fusion behaves when a match occurs, so pay special attention to the order in which stages occur.

Additionally, the Set Property Index Stage allows conditions to be specified before messages are sent.

### Setting Properties Upstream

Fusion includes two index pipeline stages that are useful for setting properties on indexed documents so that you can evaluate those properties in one of the messaging stages, either downstream in the index pipeline or in a query pipeline:

* The [Set Property Index Stage](/docs/4/fusion-server/reference/pipeline-stages/indexing/set-property-index-stage) can be used to set a property on a document, or a context, by evaluating one or more simple conditions. It is an index-only, conditional stage that allows the setting of properties without the use of JavaScript.
* The [JavaScript Index Stage](/docs/4/fusion-server/reference/pipeline-stages/indexing/javascript-index-stage) provides a more sophisticated means of setting properties upstream from the messaging stages.
