openapi: 3.0.4
info:
  title: Evolution Foundation - CRM Service - Macros
  description: Management of contacts, conversations, inboxes, labels and macros
  version: 1.1.0
servers:
- url: https://api.evoai.app
  description: Production server
- url: http://localhost:3000
  description: Development server
  variables:
    port:
      default: '3000'
- url: '{customUrl}'
  description: Custom server
  variables:
    customUrl:
      default: https://your-instance.com
      description: Enter your server URL
paths:
  /api/v1/macros:
    get:
      summary: List all macros
      description: 'Returns paginated list of macros available to the user.

        Includes personal macros (created by the user) and global macros (available to the entire account).

        '
      operationId: listMacros
      security:
      - userApiKey: []
      parameters:
      - name: page
        in: query
        description: Page number for pagination
        schema:
          type: integer
          default: 1
          minimum: 1
      - name: per_page
        in: query
        description: Number of macros per page
        schema:
          type: integer
          default: 20
          minimum: 1
          maximum: 100
      responses:
        '200':
          description: Macros retrieved successfully
          content:
            application/json:
              schema:
                type: object
                required:
                - success
                - data
                - meta
                - message
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Macro'
                  meta:
                    type: object
                    properties:
                      pagination:
                        type: object
                        properties:
                          page:
                            type: integer
                            description: Current page number
                            example: 1
                          pageSize:
                            type: integer
                            description: Number of items per page
                            example: 20
                          total:
                            type: integer
                            description: Total number of macros
                            example: 1
                          totalPages:
                            type: integer
                            description: Total number of pages
                            example: 1
                          hasNextPage:
                            type: boolean
                            nullable: true
                            description: Whether there is a next page
                            example: null
                          hasPreviousPage:
                            type: boolean
                            nullable: true
                            description: Whether there is a previous page
                            example: null
                      timestamp:
                        type: string
                        format: date-time
                        description: Response timestamp
                        example: '2024-01-15T10:30:00Z'
                  message:
                    type: string
                    description: Success message
                    example: Macros retrieved successfully
              example:
                success: true
                data:
                - id: 550e8400-e29b-41d4-a716-446655440000
                  name: Example Macro
                  account_id: 123e4567-e89b-12d3-a456-426614174000
                  visibility: personal
                  actions:
                  - action_name: send_message
                    action_params:
                    - Hello, how can I help you?
                  created_by_id: 660e8400-e29b-41d4-a716-446655440001
                  updated_by_id: 660e8400-e29b-41d4-a716-446655440001
                  created_at: '2024-01-15T10:30:00Z'
                  updated_at: '2024-01-15T10:30:00Z'
                meta:
                  pagination:
                    page: 1
                    pageSize: 20
                    total: 1
                    totalPages: 1
                    hasNextPage: null
                    hasPreviousPage: null
                  timestamp: '2024-01-15T10:30:00Z'
                message: Macros retrieved successfully
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                bad_request:
                  summary: Invalid request data
                  value:
                    success: false
                    error:
                      code: BAD_REQUEST
                      message: Invalid request data
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros
                      method: GET
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  summary: Unauthorized
                  value:
                    success: false
                    error:
                      code: UNAUTHORIZED
                      message: Unauthorized
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros
                      method: GET
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                forbidden:
                  summary: Forbidden
                  value:
                    success: false
                    error:
                      code: FORBIDDEN
                      message: Forbidden
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros
                      method: GET
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                internal_error:
                  summary: Internal server error
                  value:
                    success: false
                    error:
                      code: INTERNAL_ERROR
                      message: An internal server error occurred
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros
                      method: GET
    post:
      summary: Create a new macro
      description: Creates a new macro with the specified actions
      operationId: createMacro
      security:
      - userApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MacroInput'
      responses:
        '200':
          description: Macro created successfully
          content:
            application/json:
              schema:
                type: object
                required:
                - success
                - data
                - meta
                - message
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: '#/components/schemas/Macro'
                  meta:
                    type: object
                    properties:
                      timestamp:
                        type: string
                        format: date-time
                        description: Response timestamp
                        example: '2024-01-15T10:30:00Z'
                  message:
                    type: string
                    description: Success message
                    example: Macro created successfully
              example:
                success: true
                data:
                  id: 550e8400-e29b-41d4-a716-446655440000
                  name: Example Macro
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                message: Macro created successfully
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                bad_request:
                  summary: Invalid request data
                  value:
                    success: false
                    error:
                      code: BAD_REQUEST
                      message: Invalid request data
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros
                      method: POST
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  summary: Unauthorized
                  value:
                    success: false
                    error:
                      code: UNAUTHORIZED
                      message: Unauthorized
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros
                      method: POST
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                forbidden:
                  summary: Forbidden
                  value:
                    success: false
                    error:
                      code: FORBIDDEN
                      message: Forbidden
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros
                      method: POST
        '422':
          description: Unprocessable Entity (validation error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                validation_error:
                  summary: Validation error
                  value:
                    success: false
                    error:
                      code: VALIDATION_ERROR
                      message: Validation error
                      details:
                        name: Name is required
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros
                      method: POST
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                internal_error:
                  summary: Internal server error
                  value:
                    success: false
                    error:
                      code: INTERNAL_ERROR
                      message: An internal server error occurred
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros
                      method: POST
  /api/v1/macros/{id}:
    parameters:
    - name: id
      in: path
      required: true
      description: Macro ID (UUID)
      schema:
        type: string
        format: uuid
    get:
      summary: Get macro details
      description: Returns complete details of a specific macro
      operationId: getMacro
      security:
      - userApiKey: []
      responses:
        '200':
          description: Macro retrieved successfully
          content:
            application/json:
              schema:
                type: object
                required:
                - success
                - data
                - meta
                - message
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: '#/components/schemas/Macro'
                  meta:
                    type: object
                    properties:
                      timestamp:
                        type: string
                        format: date-time
                        description: Response timestamp
                        example: '2024-01-15T10:30:00Z'
                  message:
                    type: string
                    description: Success message
                    example: Macro retrieved successfully
              example:
                success: true
                data:
                  id: 5d83859d-3d52-4a26-a14f-27c63c868be5
                  name: Commercial Leader
                  account_id: 37a1e39b-3579-47c2-bbb3-84829deae585
                  visibility: personal
                  actions:
                  - action_name: send_message
                    action_params:
                    - Good afternoon, how are you?
                  created_by_id: fc8ec60f-904f-4793-878d-e1534bcedee5
                  updated_by_id: fc8ec60f-904f-4793-878d-e1534bcedee5
                  created_at: '2026-01-22T19:56:36Z'
                  updated_at: '2026-01-22T19:56:36Z'
                meta:
                  timestamp: '2026-02-05T17:05:32Z'
                message: Macro retrieved successfully
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                bad_request:
                  summary: Invalid request data
                  value:
                    success: false
                    error:
                      code: BAD_REQUEST
                      message: Invalid request data
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros/{id}
                      method: GET
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  summary: Unauthorized
                  value:
                    success: false
                    error:
                      code: UNAUTHORIZED
                      message: Unauthorized
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros/{id}
                      method: GET
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                forbidden:
                  summary: Forbidden
                  value:
                    success: false
                    error:
                      code: FORBIDDEN
                      message: Forbidden
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros/{id}
                      method: GET
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                not_found:
                  summary: Macro not found
                  value:
                    success: false
                    error:
                      code: NOT_FOUND
                      message: Macro not found
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros/{id}
                      method: GET
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                internal_error:
                  summary: Internal server error
                  value:
                    success: false
                    error:
                      code: INTERNAL_ERROR
                      message: An internal server error occurred
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros/{id}
                      method: GET
    patch:
      summary: Update a macro
      description: Updates data of an existing macro
      operationId: updateMacro
      security:
      - userApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MacroInput'
      responses:
        '200':
          description: Macro updated successfully
          content:
            application/json:
              schema:
                type: object
                required:
                - success
                - data
                - meta
                - message
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: '#/components/schemas/Macro'
                  meta:
                    type: object
                    properties:
                      timestamp:
                        type: string
                        format: date-time
                        description: Response timestamp
                        example: '2024-01-15T10:30:00Z'
                  message:
                    type: string
                    description: Success message
                    example: Macro updated successfully
              example:
                success: true
                data:
                  id: 550e8400-e29b-41d4-a716-446655440000
                  name: Example Macro
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                message: Macro updated successfully
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                bad_request:
                  summary: Invalid request data
                  value:
                    success: false
                    error:
                      code: BAD_REQUEST
                      message: Invalid request data
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros/{id}
                      method: PATCH
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  summary: Unauthorized
                  value:
                    success: false
                    error:
                      code: UNAUTHORIZED
                      message: Unauthorized
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros/{id}
                      method: PATCH
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                forbidden:
                  summary: Forbidden
                  value:
                    success: false
                    error:
                      code: FORBIDDEN
                      message: Forbidden
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros/{id}
                      method: PATCH
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                not_found:
                  summary: Macro not found
                  value:
                    success: false
                    error:
                      code: NOT_FOUND
                      message: Macro not found
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros/{id}
                      method: PATCH
        '422':
          description: Unprocessable Entity (validation error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                validation_error:
                  summary: Validation error
                  value:
                    success: false
                    error:
                      code: VALIDATION_ERROR
                      message: Validation error
                      details:
                        name: Name is required
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros/{id}
                      method: PATCH
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                internal_error:
                  summary: Internal server error
                  value:
                    success: false
                    error:
                      code: INTERNAL_ERROR
                      message: An internal server error occurred
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros/{id}
                      method: PATCH
    delete:
      summary: Delete a macro
      description: Permanently deletes a macro
      operationId: deleteMacro
      security:
      - userApiKey: []
      responses:
        '200':
          description: Macro deleted successfully
          content:
            application/json:
              schema:
                type: object
                required:
                - success
                - data
                - meta
                - message
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    nullable: true
                    description: Null for delete operations
                    example: null
                  meta:
                    type: object
                    properties:
                      timestamp:
                        type: string
                        format: date-time
                        description: Response timestamp
                        example: '2024-01-15T10:30:00Z'
                  message:
                    type: string
                    description: Success message
                    example: Macro deleted successfully
              example:
                success: true
                data: null
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                message: Macro deleted successfully
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                bad_request:
                  summary: Invalid request data
                  value:
                    success: false
                    error:
                      code: BAD_REQUEST
                      message: Invalid request data
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros/{id}
                      method: DELETE
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  summary: Unauthorized
                  value:
                    success: false
                    error:
                      code: UNAUTHORIZED
                      message: Unauthorized
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros/{id}
                      method: DELETE
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                forbidden:
                  summary: Forbidden
                  value:
                    success: false
                    error:
                      code: FORBIDDEN
                      message: Forbidden
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros/{id}
                      method: DELETE
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                not_found:
                  summary: Macro not found
                  value:
                    success: false
                    error:
                      code: NOT_FOUND
                      message: Macro not found
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros/{id}
                      method: DELETE
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                internal_error:
                  summary: Internal server error
                  value:
                    success: false
                    error:
                      code: INTERNAL_ERROR
                      message: An internal server error occurred
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros/{id}
                      method: DELETE
  /api/v1/macros/{id}/execute:
    post:
      summary: Execute a macro
      description: 'Executes all macro actions in the specified conversations.

        Execution is processed in the background via Sidekiq.

        '
      operationId: executeMacro
      security:
      - userApiKey: []
      parameters:
      - name: id
        in: path
        required: true
        description: Macro ID (UUID)
        schema:
          type: string
          format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - conversation_ids
              properties:
                conversation_ids:
                  type: array
                  description: List of conversation IDs where the macro will be executed
                  items:
                    type: integer
                  minItems: 1
                  example:
                  - 123
                  - 456
                  - 789
      responses:
        '200':
          description: Macro execution completed
          content:
            application/json:
              schema:
                type: object
                required:
                - success
                - data
                - meta
                - message
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    description: Execution data
                    properties:
                      macro_id:
                        type: string
                        format: uuid
                        example: 237efe50-a4fd-4a04-a43e-76a1e739ba9b
                      conversation_ids:
                        type: array
                        nullable: true
                        items:
                          type: integer
                        description: List of conversation IDs where the macro was executed (null if no conversations specified)
                        example: null
                  meta:
                    type: object
                    properties:
                      timestamp:
                        type: string
                        format: date-time
                        description: Response timestamp
                        example: '2026-02-05T17:10:07Z'
                  message:
                    type: string
                    description: Success message
                    example: Macro execution completed
              example:
                success: true
                data:
                  macro_id: 237efe50-a4fd-4a04-a43e-76a1e739ba9b
                  conversation_ids: null
                meta:
                  timestamp: '2026-02-05T17:10:07Z'
                message: Macro execution completed
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                bad_request:
                  summary: Invalid request data
                  value:
                    success: false
                    error:
                      code: BAD_REQUEST
                      message: Invalid request data
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros/{id}/execute
                      method: POST
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  summary: Unauthorized
                  value:
                    success: false
                    error:
                      code: UNAUTHORIZED
                      message: Unauthorized
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros/{id}/execute
                      method: POST
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                forbidden:
                  summary: Forbidden
                  value:
                    success: false
                    error:
                      code: FORBIDDEN
                      message: Forbidden
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros/{id}/execute
                      method: POST
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                not_found:
                  summary: Macro not found
                  value:
                    success: false
                    error:
                      code: NOT_FOUND
                      message: Macro not found
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros/{id}/execute
                      method: POST
        '422':
          description: Unprocessable Entity (validation error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                validation_error:
                  summary: Validation error
                  value:
                    success: false
                    error:
                      code: VALIDATION_ERROR
                      message: Validation error
                      details:
                        conversation_ids: At least one conversation ID is required
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros/{id}/execute
                      method: POST
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                internal_error:
                  summary: Internal server error
                  value:
                    success: false
                    error:
                      code: INTERNAL_ERROR
                      message: An internal server error occurred
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/macros/{id}/execute
                      method: POST
components:
  schemas:
    ErrorResponse:
      type: object
      required:
      - success
      - error
      - meta
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          required:
          - code
          - message
          properties:
            code:
              type: string
              example: VALIDATION_ERROR
            message:
              type: string
              example: Validation failed
            details:
              type: object
              additionalProperties: true
              nullable: true
        meta:
          type: object
          required:
          - timestamp
          - path
          - method
          properties:
            timestamp:
              type: string
              format: date-time
              example: '2024-01-15T10:30:00Z'
            path:
              type: string
              example: /public/api/v1/inboxes/{inbox_identifier}/contacts
            method:
              type: string
              example: POST
    Macro:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique macro ID
          example: 550e8400-e29b-41d4-a716-446655440000
        name:
          type: string
          description: Macro name
          example: Resolver e agradecer cliente
        visibility:
          type: string
          description: Visibilidade da macro
          enum:
          - personal
          - global
          example: global
        actions:
          type: array
          description: List of actions that will be executed
          items:
            $ref: '#/components/schemas/MacroAction'
        files:
          type: array
          description: Files attached to the macro (for send_attachment action)
          items:
            type: object
            properties:
              id:
                type: string
                format: uuid
                example: 550e8400-e29b-41d4-a716-446655440000
              macro_id:
                type: string
                format: uuid
                example: 550e8400-e29b-41d4-a716-446655440000
              file_type:
                type: string
                example: application/pdf
              file_url:
                type: string
                format: uri
                example: https://cdn.evoai.com/files/document.pdf
              blob_id:
                type: string
                format: uuid
                example: 550e8400-e29b-41d4-a716-446655440000
              filename:
                type: string
                example: document.pdf
        account_id:
          type: string
          format: uuid
          description: Account ID
          example: 123e4567-e89b-12d3-a456-426614174000
        created_by_id:
          type: string
          format: uuid
          description: ID of the user who created the macro
          nullable: true
          example: 987e6543-e21b-12d3-a456-426614174111
        updated_by_id:
          type: string
          format: uuid
          description: ID of the user who last updated the macro
          nullable: true
          example: 987e6543-e21b-12d3-a456-426614174111
        created_at:
          type: string
          format: date-time
          example: '2025-01-10T12:00:00Z'
        updated_at:
          type: string
          format: date-time
          example: '2025-01-13T14:30:00Z'
    MacroAction:
      type: object
      required:
      - action_name
      - action_params
      properties:
        action_name:
          type: string
          description: Name of the action to be executed
          enum:
          - send_message
          - add_label
          - assign_team
          - assign_agent
          - mute_conversation
          - change_status
          - remove_label
          - remove_assigned_team
          - resolve_conversation
          - snooze_conversation
          - change_priority
          - send_email_transcript
          - send_attachment
          - add_private_note
          - send_webhook_event
          example: send_message
        action_params:
          type: array
          description: Action parameters (varies according to action type)
          items:
            oneOf:
            - type: string
            - type: integer
            - type: boolean
            - type: object
          example:
          - Obrigado por entrar em contato! Seu problema foi resolvido.
      example:
        action_name: send_message
        action_params:
        - Obrigado por entrar em contato!
    MacroInput:
      type: object
      required:
      - name
      - actions
      properties:
        name:
          type: string
          description: Macro name
          minLength: 1
          maxLength: 255
          example: Resolver e agradecer cliente
        visibility:
          type: string
          description: Macro visibility (agents can only create personal)
          enum:
          - personal
          - global
          default: personal
          example: global
        actions:
          type: array
          description: List of actions that will be executed
          minItems: 1
          items:
            $ref: '#/components/schemas/MacroAction'
  securitySchemes:
    userApiKey:
      type: apiKey
      in: header
      name: api_access_token
    ApiAccessToken:
      type: apiKey
      in: header
      name: api_access_token
      description: API access token for user authentication
