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

# Automations

> תזמן משימות חוזרות והפעל פונקציות אוטומטית בהתבסס על אירועי מסד נתונים או אירועי webhook של connector

<div className="dev-docs-banner">
  <div className="dev-docs-banner-content">
    <div className="dev-docs-banner-title">
      אתה צופה בתיעוד למפתחים
    </div>

    <div className="dev-docs-banner-text">
      תיעוד זה מיועד למפתחים העובדים עם פלטפורמת המפתחים של Base44. למידע על automations בעורך האפליקציות, ראה <a href="/Building-your-app/Creating-automations">יצירת automations עבור האפליקציה שלך</a>.
    </div>
  </div>
</div>

Automations מאפשרים ל-[פונקציות בקאנד](/developers/backend/resources/backend-functions/overview) לרוץ אוטומטית לפי לוח זמנים, בתגובה לאירועי מסד נתונים, או כאשר אינטגרציה מחוברת שולחת אירוע webhook. השתמש ב-automations כדי לעבד נתונים במרווחים קבועים, לטפל בשינויי entity, להגיב לאירועי שירותים חיצוניים, או לבצע משימות חד-פעמיות בזמנים ספציפיים.

לכל פונקציית בקאנד יכולים להיות מספר automations מצורפים, מוגדרים בקובץ `function.jsonc` של הפונקציה. אם יש לך רק קובץ `entry.ts` או `entry.js`, תצטרך להוסיף את קובץ התצורה הזה כדי להשתמש ב-automations. Automations [נפרסים אטומית עם קוד הפונקציה](#deploy-automations) כאשר אתה מריץ [`deploy`](/developers/references/cli/commands/deploy) או [`functions deploy`](/developers/references/cli/commands/functions-deploy).

## סוגי automation

Base44 תומכת ב-4 סוגי automations:

* **[Scheduled automations עם cron](#cron)**: השתמש בביטויי cron לשליטת תזמון מדויקת.
* **[Scheduled automations עם simple schedules](#simple-schedule)**: הגדר משימות חוזרות לפי מרווח ללא ביטויי cron.
* **[Entity event automations](#entity-events)**: הפעל פונקציות כאשר רשומות מסד נתונים נוצרות, מעודכנות או נמחקות.
* **[Connector automations](#connector-automations)**: הגב לאירועים משירותים מחוברים בזמן אמת, כגון אימייל חדש ב-Gmail או שינוי קובץ ב-Google Drive.

## שדות נפוצים

### שדות נפוצים לכל automations

כל סוגי ה-automation חולקים את השדות הבאים:

| Field           | Type      | Required | תיאור                                                                                    |
| --------------- | --------- | -------- | ---------------------------------------------------------------------------------------- |
| `type`          | `string`  | Yes      | סוג ה-automation. ערכים אפשריים: `"scheduled"`, `"entity"`, או `"connector"`.            |
| `name`          | `string`  | Yes      | מזהה ייחודי עבור ה-automation.                                                           |
| `description`   | `string`  | No       | תיאור קריא לאדם.                                                                         |
| `function_args` | `object`  | No       | ארגומנטים שמועברים לפונקציה כשהיא מופעלת. ראה [Function arguments](#function-arguments). |
| `is_active`     | `boolean` | No       | האם ה-automation מופעל. ברירת מחדל היא `true`.                                           |

### שדות נפוצים ל-scheduled automations

cron ו-simple scheduled automations חולקים את השדות הנוספים האלה:

| Field              | Type     | Required    | תיאור                                                                                                                                              |
| ------------------ | -------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `schedule_mode`    | `string` | Yes         | האם לוח הזמנים חוזר. ערכים אפשריים: `"recurring"` או `"one-time"`.                                                                                 |
| `schedule_type`    | `string` | Yes         | שיטת תזמון לשימוש. ערכים אפשריים: `"cron"` או `"simple"`.                                                                                          |
| `ends_type`        | `string` | No          | מתי לוח הזמנים החוזר צריך להפסיק. ערכים אפשריים: `"never"`, `"on"`, או `"after"`. ברירת מחדל היא `"never"`.                                        |
| `ends_on_date`     | `string` | Conditional | תאריך שבו לוח הזמנים החוזר מסתיים, כולל, ב-UTC. נדרש כאשר `ends_type` הוא `"on"`. פורמט: `YYYY-MM-DDTHH:MM:SSZ`. לדוגמה, `"2026-12-31T23:59:59Z"`. |
| `ends_after_count` | `number` | Conditional | מספר ביצועים שלאחריהם לוח הזמנים החוזר נעצר. נדרש כאשר `ends_type` הוא `"after"`.                                                                  |

## תצורת automation

הגדר automations בקובץ `function.jsonc` שלך באמצעות אחת מהגישות הבאות. כל ה-automations משתמשים ב[שדות נפוצים לכל automations](#common-fields-for-all-automations) המפורטים לעיל, בנוסף לשדות הספציפיים לכל סוג.

### Cron

השתמש ב[שדות נפוצים לכל automations](#common-fields-for-all-automations) וב[שדות נפוצים ל-scheduled automations](#common-fields-for-scheduled-automations) יחד עם השדות הספציפיים ל-cron המפורטים כאן.

הגדר `type` ל-`"scheduled"` ו-`schedule_type` ל-`"cron"` כדי להשתמש בביטויי cron לשליטת תזמון מדויקת.

Cron automations משתמשים בתחביר סטנדרטי של 5 שדות: `minute hour day-of-month month day-of-week`. ראה את [crontab.guru](https://crontab.guru/) לעורך אינטראקטיבי של ביטויי cron וסימוכין תחביר.

| Field             | Type     | Required | תיאור                 |
| ----------------- | -------- | -------- | --------------------- |
| `cron_expression` | `string` | Yes      | ביטוי cron בן 5 שדות. |

#### דוגמת cron

דוגמה זו מריצה פונקציה כל יום בחצות UTC:

```jsonc theme={null}
{
  "name": "sendDailyReport",
  "entry": "entry.ts",
  "automations": [
    {
      "type": "scheduled",
      "name": "daily_midnight_report",
      "description": "Runs every day at midnight UTC",
      "function_args": { "mode": "full_sync" },
      "is_active": true,

      "schedule_mode": "recurring",
      "schedule_type": "cron",
      "cron_expression": "0 0 * * ?"
    }
  ]
}
```

### Simple schedule

השתמש ב[שדות נפוצים לכל automations](#common-fields-for-all-automations) וב[שדות נפוצים ל-scheduled automations](#common-fields-for-scheduled-automations) יחד עם שדות simple schedule המפורטים כאן.

הגדר `type` ל-`"scheduled"` ו-`schedule_type` ל-`"simple"` עבור צרכי תזמון פשוטים.

הגדר משימות חוזרות לפי מרווח כגון דקות, שעות, ימים, שבועות או חודשים מבלי לכתוב ביטויי cron.

| Field                    | Type       | Required    | תיאור                                                                                                                                                       |
| ------------------------ | ---------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `one_time_date`          | `string`   | Conditional | תאריך וזמן שבו ה-automation רץ פעם אחת, ב-UTC. נדרש כאשר `schedule_mode` הוא `"one-time"`. פורמט: `YYYY-MM-DDTHH:MM:SSZ`. לדוגמה, `"2026-02-15T10:00:00Z"`. |
| `repeat_unit`            | `string`   | Conditional | יחידת זמן עבור automations חוזרים. נדרש כאשר `schedule_mode` הוא `"recurring"`. ערכים אפשריים: `"minutes"`, `"hours"`, `"days"`, `"weeks"`, או `"months"`.  |
| `repeat_interval`        | `number`   | Conditional | מרווח בין ביצועים. נדרש כאשר `repeat_unit` הוא `"minutes"`, `"hours"`, או `"days"`.                                                                         |
| `start_time`             | `string`   | Conditional | שעה ביום שבה ה-automation רץ, ב-UTC. נדרש כאשר `repeat_unit` הוא `"days"`, `"weeks"`, או `"months"`. פורמט: `HH:MM`.                                        |
| `repeat_on_days`         | `number[]` | Conditional | ימי השבוע שבהם ה-automation רץ. נדרש כאשר `repeat_unit` הוא `"weeks"`. מערך של מספרי ימי שבוע, כאשר `0` הוא יום ראשון ו-`6` הוא שבת.                        |
| `repeat_on_day_of_month` | `number`   | Conditional | יום בחודש שבו ה-automation רץ. נדרש כאשר `repeat_unit` הוא `"months"`. ערכים תקפים: `1`-`31`.                                                               |

#### דוגמאות simple schedule

הדוגמאות הבאות מציגות דרכים שונות לתזמון automations עם simple schedules:

<CodeGroup>
  ```jsonc Every 30 minutes theme={null}
  {
    "type": "scheduled",
    "name": "every_30_minutes",
    "description": "Runs every 30 minutes.",
    "is_active": true,

    "schedule_mode": "recurring",
    "schedule_type": "simple",
    "repeat_unit": "minutes",
    "repeat_interval": 30
  }
  ```

  ```jsonc Weekdays at 9am theme={null}
  {
    "type": "scheduled",
    "name": "weekday_morning_report",
    "description": "Runs at 9 AM Monday through Friday.",
    "is_active": true,

    "schedule_mode": "recurring",
    "schedule_type": "simple",
    "repeat_unit": "weeks",
    "repeat_interval": 1,
    "start_time": "09:00",
    "repeat_on_days": [1, 2, 3, 4, 5],

    "ends_type": "after",
    "ends_after_count": 52
  }
  ```

  ```jsonc One-time execution theme={null}
  {
    "type": "scheduled",
    "name": "one_time_cleanup",
    "description": "Runs once at a specific date and time.",
    "function_args": { "cleanup": true },
    "is_active": true,

    "schedule_mode": "one-time",
    "schedule_type": "simple",
    "one_time_date": "2026-02-15T10:00:00Z"
  }
  ```
</CodeGroup>

### Entity events

השתמש ב[שדות נפוצים לכל automations](#common-fields-for-all-automations) יחד עם שדות entity event המפורטים כאן.

הגדר `type` ל-`"entity"` כדי להפעיל פונקציות אוטומטית כאשר רשומות מסד נתונים נוצרות, מעודכנות או נמחקות.

Entity automations יכולים להאזין לסוג אירוע 1 או יותר על entity ספציפי.

| Field         | Type       | Required | תיאור                                                                                      |
| ------------- | ---------- | -------- | ------------------------------------------------------------------------------------------ |
| `entity_name` | `string`   | Yes      | שם ה-entity לניטור.                                                                        |
| `event_types` | `string[]` | Yes      | אירועי מסד נתונים להאזנה. ערכים אפשריים: `"create"`, `"update"`, `"delete"`. נדרש לפחות 1. |

#### דוגמאות entity event

הדוגמאות הבאות מציגות כיצד להפעיל פונקציות בהתבסס על אירועי entity:

<CodeGroup>
  ```jsonc All order events theme={null}
  {
    "name": "processOrders",
    "entry": "entry.ts",
    "automations": [
      {
        "type": "entity",
        "name": "on_order_changes",
        "description": "Triggered on order create, update, or delete.",
        "function_args": { "notify_slack": true },
        "is_active": true,

        "entity_name": "orders",
        "event_types": ["create", "update", "delete"]
      }
    ]
  }
  ```

  ```jsonc New records only theme={null}
  {
    "type": "entity",
    "name": "on_customer_create",
    "description": "Triggered when a new customer is created.",
    "is_active": true,

    "entity_name": "customers",
    "event_types": ["create"]
  }
  ```
</CodeGroup>

### Connector automations

השתמש ב[שדות נפוצים לכל automations](#common-fields-for-all-automations) יחד עם השדות הספציפיים ל-connector המפורטים כאן.

הגדר `type` ל-`"connector"` כדי להפעיל פונקציות כאשר אינטגרציה מחוברת שולחת אירוע webhook. השתמש בהן כדי להגיב לפעילות של שירותים חיצוניים בזמן אמת. לדוגמה, אתה יכול לפענח אימייל חדש, לסנכרן שינוי בלוח שנה, או להגיב לעדכון קובץ ב-Google Drive.

תוכל באופן אופציונלי להוסיף [trigger conditions](#trigger-conditions) כדי לסנן אירועים כך שהפונקציה שלך תרוץ רק כאשר ה-payload תואם לכללים שאתה מגדיר.

כאשר connector automation מופעל, הפונקציה שלך מקבלת [webhook payload](#webhook-payload) מובנה המכיל את סוג האירוע, פרטי האינטגרציה ואת הנתונים הגולמיים מהשירות החיצוני.

<Note>
  ה-connector חייב להיות מוגדר בפרויקט שלך ומאושר לפני הפריסה. ראה [Shared connectors](/developers/backend/resources/connectors/shared-connectors) להוראות הגדרה.
</Note>

| Field                | Type       | Required    | תיאור                                                                                                                                                                                                |
| -------------------- | ---------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `integration_type`   | `string`   | Yes         | מזהה סוג ה-connector להאזנה. ראה [supported integrations](#supported-integrations-and-events) לערכים מקובלים.                                                                                        |
| `events`             | `string[]` | Yes         | אחד או יותר שמות אירועי webhook להירשם אליהם. ראה [supported integrations](#supported-integrations-and-events) לאירועים זמינים לכל connector.                                                        |
| `resource_id`        | `string`   | Conditional | מצמצם את ה-automation למשאב ספציפי. הפורמט הצפוי תלוי ב-connector. ראה [Resource ID formats](#resource-id-formats) למטה. נדרש עבור Google Drive file-scoped events. אופציונלי עבור connectors אחרים. |
| `trigger_conditions` | `object`   | No          | כללים שחייבים להתאים לאירוע הנכנס לפני שהפונקציה שלך רצה. אם האירוע לא תואם, ההפעלה מדלגת. ראה [Trigger conditions](#trigger-conditions) לסימוכין מלא.                                               |

#### אינטגרציות ואירועים נתמכים

| Connector            | `integration_type` | `events` value          | תיאור                                                                      |
| -------------------- | ------------------ | ----------------------- | -------------------------------------------------------------------------- |
| Gmail                | `gmail`            | `mailbox`               | כל שינוי בתיבת דואר, כולל הודעות חדשות, עדכוני תוויות ושינויי סטטוס קריאה. |
| Google Calendar      | `googlecalendar`   | `events`                | כל שינוי באירוע יומן, כולל נוצר, עודכן ונמחק.                              |
| Google Drive         | `googledrive`      | `changes`               | כל שינוי בכונן, כולל קבצים שהתווספו, שונו או נמחקו.                        |
| Google Drive         | `googledrive`      | `file`                  | כל שינוי לקובץ ספציפי (דורש `resource_id`).                                |
| Google Drive         | `googledrive`      | `file.update`           | תוכן או מאפייני קובץ שונו (דורש `resource_id`).                            |
| Google Drive         | `googledrive`      | `file.trash`            | קובץ הועבר לאשפה (דורש `resource_id`).                                     |
| Google Drive         | `googledrive`      | `file.untrash`          | קובץ שוחזר מאשפה (דורש `resource_id`).                                     |
| Google Drive         | `googledrive`      | `file.delete`           | קובץ נמחק לצמיתות (דורש `resource_id`).                                    |
| Microsoft OneDrive   | `one_drive`        | `updated`               | כל שינוי בקובץ או תיקייה, כולל נוצר, שונה ונמחק.                           |
| Microsoft Outlook    | `outlook`          | `created`               | אימייל חדש, אירוע יומן או איש קשר נוצר.                                    |
| Microsoft Outlook    | `outlook`          | `updated`               | אימייל, אירוע יומן או איש קשר עודכן.                                       |
| Microsoft Outlook    | `outlook`          | `deleted`               | אימייל, אירוע יומן או איש קשר נמחק.                                        |
| Microsoft SharePoint | `share_point`      | `updated`               | כאשר פריט רשימה או מסמך נוצר, שונה או נמחק.                                |
| Microsoft Teams      | `microsoft_teams`  | `created`               | כאשר הודעת צ'אט חדשה מתפרסמת.                                              |
| Microsoft Teams      | `microsoft_teams`  | `updated`               | כאשר הודעת צ'אט מעודכנת.                                                   |
| Microsoft Teams      | `microsoft_teams`  | `deleted`               | כאשר הודעת צ'אט נמחקת.                                                     |
| Slack                | `slack`            | `message`               | כאשר הודעה מתפרסמת לערוץ.                                                  |
| Slack                | `slack`            | `message.im`            | כאשר הודעה ישירה מתפרסמת.                                                  |
| Slack                | `slack`            | `message.groups`        | כאשר הודעה מתפרסמת לערוץ פרטי.                                             |
| Slack                | `slack`            | `message.channels`      | כאשר הודעה מתפרסמת לערוץ ציבורי.                                           |
| Slack                | `slack`            | `message.mpim`          | כאשר הודעה מתפרסמת ל-IM מרובה משתתפים.                                     |
| Slack                | `slack`            | `reaction_added`        | כאשר reaction מתווסף להודעה.                                               |
| Slack                | `slack`            | `reaction_removed`      | כאשר reaction מוסר מהודעה.                                                 |
| Slack                | `slack`            | `member_joined_channel` | כאשר משתמש מצטרף לערוץ.                                                    |
| Slack                | `slack`            | `member_left_channel`   | כאשר משתמש עוזב ערוץ.                                                      |
| Slack                | `slack`            | `file_shared`           | כאשר קובץ משותף.                                                           |

<Tip>
  אירוע `mailbox` של Gmail מופעל עבור כל שינוי בתיבת דואר, לא רק הודעות חדשות. כדי שהפונקציה שלך תרוץ רק כאשר אימיילים חדשים מגיעים, הוסף trigger condition: `{ "field": "has_new_messages", "operator": "equals", "value": true }`.
</Tip>

<Note>
  Slack connector automations דורשים trigger conditions. הפריסה תיכשל אם לא מוגדרים תנאים עבור Slack connector automations.
</Note>

#### פורמטים של resource ID

הערך הצפוי עבור `resource_id` משתנה לפי connector:

* **Google Drive:** מזהה הקובץ. נדרש עבור file-scoped events (`file`, `file.update`, `file.trash`, `file.untrash`, `file.delete`).
* **Gmail:** רשימה מופרדת בפסיקים של מזהי תוויות לצפייה. ברירת מחדל היא `"INBOX"` אם מושמט.
* **Microsoft Teams:** `{teamId}/{channelId}` לצפייה בערוץ ספציפי, או `{chatId}` לצפייה בצ'אט ספציפי.
* **SharePoint:** `{siteId}/{listId}` לצפייה ברשימה ספציפית.

#### Trigger conditions

השתמש ב-`trigger_conditions` כדי לסנן אירועי webhook כך שהפונקציה שלך תרוץ רק כאשר ה-payload תואם לכללים שאתה מגדיר. אם לא מוגדרים תנאים, הפונקציה רצה עבור כל אירוע נכנס. ראה [Connector automation examples](#connector-automation-examples) לתצורות מלאות.

<ResponseField name="logic" type="string">
  כיצד לשלב את התנאים. ערכים אפשריים: `"and"` (כל אחד חייב להתאים), `"or"` (כל אחד חייב להתאים). ברירת מחדל היא `"and"`.
</ResponseField>

<ResponseField name="conditions" type="array" required>
  אחד או יותר אובייקטי תנאי או קבוצות תנאים מקוננות. מקסימום 20 תנאי עלה ו-5 רמות של קינון.

  <Expandable title="שדות אובייקט תנאי">
    <ResponseField name="field" type="string" required>
      נתיב מופרד בנקודה לתוך ה-webhook payload. לדוגמה, `"status"` קורא את `payload.data.status`, ו-`"sender.email"` קורא את `payload.data.sender.email`.
    </ResponseField>

    <ResponseField name="operator" type="string" required>
      כיצד להשוות את ערך השדה.

      <Expandable title="אופרטורים נתמכים">
        | Operator       | תיאור                                                                     |
        | -------------- | ------------------------------------------------------------------------- |
        | `equals`       | ערך השדה תואם בדיוק ל-`value`.                                            |
        | `not_equals`   | ערך השדה לא תואם ל-`value`.                                               |
        | `contains`     | ערך השדה מכיל את `value` כתת-מחרוזת.                                      |
        | `not_contains` | ערך השדה לא מכיל את `value` כתת-מחרוזת.                                   |
        | `starts_with`  | ערך השדה מתחיל ב-`value`.                                                 |
        | `ends_with`    | ערך השדה מסתיים ב-`value`.                                                |
        | `gt`           | ערך השדה גדול מ-`value`.                                                  |
        | `gte`          | ערך השדה גדול או שווה ל-`value`.                                          |
        | `lt`           | ערך השדה קטן מ-`value`.                                                   |
        | `lte`          | ערך השדה קטן או שווה ל-`value`.                                           |
        | `in_list`      | ערך השדה הוא אחד מהפריטים ב-`value` (מערך).                               |
        | `not_in_list`  | ערך השדה אינו אחד מהפריטים ב-`value` (מערך).                              |
        | `exists`       | השדה קיים ולא null. אין צורך ב-`value`.                                   |
        | `not_exists`   | השדה הוא null או חסר. אין צורך ב-`value`.                                 |
        | `is_empty`     | השדה הוא null, מחרוזת ריקה, מערך ריק או אובייקט ריק. אין צורך ב-`value`.  |
        | `is_not_empty` | השדה אינו null, מחרוזת ריקה, מערך ריק או אובייקט ריק. אין צורך ב-`value`. |
      </Expandable>
    </ResponseField>

    <ResponseField name="value" type="any">
      הערך להשוואה. לא נדרש עבור `exists`, `not_exists`, `is_empty`, ו-`is_not_empty`.
    </ResponseField>
  </Expandable>
</ResponseField>

#### Webhook payload

כאשר connector automation מפעיל את הפונקציה שלך, גוף הבקשה מכיל אובייקט `payload` עם המבנה הבא. ראה [Connector automation examples](#connector-automation-examples) לפונקציה שקוראת את ה-payload.

| Field                               | Type      | תיאור                                                                                         |
| ----------------------------------- | --------- | --------------------------------------------------------------------------------------------- |
| `payload.automation.id`             | `string`  | מזהה ה-automation שהפעיל את ההרצה הזו.                                                        |
| `payload.automation.name`           | `string`  | שם ה-automation.                                                                              |
| `payload.automation.type`           | `string`  | תמיד `"connector"`.                                                                           |
| `payload.event.type`                | `string`  | שם אירוע ה-webhook. לדוגמה, `"mailbox"`, `"events"`, או `"changes"`.                          |
| `payload.event.integration_type`    | `string`  | סוג ה-connector. לדוגמה, `"gmail"` או `"googlecalendar"`.                                     |
| `payload.event.provider_identifier` | `string`  | מזהה חשבון הספק המשמש לניתוב.                                                                 |
| `payload.data`                      | `object`  | ה-webhook payload הגולמי מהשירות החיצוני. מוגדר ל-`null` כאשר `payload_too_large` הוא `true`. |
| `payload.payload_too_large`         | `boolean` | הוא `true` כאשר ה-webhook payload חרג מ-\~200 KB ו-`data` הוא `null`.                         |

#### דוגמאות connector automation

<CodeGroup>
  ```jsonc Basic connector automation theme={null}
  // Triggers the function whenever a new email arrives in Gmail.

  {
    "name": "processInboundEmails",
    "entry": "entry.ts",
    "automations": [
      {
        "type": "connector",
        "name": "on_new_gmail",
        "description": "Runs when a new email arrives in Gmail.",
        "is_active": true,

        "integration_type": "gmail",
        "events": ["mailbox"]
      }
    ]
  }
  ```

  ```jsonc Single trigger condition theme={null}
  // Triggers only when a Google Calendar event has status "cancelled".

  {
    "type": "connector",
    "name": "on_event_cancelled",
    "description": "Runs only when a Google Calendar event is cancelled.",
    "is_active": true,

    "integration_type": "googlecalendar",
    "events": ["events"],
    "trigger_conditions": {
      "logic": "and",
      "conditions": [
        { "field": "status", "operator": "equals", "value": "cancelled" }
      ]
    }
  }
  ```

  ```jsonc Nested trigger conditions theme={null}
  // Triggers only for Gmail messages that are both in the inbox and unread.

  {
    "type": "connector",
    "name": "on_unread_inbox_email",
    "description": "Runs only for unread emails in the inbox.",
    "is_active": true,

    "integration_type": "gmail",
    "events": ["mailbox"],
    "trigger_conditions": {
      "logic": "and",
      "conditions": [
        { "field": "labelIds", "operator": "contains", "value": "INBOX" },
        { "field": "labelIds", "operator": "contains", "value": "UNREAD" }
      ]
    }
  }
  ```

  ```typescript Reading the payload theme={null}
  // Reads the structured payload from the request body.

  Deno.serve(async (req) => {
    const body = await req.json();
    const { payload } = body;

    const eventType = payload.event.type;            
    const integration = payload.event.integration_type; 

    if (payload.payload_too_large) {
      console.warn("Webhook payload was too large and was not included.");
      return Response.json({ ok: false, reason: "payload_too_large" });
    }

    const data = payload.data; 
    
    // Your function logic
    console.log(`Received ${eventType} event from ${integration}`, data);

    return Response.json({ ok: true });
  });
  ```
</CodeGroup>

### Function arguments

העבר נתונים לפונקציה שלך כשהיא מופעלת על ידי הכללת השדה `function_args` בתצורת ה-automation שלך. זה שימושי כאשר פונקציה אחת מטפלת במספר automations עם התנהגויות שונות, כגון פונקציית sync שרצה באופן הדרגתי כל 15 דקות אך מבצעת sync מלא יומי.

גש לארגומנטים אלה בקוד הפונקציה שלך דרך גוף הבקשה.

#### דוגמת function arguments

דוגמה זו מציגה פונקציה שמטפלת במצבי sync הדרגתי ומלא בהתבסס על תצורת ה-automation:

<CodeGroup>
  ```typescript Function code theme={null}
  Deno.serve(async (req) => {
    const body = await req.json();
    const args = body.args ?? {};

    // Use the arguments from automation config
    const mode = args.mode ?? "incremental";

    // Your function logic
  });
  ```

  ```jsonc Automation config theme={null}
  {
    "name": "syncData",
    "entry": "entry.ts",
    "automations": [
      {
        "type": "scheduled",
        "name": "incremental_sync",
        "description": "Runs every 15 minutes with incremental mode.",
        "function_args": { "mode": "incremental" },
        "is_active": true,
        "schedule_mode": "recurring",
        "schedule_type": "simple",
        "repeat_unit": "minutes",
        "repeat_interval": 15
      },
      {
        "type": "scheduled",
        "name": "full_sync",
        "description": "Runs daily at midnight with full sync mode.",
        "function_args": { "mode": "full" },
        "is_active": true,
        "schedule_mode": "recurring",
        "schedule_type": "cron",
        "cron_expression": "0 0 * * ?"
      }
    ]
  }
  ```
</CodeGroup>

## פריסת automations

פרוס פונקציות בקאנד עם ה-automations שלהן באמצעות פקודת [`functions deploy`](/developers/references/cli/commands/functions-deploy) של ה-CLI או הפקודה המאוחדת [`deploy`](/developers/references/cli/commands/deploy). אתה יכול לפרוס פונקציות ספציפיות לפי שם עם `functions deploy <names...>`.

הפריסה אטומית לכל פונקציה. פונקציה נחשבת רק כפרוסה אם גם פריסת ה-Deno וגם כל ה-automations שלה מצליחים. אם כל automation נכשל בפריסה, פריסת הפונקציה כולה מתבטלת.

לאחר הפריסה, ה-CLI מציג סטטוס לכל פונקציה: נפרס, ללא שינוי, או שגיאה.

## ניהול automations בלוח הבקרה

<Warning>
  כל שינויים שנעשו בלוח הבקרה ידרסו בפעם הבאה שתריץ [`functions deploy`](/developers/references/cli/commands/functions-deploy). אין סנכרון דו-כיווני בין לוח הבקרה לקבצים המקומיים שלך. Automations שמוגדרים בקבצי `function.jsonc` המקומיים שלך הם מקור האמת.

  אם תרצה לבצע שינויים ל-automations שלך, עדכן את קבצי `function.jsonc` המקומיים שלך ופרוס מחדש. השתמש בלוח הבקרה לניטור לוגי הביצוע והפעלה ידנית של automations בעת הצורך.
</Warning>

צפה ונהל את ה-automations שלך בלוח הבקרה של Base44 תחת לשונית **Automations**. מלוח הבקרה, אתה יכול:

* לצפות בלוגי ביצוע והיסטוריה
* להריץ automations ידנית לבדיקה
* לנטר את סטטוס ה-automation

## ראה גם

* [Backend Functions](/developers/backend/resources/backend-functions/overview): למד על פונקציות בקאנד
* [`functions deploy`](/developers/references/cli/commands/functions-deploy): פרוס פונקציות עם automations
* [`deploy`](/developers/references/cli/commands/deploy): פרוס את כל המשאבים בבת אחת
* [`logs`](/developers/references/cli/commands/logs): צפה בלוגי פונקציות

<Note>דף זה תורגם באמצעות בינה מלאכותית. למידע המדויק והעדכני ביותר, עיין ב[גרסה האנגלית](/). </Note>
