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

# Setting up Automation Rules

> Guide to set up automation rules in Periskope

## Components

Automation rules consist of three main components that need to be set up:

1. Triggers
2. Conditions
3. Actions

## Setting up Automation Rules

<Steps>
  <Step title="Add new rule">
    1. Go to the Automation Rules page in Periskope.

    <Frame caption="Automation Rules">
      <img className="block border rounded-xl shadow mt-4 mx-auto" src="https://mintcdn.com/bharatkumarramesh/n6-6KkopVbLMcGqC/images/automationrulesetup.png?fit=max&auto=format&n=n6-6KkopVbLMcGqC&q=85&s=82735b63fe6f1ab18c2478e96ae5af19" alt="Automation Rules" width="90%" data-path="images/automationrulesetup.png" />
    </Frame>

    2. Click on the "+ New Rule" button. You can also add a rule by pre-filled templates available on the screen.

    <Frame caption="New Rule">
      <img className="block border rounded-xl shadow mt-4 mx-auto" src="https://mintcdn.com/bharatkumarramesh/n6-6KkopVbLMcGqC/images/rulesetupnew.png?fit=max&auto=format&n=n6-6KkopVbLMcGqC&q=85&s=ad567e3de8177c95e2cf3086ac7f0f44" alt="Automation Rules" width="90%" data-path="images/rulesetupnew.png" />
    </Frame>

    A total of 18 different preset templates that can be set up in just a few minutes, divided into 6 buckets:

    1. Automated Ticketing
    2. Automated Replies
    3. Automated Assignments
    4. Automated Flagging
    5. Automated Escalation
    6. Automated Notifications

    <Frame caption="Automation Rule Templates">
      <img className="block border rounded-xl shadow mt-4 mx-auto" src="https://mintcdn.com/bharatkumarramesh/n6-6KkopVbLMcGqC/images/PopularTemplates.png?fit=max&auto=format&n=n6-6KkopVbLMcGqC&q=85&s=dc107610ee066ba77c1052d641bd0a4b" alt="Automation Rules" width="90%" data-path="images/PopularTemplates.png" />
    </Frame>
  </Step>

  <Step title="Add Rule name">
    On the top of the rule setup page, add a name for the rule.

    <Frame caption="Set up a Name">
      <img className="block border rounded-xl shadow mt-4 mx-auto" src="https://mintcdn.com/bharatkumarramesh/n6-6KkopVbLMcGqC/images/AutomationRuleName.png?fit=max&auto=format&n=n6-6KkopVbLMcGqC&q=85&s=f4ac61ed7423ccd7ad02c30fe39294c3" alt="Automation Rules" width="90%" data-path="images/AutomationRuleName.png" />
    </Frame>
  </Step>

  <Step title="Choose a Trigger">
    In the "Trigger" section, select the event from the window that will initiate the rule. For example, "New Message Received."

    <Frame caption="Available triggers">
      <img className="block border rounded-xl shadow mt-4 mx-auto" src="https://mintcdn.com/bharatkumarramesh/n6-6KkopVbLMcGqC/images/AutomationRuleTrigger.png?fit=max&auto=format&n=n6-6KkopVbLMcGqC&q=85&s=326143bb4f23e45215572b2ff49f3795" alt="Automation Rules" width="90%" data-path="images/AutomationRuleTrigger.png" />
    </Frame>
  </Step>

  <Step title="Add conditions">
    Define the conditions that must be met for the rule to execute. You can add multiple conditions using logical operators like AND, OR, and nested conditions.

    <Frame caption="Choose Condition(s)">
      <img className="block border rounded-xl shadow mt-4 mx-auto" src="https://mintcdn.com/bharatkumarramesh/n6-6KkopVbLMcGqC/images/AutomationRuleConditions.png?fit=max&auto=format&n=n6-6KkopVbLMcGqC&q=85&s=081f855472f690798dc340b8ba6e72a2" alt="Conditions" width="90%" data-path="images/AutomationRuleConditions.png" />
    </Frame>

    <Note>
      You can also add `delays` before evaluating the conditions to allow for time-based criteria.
    </Note>

    <Frame>
      <img className="block border rounded-xl shadow mt-4 mx-auto" src="https://mintcdn.com/bharatkumarramesh/n6-6KkopVbLMcGqC/images/AutomationRuleConditionTime.png?fit=max&auto=format&n=n6-6KkopVbLMcGqC&q=85&s=1fb8a3a41a342958ceb1bb9c045a318b" alt="Conditions" width="90%" data-path="images/AutomationRuleConditionTime.png" />
    </Frame>

    <Tip>
      For example, you can create a condition that checks if the message contains specific keywords and is received from a specific user.
    </Tip>
  </Step>

  <Step title="Add actions">
    Specify the actions that will be executed when the conditions are met. You can add multiple actions and set delays for each action.

    <Frame caption="Actions">
      <img className="block border rounded-xl shadow mt-4 mx-auto" src="https://mintcdn.com/bharatkumarramesh/n6-6KkopVbLMcGqC/images/AutomationRuleActions.png?fit=max&auto=format&n=n6-6KkopVbLMcGqC&q=85&s=60af023b69aa9a5a0d9508634e42b218" alt="Actions" width="90%" data-path="images/AutomationRuleActions.png" />
    </Frame>
  </Step>

  <Step title="Save and Publish">
    Save the rule and publish it to start automating the workflow.

    <Frame caption="Save & Publish">
      <img className="block border rounded-xl shadow mt-4 mx-auto" src="https://mintcdn.com/bharatkumarramesh/n6-6KkopVbLMcGqC/images/AutomationRuleSavePublish.png?fit=max&auto=format&n=n6-6KkopVbLMcGqC&q=85&s=08b73b2a93c77668d26e4ddd0a694a71" alt="Automation Rules" width="90%" data-path="images/AutomationRuleSavePublish.png" />
    </Frame>
  </Step>
