# Setting up automatic messages in web chat
# Symptoms

*Automatic messages are required for the web chat:*

1.  *At chat start*
2.  *If the chat is running outside of business hours*

# Solution

Configuration is possible using scripts and macros.

1.  Take the [example script](https://support.swarmica.com/attachments/U/p/UpFPHH09gFWw91Bc_a/trigger_new_chat_greeting.py) and edit the message texts in it
2.  Make sure you have a [created schedule](https://support.swarmica.com/article/ru/126-upravlenie-raspisaniyami.html) assigned to the company/group or SLA policy
3.  Go to **Settings > Scripts** and click **Create**. Select the role *Administrator* and enter the script name.
4.  In the window that opens, in the script field, upload the edited script from step 1. Click **Save**.
5.  Go to **Settings > Action** by event and click **Create**
6.  Fill in the name, *Event Type = TicketEvent*, *Action Type = Script*, and in *Action* select the created script. Click **Save**
7.  In the window that opens, in the **Run if event meets conditions** field, insert

```json
{
  "event": 9,
  "ticket__status__in": [
    "NEW",
    "OPEN"
  ],
  "ticket__source__channel_type": "WIDGET"
}
```

Save the event and in the list of actions, click Run selected action ![](https://support.swarmica.com/attachments/R/D/RDlioUQmdIVzBXk6_a/image.png)