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

# Create automation rule

> Create an automation rule that sends calendar invites to specified email addresses when a booking event occurs (confirmed, rescheduled, cancelled, etc.).


<Warning>This endpoint is part of API v1, which is deprecated. Please use the [v2 API](/getting-started/introduction) instead.</Warning>

<Info>Replace `{your-subdomain}` with your workspace’s subdomain. <br /> Learn how to find your subdomain in [Workspace subdomain](/getting-started/workspace-subdomain).</Info>

## Dynamic Variables

You can use dynamic variables in the `subject`, `body`, `calendar_invite_subject`, and `calendar_invite_body` fields. These variables will be automatically replaced with actual values when the automation rule is triggered. Supported variables include:

* `{{booking.id}}` - Booking SID
* `{{meeting.name}}` - Meeting name
* `{{meeting.scheduling_url}}` - Meeting scheduling URL
* `{{client.name}}` - Client's full name
* `{{client.first_name}}` - Client's first name
* `{{client.last_name}}` - Client's last name
* `{{client.email}}` - Client's email
* `{{client.starts_at}}` - Meeting start time in client's time zone
* `{{client.ends_at}}` - Meeting end time in client's time zone
* `{{host.name}}` - Host's name
* `{{host.starts_at}}` - Meeting start time in host's time zone
* `{{host.ends_at}}` - Meeting end time in host's time zone

## HTML Support

The `body` and `calendar_invite_body` fields support HTML formatting. Allowed HTML tags include: `h1`, `h2`, `h3`, `h4`, `h5`, `br`, `strong`, `em`, `a`, `s`, `code`, `u`, `ul`, `ol`, `li`, `p`, `span`.


## OpenAPI

````yaml bundled-v1/automation-rules.yaml POST /automation_rules
openapi: 3.0.3
info:
  title: NeetoCal Automation Rules APIs
  version: 1.0.0
servers:
  - description: NeetoCal APIs
    url: https://{your-subdomain}.neetocal.com/api/external/v1
    variables:
      your-subdomain:
        default: spinkart
        description: >-
          Replace **spinkart** with your [workspace's
          subdomain](/getting-started/workspace-subdomain).
security: []
tags:
  - name: Automation Rules
    description: APIs to create automation rules for sending calendar invites.
