# How to set up custom pending/autosolve messages taking into account the schedule on Companies
# Instructions

:::caution
The script implements custom logic for tickets in the **Awaiting customer response** status only for organizations with a set **Business hours** (schedule):

- After a specified time (default 1 hour) after moving the ticket to the **Awaiting customer response** status, if there is no response from the customer and the current time is within the company's business hours, a comment with a warning about impending closure is sent.

- After another specified time (default 1 hour), if there is still no response and we are within business hours, the ticket is moved to **Solution provided** with a comment.

- If the start or reminder time falls on non-working hours, the countdown begins from the start of the next business hours.

- Filtering by channels through the source_channels parameter in the context is supported.

Tickets of organizations that do not have **Business hours** or if the applicant is not part of any organization, are processed according to the default logic for handling tickets in the **Awaiting customer response** status.
:::

1. Log in to Swarmica as Administrator

2. Create a new script in **Settings - Scripts**

![](https://support.swarmica.com/attachments/W/T/WTr9Y2LqNxLY8DNB_a/изображение.png)

and add the [recurring_autonotify_autosolve.py](https://support.swarmica.com/attachments/7/t/7tUb3HL7fC7_8UPa_a/recurring_autonotify_autosolve.py) script to it

3. Create a new **Scheduled action** in **Settings - Scheduled action - Script**

![](https://support.swarmica.com/attachments/R/g/Rg2TarVphEQWhblG_a/autosolve.png)

4. On the page that opens, select the script created in step 2, set the schedule to `* * * * *` (every minute), enable it, and click **Save**:

![](https://support.swarmica.com/attachments/Q/S/QSt3f-zumwpwaQOk_a/изображение.png)

By default, the script works with requests from all available source channels, the time after moving to **Awaiting customer response** is 1 hour, and the time after the reminder is 1 hour. However, the script supports changing these parameters. To do this, you can add data to the context in the form of:

```json
{
  "reminder_hours": <HOURS>,                      # number of hours until reminder
  "close_hours": <HOURS>,                         # number of hours until closure
  "source_channels":['SOURCE1',[SOURCE2],...]     # list of source channels
}
```

Possible values for "source_channels":

```
'email'
'telegram'
'whatsapp'
'mango_office'
'widget'
'billmanager'
'vk'
'beeline_pbx'
'max'
'web'
'api'
```

Example data for the context:

```json
{
  "reminder_hours": 3,
  "close_hours": 3,
  "source_channels": ['email','web','widget']
}
```