---
title: "Pipelines"
description: "On this page you will learn what pipelines are, how they run, which steps are available, and how to apply a pipeline to your routing."
canonical: "https://docs.cm.com/conversational-router/guides/pipelines"
---

# Pipelines

> On this page you will learn what pipelines are, how they run, which steps are available, and how to apply a pipeline to your routing.

Source: https://docs.cm.com/conversational-router/guides/pipelines

## Overview

A pipeline is a set of processing steps applied to messages as they travel over a route within a state. Pipelines let the Router protect and prepare traffic on its way to a destination:

- **Protect** your agents and applications from spam, malware, malicious links, abusive language, and leaked credentials.
- **Understand** each message by detecting its language, extracting the details you care about, and scoring its sentiment.
- **Transform** the message before delivery by redacting personal data or translating it into the language your team works in.

Pipelines are managed on the **Pipelines** page and attached to individual routes in the flow editor, so different routes can process messages differently. For example, you can translate only what goes to your agents, and redact personal data only on the route to an external AI service.

\[Pipelines overview]

## The steps at a glance

| Step | Type | What it does | Settings |
| - | - | - | - |
| [Spam detection](https://docs.cm.com/conversational-router/guides/pipeline-guards#spam-detection) | Guard | Quarantines spam, judged over the whole conversation. | None |
| [Virus scan](https://docs.cm.com/conversational-router/guides/pipeline-guards#virus-scan) | Guard | Scans attachments for malware. | Remove the attachment or quarantine the message |
| [URL reputation](https://docs.cm.com/conversational-router/guides/pipeline-guards#url-reputation) | Guard | Neutralises suspicious and known-malicious links. | Whether known-malicious links quarantine the message |
| [Profanity](https://docs.cm.com/conversational-router/guides/pipeline-guards#profanity) | Guard | Masks abusive and harmful language. | Categories to look for |
| [Data loss prevention](https://docs.cm.com/conversational-router/guides/pipeline-guards#data-loss-prevention) | Guard | Masks secrets and credentials. | None |
| [Language identification](https://docs.cm.com/conversational-router/guides/pipeline-enrichment-steps#language-identification) | Enrichment | Detects the language of each message. | Default language |
| [Named entity extraction](https://docs.cm.com/conversational-router/guides/pipeline-enrichment-steps#named-entity-extraction) | Enrichment | Pulls out the details you define, such as order numbers. | Entities to extract, and the metadata field for each |
| [Sentiment analysis](https://docs.cm.com/conversational-router/guides/pipeline-enrichment-steps#sentiment-analysis) | Enrichment | Classifies the tone of each message. | Optional metadata field name |
| [CXP enrichment](https://docs.cm.com/conversational-router/guides/pipeline-enrichment-steps#cxp-enrichment) | Enrichment | Sends the extracted entities and sentiment to the CXP. | None |
| [PII redaction](https://docs.cm.com/conversational-router/guides/pipeline-transformation-steps#pii-redaction) | Transformation | Replaces personal data with placeholders. | Types of personal data to redact |
| [Translation](https://docs.cm.com/conversational-router/guides/pipeline-transformation-steps#translation) | Transformation | Translates messages between your customers' language and yours. | Customer language and your team's language |

## How a pipeline runs

### Fixed order

The order in which steps run is decided by the Router, not by the order you add them in. Steps are grouped into stages. Stages run one after another, and the steps inside a stage run at the same time.

| Stage | Steps | Why here |
| - | - | - |
| 1 | Spam detection, Profanity | These guards judge the message as it was written, so they run first and spam detection can stop it before anything else happens. |
| 2 | URL reputation, Virus scan | The two guards that take the most work, following links and scanning attachments, run only on messages that spam detection let through. URL reputation rewrites links, and Virus scan looks at attachments instead of text. |
| 3 | Data loss prevention | Masks secrets before any later step sees the text. |
| 4 | Language identification, Named entity extraction, Sentiment analysis, CXP enrichment | Read the message and add information to it without changing it. |
| 5 | PII redaction | Rewrites the message. |
| 6 | Translation | Rewrites the message. Runs last so the delivered text is in the language your team reads. |

Two consequences are worth knowing:

- Steps that analyse the message (stage 4) see the text after links have been neutralised and secrets masked, but before personal data is redacted and before translation.
- Redaction runs before translation, so translation only ever sees the placeholders, never the personal data itself.

### Quarantine stops the pipeline

When a guard quarantines a message, the pipeline stops immediately: no later step runs and the message is not delivered to the destination. The message and the reason it was quarantined stay visible in the [Explorer](https://docs.cm.com/conversational-router/guides/explorer).

### One of each step

Each step type can be added to a pipeline once. A pipeline that uses translation in auto-detect mode must also include Language identification, because translation needs to know which language the customer wrote in. If you pin the customer's language in the translation step, Language identification is not needed.

### Which messages are processed

- Pipelines process messages that travel over the route. Conversation events, such as the start or end of a session, are passed along untouched.
- Steps look at text. For emails, the whole body is processed, including tables and signatures.
- Virus scan looks at attachments instead of text.
- Spam detection judges messages sent by your customers only.
- Translation works in both directions: customer messages are translated to your team's language, and replies are translated back into the customer's language.

### Delivery comes first

A pipeline should never be the reason a conversation stalls. If the pipeline as a whole cannot complete, for example because a processing service is temporarily unavailable, the message is still delivered, without the processing that could not run. The problem is recorded with the run, and you can see which steps ran in the [Explorer](https://docs.cm.com/conversational-router/guides/explorer).

The exception is content that cannot be vouched for: an attachment that could not be scanned is not delivered.

### Channels that stream messages

Some channels deliver messages in live parts as they are being written, for example Web Conversations with an AI agent. When a route's pipeline can change or withhold a message (every step except Language identification, Named entity extraction, Sentiment analysis and CXP enrichment), the live parts are held back and the recipient receives the finished, processed message instead. This guarantees nobody sees text that a step would have changed or blocked.

## Managing pipelines

- **Add pipeline** creates a new pipeline and opens the editor.
- Click a pipeline, or choose **Edit** in its Actions menu, to edit it. The Actions menu also offers **Delete**.

## Editing a pipeline

The editor shows the pipeline's steps as a timeline, in the order they run. Steps are placed in their stage automatically, so a step you add later can appear above earlier ones. Select a step to see and change its settings in a tab in the panel on the right. Click **Save** to save the pipeline.

\[Pipeline editor with a guard step selected]

Click **Add step** to add a step type:

\[Add step dialog]

Steps that need another step show which one. Steps you have already added are not offered again. The **Pricing details** tab in the panel on the right shows what the pipeline costs. See [Billing](#billing).

## Applying a pipeline

A pipeline is attached to a **route** inside a state. In the flow editor each state is a table, and each row is a route with a source, a direction (**One way**, **Both ways** or **Stop**) and a destination:

1. Open the flow on the **Flows** page. Each state is shown as its own table of routes.
2. In the row of the route you want, click the cog wheel at the end of the row. A tab for that route opens in the panel on the right.
3. Under **Pipeline**, select the pipeline to apply from the dropdown. Select **None** to remove it.
4. Click **Save** to save the flow.

The cog wheel is shown once both ends of the route are set. Routes that carry calls have no cog wheel, because pipelines only process messages. A route that goes both ways shows one dropdown per direction, so you can apply a different pipeline to each direction, or to only one of them. Once a pipeline is selected, the panel shows its steps and a button to open it.

Messages travelling over that route, and only that route, are processed by the pipeline. One pipeline can be attached to as many routes as you like, and each direction of a route can only have one pipeline. A pipeline on one direction does not process traffic on the other.

When you open a pipeline on the **Pipelines** page, **Where this pipeline runs** lists the flows and routes it is attached to.

## Reading the results

Each step leaves a trace you can use.

### In the Explorer

Open a conversation in the [Explorer](https://docs.cm.com/conversational-router/guides/explorer) and expand the routing detail of a message. For every destination it shows:

- the text that was actually delivered, next to the original,
- each step that ran and what it found, such as the detected language, the entities extracted, or what a guard acted on,
- whether a guard quarantined the message.

The routing detail is headed by the flow and state, and says _Routed to 1 destination_ or _Routed to N destinations_. Each destination shows its delivered text, a **Blocked** tag when a guard quarantined the message, and a **Pipeline** list with one line per step that ran. A step that could not complete is marked **Failed**. The line of each step says what it found:

| Step | What the Explorer shows |
| - | - |
| Spam guard | The signals behind a quarantine, or, when nothing was quarantined, the observations and scores recorded, or _None_. |
| Antivirus guard | _Clean_, _Infected_ with the threat names, _Skipped (no attachment)_, or _Anti-Virus unexpected error_. |
| Url guard | _No URLs found_, or whether links were checked or flagged. |
| Profanity guard | The number of masked passages, or _None_. |
| Data loss prevention guard | The kinds of secrets masked, or _None_. |
| Language identification | `Language: Dutch`. |
| Named entity extraction | `Entities found: 2`. |
| Sentiment analysis | Positive, Neutral or Negative. |
| PII redaction | `Redacted: 2 phone numbers, 1 name`, or _Nothing detected_. |
| Translation | `Translated Dutch -> English`, or _No translation needed_. |

Besides the Explorer, the History API reports an outcome for every delivery: `delivered`, `translated`, `redacted`, `filtered` or `blocked`. When more than one applies, the most severe wins, in that order from `blocked` down to `translated`.

### On the delivered message

Steps that detect something attach their findings to the message that is delivered, so the destination can use them: the detected language, the entities extracted, the sentiment, the redactions with their original values, and, for translated messages, the original text.

### As conversation metadata

Named entity extraction and Sentiment analysis can store what they found in a metadata field that you name. The values are saved on the conversation, so they are available beyond the single message.

## Example pipelines

**Agents who speak one language, customers who speak many.** Add Language identification and Translation. Customer messages arrive in your team's language, and agent replies reach each customer in theirs.

**Safe inbox for an email channel.** Add Spam detection, Virus scan and URL reputation. Spam is quarantined, infected attachments are removed, and links that look malicious are made unclickable before an agent sees them.

**Sending to an external AI service.** Add Data loss prevention and PII redaction on the route to the AI service, so credentials and personal data are masked in the message text before it is delivered. Keep in mind that the original personal values still travel with the message as enrichment (see [PII redaction](https://docs.cm.com/conversational-router/guides/pipeline-transformation-steps#pii-redaction)), so use this setup for services that read the message text.

**Routing on what the customer wrote.** Add Named entity extraction for an order number and Sentiment analysis, and store both in metadata fields to use them downstream.

## Billing

Steps are billed per thousand units, and only when they are executed. Most steps are billed per message; Virus scan is billed per attachment scanned. A step that does not run is not billed: once a guard quarantines a message, the steps in later stages are not executed or billed. For example, when Spam detection quarantines an email, its attachments are not scanned and no Virus scan is billed. Language identification is free when the same pipeline also contains Translation. The editor shows the price of each step under **Pricing details**.

## Next steps

- [Guard steps](https://docs.cm.com/conversational-router/guides/pipeline-guards): spam, virus, URL, profanity and data loss prevention.
- [Detection and enrichment steps](https://docs.cm.com/conversational-router/guides/pipeline-enrichment-steps): language, entities, sentiment and CXP.
- [Transformation steps](https://docs.cm.com/conversational-router/guides/pipeline-transformation-steps): PII redaction and translation.