paths:
  /automation_rules:
    post:
      tags:
        - Automation Rules
      summary: Create an automation rule
      description: >
        Create an automation rule that sends calendar invites to specified email
        addresses when a booking event occurs (confirmed, rescheduled,
        cancelled, etc.).
      parameters:
        - $ref: '#/components/parameters/api_key_header'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: >
                    Name of the automation rule. This field is optional. If not
                    provided, an auto-generated name

                    like "New Rule - 172719992" will be assigned.
                  example: Send calendar invite to guests
                event:
                  type: string
                  description: >
                    The event that triggers this automation rule. Must be one of
                    the following values:

                    - `marked_no_show` - When a booking is marked as no-show

                    - `booking_confirmed` - When a booking is confirmed

                    - `booking_rescheduled` - When a booking is rescheduled

                    - `booking_cancelled` - When a booking is cancelled

                    - `before_meeting_starts` - Before a meeting starts

                    - `after_meeting_ends` - After a meeting ends

                    - `meeting_outcome_changed` - When the meeting outcome is
                    changed
                  enum:
                    - marked_no_show
                    - booking_confirmed
                    - booking_rescheduled
                    - booking_cancelled
                    - before_meeting_starts
                    - after_meeting_ends
                    - meeting_outcome_changed
                  example: booking_confirmed
                meeting_ids:
                  type: array
                  description: >
                    Array of valid meeting IDs from your workspace. Only actual
                    meeting IDs are accepted (template meeting IDs are not
                    valid).

                    The automation rule will be triggered for bookings
                    associated with any of these meetings.


                    You can get meeting IDs from the response of the [List
                    scheduling links](/api-reference/scheduling-links/list)
                    endpoint, where it appears as the `id` property for each
                    scheduling link in the response.
                  items:
                    type: string
                  example:
                    - 8a7794e3-3142-4569-9dd7-6411369b5d3f
                    - 9b8805f4-4253-5670-0ee8-7522470c6e4g
                actions:
                  type: array
                  description: >-
                    Array of actions to perform when the event is triggered.
                    Currently, only `send_calendar_invite_to_anyone` action type
                    is supported.
                  items:
                    type: object
                    properties:
                      type:
                        type: string
                        description: >-
                          Type of action to perform. Must be
                          `send_calendar_invite_to_anyone`.
                        enum:
                          - send_calendar_invite_to_anyone
                        example: send_calendar_invite_to_anyone
                      emails:
                        type: array
                        description: >-
                          Array of valid email addresses to send the calendar
                          invite to.
                        items:
                          type: string
                        example:
                          - guest@example.com
                          - team@example.com
                      email_subject:
                        type: string
                        description: >
                          Subject line for the email notification. Dynamic
                          variables are supported and will be automatically
                          replaced

                          with actual values when the automation rule is
                          triggered.
                        example: You have a meeting scheduled
                      email_body:
                        type: string
                        description: >
                          Body content for the email notification. Supports HTML
                          formatting and dynamic variables.

                          Allowed HTML tags: `h1`, `h2`, `h3`, `h4`, `h5`, `br`,
                          `strong`, `em`, `a`, `s`, `code`, `u`, `ul`, `ol`,
                          `li`, `p`, `span`.

                          Dynamic variables will be automatically replaced with
                          actual values when the automation rule is triggered.
                        example: >-
                          <h3>Hello {{client.name}}</h3><p>You have been invited
                          to a meeting scheduled by {{host.name}} which will
                          start at {{client.starts_at}}</p>
                      calendar_invite_subject:
                        type: string
                        description: >
                          Subject line for the calendar invite. Dynamic
                          variables are supported and will be automatically
                          replaced

                          with actual values when the automation rule is
                          triggered.
                        example: Meeting with {{host.name}}
                      calendar_invite_body:
                        type: string
                        description: >
                          Body content for the calendar invite. Supports HTML
                          formatting and dynamic variables.

                          Allowed HTML tags: `h1`, `h2`, `h3`, `h4`, `h5`, `br`,
                          `strong`, `em`, `a`, `s`, `code`, `u`, `ul`, `ol`,
                          `li`, `p`, `span`.

                          Dynamic variables will be automatically replaced with
                          actual values when the automation rule is triggered.
                        example: >-
                          <p>Meeting scheduled for {{client.starts_at}}. Join
                          using: {{meeting.scheduling_url}}</p>
                    required:
                      - type
                      - emails
                      - email_subject
                      - email_body
                      - calendar_invite_subject
                      - calendar_invite_body
                  example:
                    - type: send_calendar_invite_to_anyone
                      emails:
                        - guest@example.com
                      email_subject: You have a meeting scheduled
                      email_body: >-
                        <h3>Hello {{client.name}}</h3><p>You have been invited
                        to a meeting scheduled by {{host.name}} which will start
                        at {{client.starts_at}}</p>
                      calendar_invite_subject: Meeting with {{host.name}}
                      calendar_invite_body: >-
                        <p>Meeting scheduled for {{client.starts_at}}. Join
                        using: {{meeting.scheduling_url}}</p>
              required:
                - event
                - meeting_ids
                - actions
      responses:
        '200':
          description: OK - Request succeeded
          content:
            application/json:
              schema:
                type: object
                properties:
                  workflow:
                    $ref: '#/components/schemas/automation_rule'
                example:
                  workflow:
                    id: efb296a3-8205-419f-8ac4-1abfc46bc3c7
                    name: Send calendar invite to guests
                    meeting_ids:
                      - 8a7794e3-3142-4569-9dd7-6411369b5d3f
                      - 9b8805f4-4253-5670-0ee8-7522470c6e4g
components:
  parameters:
    api_key_header:
      in: header
      name: X-Api-Key
      description: >-
        Use the X-Api-Key header to provide your workspace API key. Refer to
        [Authentication](/getting-started/authentication) for more information.
      required: true
      schema:
        type: string
  schemas:
    automation_rule:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the automation rule.
        name:
          type: string
          description: >-
            Name of the automation rule. If not provided during creation, an
            auto-generated name like "New Rule - 172719992" will be assigned
            based on the event.
        meeting_ids:
          type: array
          items:
            type: string
          description: >-
            Array of meeting IDs associated with this automation rule. Only
            valid meeting IDs (not template meeting IDs) are accepted.

````