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

# Editar gatilho de automação

> Edita um gatilho de automação existente. O campo `specificMessage` é obrigatório quando `triggerType` é `RECEIVE_SPECIFIC_MESSAGE`. O campo `tagId` é obrigatório quando `triggerType` é `ADD_TAG_TO_CONTACT` ou `REMOVE_TAG_FROM_CONTACT`.



## OpenAPI

````yaml POST /automation/edit
openapi: 3.1.0
info:
  title: OpenAPI Multchats
  description: Multchats API
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.multchats.com/v2
security:
  - bearerAuth: []
paths:
  /automation/edit:
    post:
      tags:
        - Automation
      summary: Editar gatilho de automação
      description: >-
        Edita um gatilho de automação existente. O campo `specificMessage` é
        obrigatório quando `triggerType` é `RECEIVE_SPECIFIC_MESSAGE`. O campo
        `tagId` é obrigatório quando `triggerType` é `ADD_TAG_TO_CONTACT` ou
        `REMOVE_TAG_FROM_CONTACT`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EditAutomationTriggerRequest'
      responses:
        '200':
          description: Gatilho editado com sucesso
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AutomationTriggerResponse'
        '400':
          description: Erro na requisição
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    EditAutomationTriggerRequest:
      allOf:
        - $ref: '#/components/schemas/CreateAutomationTriggerRequest'
        - type: object
          required:
            - automationTriggerId
          properties:
            automationTriggerId:
              description: ID do gatilho de automação
              type: string
              pattern: ^c[a-z0-9]{24}$
    AutomationTriggerResponse:
      type: object
      properties:
        success:
          description: Indica se a operação foi bem-sucedida
          type: boolean
        data:
          type: object
          properties:
            trigger:
              description: Dados do gatilho de automação
              type: object
    Error:
      required:
        - success
        - message
      type: object
      properties:
        success:
          description: Indica se a operação foi bem-sucedida
          type: boolean
          default: false
        message:
          description: Mensagem de erro (quando success é false)
          type: string
          default: Erro ao enviar mensagem
    CreateAutomationTriggerRequest:
      type: object
      required:
        - name
        - description
        - triggerType
        - automationTypebotId
        - integrations
        - automationChatType
      properties:
        name:
          description: Nome do gatilho
          type: string
          minLength: 1
          maxLength: 255
        description:
          description: Descrição do gatilho
          type: string
          minLength: 1
          maxLength: 255
        triggerType:
          $ref: '#/components/schemas/TriggerType'
          description: Tipo do gatilho
        automationTypebotId:
          description: ID da integração Typebot
          type: string
          pattern: ^c[a-z0-9]{24}$
        integrations:
          description: IDs das integrações vinculadas ao gatilho
          type: array
          items:
            type: string
            pattern: ^c[a-z0-9]{24}$
        tagId:
          description: >-
            ID da tag (obrigatório para ADD_TAG_TO_CONTACT e
            REMOVE_TAG_FROM_CONTACT)
          type: string
          pattern: ^c[a-z0-9]{24}$
          nullable: true
        specificMessage:
          description: Mensagem específica (obrigatório para RECEIVE_SPECIFIC_MESSAGE)
          type: string
          nullable: true
        inAttendance:
          description: Executar apenas quando o chat estiver em atendimento
          type: boolean
          default: false
        automationChatType:
          $ref: '#/components/schemas/AutomationChatType'
          description: Tipo de chat que o gatilho deve considerar
        delayMinutes:
          description: Atraso em minutos antes de executar a automação
          type: integer
        transferType:
          $ref: '#/components/schemas/AutomationTransferType'
          description: Tipo de transferência após a automação
        moveToQueue:
          description: Mover o chat para a fila após a automação
          type: boolean
    TriggerType:
      type: string
      enum:
        - RECEIVE_ANY_MESSAGE
        - RECEIVE_FIRST_MESSAGE
        - RECEIVE_SPECIFIC_MESSAGE
        - ADD_TAG_TO_CONTACT
        - REMOVE_TAG_FROM_CONTACT
        - RECEIVE_WEBHOOK
        - SERVICE_CONTINUITY
    AutomationChatType:
      type: string
      enum:
        - CONTACT
        - GROUP
        - ALL
    AutomationTransferType:
      type: string
      enum:
        - ALL
        - USER
        - AUTOMATION
        - API
        - AUTOMATION_AND_API
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````