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

# Criar Ações

> Cria uma nova ação de inatividade



## OpenAPI

````yaml POST /v2/agent/{agentId}/idle-actions
openapi: 3.0.1
info:
  title: OpenAPI GPT Maker
  description: Documentação completa da API do GPT Maker
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.gptmaker.ai
security:
  - bearerAuth: []
paths:
  /v2/agent/{agentId}/idle-actions:
    post:
      description: Cria uma nova ação de inatividade
      parameters:
        - name: agentId
          in: path
          description: Id do agente
          required: true
          schema:
            type: string
      requestBody:
        description: Configuração de ações de inatividade a ser criada/atualizada
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                actions:
                  type: array
                  items:
                    type: object
                    properties:
                      instructions:
                        type: string
                        description: Mensagem ou instruções da ação
                      seconds:
                        type: integer
                        description: Tempo em segundos de inatividade para disparar a ação
                      allowAllHours:
                        type: boolean
                        default: true
                        description: >-
                          Define se deve ser executada em qualquer horário ou
                          não, se for true não colocamos workingHours
                      workingHours:
                        type: array
                        nullable: true
                        items:
                          type: object
                          properties:
                            dayWeek:
                              type: integer
                              description: 0=Domingo, 1=Segunda, ..., 6=Sábado
                            active:
                              type: boolean
                              description: Define se o dia está ativo
                            hours:
                              type: array
                              items:
                                type: object
                                properties:
                                  start:
                                    type: string
                                    example: '08:00'
                                  end:
                                    type: string
                                    example: '12:00'
                finishOn:
                  type: object
                  properties:
                    seconds:
                      type: integer
                      description: Tempo total (em segundos) para finalizar a interação
      responses:
        '200':
          description: Configuração de ações de inatividade criada com sucesso
          content:
            application/json:
              schema:
                type: object
                properties:
                  actions:
                    type: array
                    description: Lista de ações configuradas para inatividade
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: Identificador da ação criada
                        type:
                          type: string
                          enum:
                            - SEND_MESSAGE
                            - TEMP_BLOCK
                            - FINISH_INTERACTION
                          description: Tipo da ação de inatividade
                        instructions:
                          type: string
                          nullable: true
                          description: Mensagem/instruções da ação
                        workingHours:
                          type: object
                          nullable: true
                          description: Horários de funcionamento aplicáveis à ação
                          properties:
                            id:
                              type: string
                            tenant:
                              type: string
                            tenantOwner:
                              type: string
                            createdAt:
                              type: integer
                            updatedAt:
                              type: integer
                              nullable: true
                            active:
                              type: boolean
                            days:
                              type: array
                              items:
                                type: object
                                properties:
                                  id:
                                    type: string
                                  tenant:
                                    type: string
                                  tenantOwner:
                                    type: string
                                  createdAt:
                                    type: integer
                                  updatedAt:
                                    type: integer
                                    nullable: true
                                  active:
                                    type: boolean
                                  dayWeek:
                                    type: integer
                                    description: 0=Domingo ... 6=Sábado
                                  hours:
                                    type: array
                                    items:
                                      type: object
                                      properties:
                                        id:
                                          type: string
                                        tenant:
                                          type: string
                                        tenantOwner:
                                          type: string
                                        createdAt:
                                          type: integer
                                        updatedAt:
                                          type: integer
                                          nullable: true
                                        start:
                                          type: string
                                          example: '08:00'
                                        end:
                                          type: string
                                          example: '12:00'
                                        sequence:
                                          type: integer
                        allowAllHours:
                          type: boolean
                          description: Indica se a ação pode ocorrer em qualquer horário
                        seconds:
                          type: integer
                          description: Tempo de inatividade (s) para disparo da ação
                  finishOn:
                    type: object
                    description: Configuração para finalização automática
                    properties:
                      seconds:
                        type: integer
                        description: Tempo total (s) para finalizar a interação
        '400':
          description: Erro inesperado
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Erro de token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error403'
components:
  schemas:
    Error:
      required:
        - error
      type: object
      properties:
        error:
          type: string
    Error403:
      required:
        - error
      type: object
      properties:
        error:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````