</Steps>

## Example: Automated replies on message with keywords (urgent, important) 📃

Let's consider an example of setting up an automation rule:

**Scenario**: Automatically send a message if a new message is received and contains certain keywords.

<Steps>
  <Step title="Define the Trigger">
    1. Select "New Message Received" as the trigger.
  </Step>

  <Step title="Set the Conditions">
    Define a condition: Check if the message contains specific keywords, e.g., urgent, help.

    Use logical operators if needed: For example, message contains 'urgent' OR 'important'.

    Optionally, set a delay before checking the condition (e.g., 5 minutes).

    <Frame caption="Choose Condition(s)">
      <img className="block border rounded-xl shadow mt-4 mx-auto" src="https://mintcdn.com/bharatkumarramesh/n6-6KkopVbLMcGqC/images/ExampleConditions.png?fit=max&auto=format&n=n6-6KkopVbLMcGqC&q=85&s=f4316d4160830fbab84cdbe3180e81c6" alt="Conditions" width="90%" data-path="images/ExampleConditions.png" />
    </Frame>
  </Step>

  <Step title="Add Actions">
    Select the action: 'Send Message' Action.

    Specify the message to send, such as: "We have received your message and are processing your request."

    Optionally, add a delay for when the action should be executed; and even some form of media (Image, Video, Document or Audio)

    <Frame caption="Set up Action">
      <img className="block border rounded-xl shadow mt-4 mx-auto" src="https://mintcdn.com/bharatkumarramesh/n6-6KkopVbLMcGqC/images/ExampleActions.png?fit=max&auto=format&n=n6-6KkopVbLMcGqC&q=85&s=9045fedb31cbd6eed773264151976783" alt="Conditions" width="90%" data-path="images/ExampleActions.png" />
    </Frame>
  </Step>

  <Step title="Finish">
    Save the rule and activate it to start automating the workflow.

    ### Final Rule:

    * **Trigger**: When `New Message Received`
    * **Conditions**: If message contains `urgent` OR `important`
    * **Action**: Then send a message "We have received your message and are processing your request."

    <Frame caption="Save & Publish">
      <img className="block border rounded-xl shadow mt-4 hidden dark:block mx-auto" src="https://mintcdn.com/bharatkumarramesh/n6-6KkopVbLMcGqC/images/ExampleSavePublish-1.png?fit=max&auto=format&n=n6-6KkopVbLMcGqC&q=85&s=c7147bb8d3bad0c85824c150e2366c43" alt="Conditions" width="90%" lightAlt="Conditions" darkAlt="Conditions" data-path="images/ExampleSavePublish-1.png" />

      <img className="block border rounded-xl shadow mt-4 dark:hidden mx-auto" src="https://mintcdn.com/bharatkumarramesh/n6-6KkopVbLMcGqC/images/ExampleSavePublish.png?fit=max&auto=format&n=n6-6KkopVbLMcGqC&q=85&s=104dcf6f925e73d7ddfe1735c2a72ae6" alt="Conditions" width="90%" lightAlt="Conditions" darkAlt="Conditions" data-path="images/ExampleSavePublish.png" />
    </Frame>
  </Step>
</Steps>
