# Configure Autoresponder Trigger

Configures when a follow-up campaign (autoresponder) goes out to a contact that entered its audience; refused while it is active. Email/SMS follow-ups: a delay or the date in a date-and-time field (custom-field); for days, weeks and months also a weekday window and time of day; and, only before it ever went out, whether renewed tagging with the repeat tags sends it again. Birthday follow-ups: date field and time of day. Omitted values stay; values that do not fit the kind are refused. Activates nothing.

## Input schema:

```json
{
  "type": "object",
  "properties": {
    "autoresponderId": {
      "type": "integer",
      "description": "ID of the follow-up to configure",
      "minimum": 1
    },
    "delayUnit": {
      "type": [
        "null",
        "string"
      ],
      "description": "Email/SMS follow-ups: immediately, seconds, minutes, hours, days, weeks, months or custom-field; omit to keep",
      "default": null,
      "enum": [
        "immediately",
        "seconds",
        "minutes",
        "hours",
        "days",
        "weeks",
        "months",
        "custom-field"
      ]
    },
    "delayValue": {
      "type": [
        "null",
        "integer"
      ],
      "description": "Number of delayUnit to wait, 1 to 999; not used for immediately and custom-field; omit to keep",
      "default": null,
      "minimum": 1,
      "maximum": 999
    },
    "dateFieldId": {
      "type": [
        "null",
        "string"
      ],
      "description": "For delayUnit custom-field: ID of a date-and-time field whose date the follow-up waits for",
      "default": null,
      "minLength": 1,
      "maxLength": 100
    },
    "weekdays": {
      "type": "array",
      "maxItems": 7,
      "uniqueItems": true,
      "items": {
        "type": "integer",
        "minimum": 1,
        "maximum": 7
      },
      "default": null
    },
    "sendAtTime": {
      "type": [
        "null",
        "string"
      ],
      "description": "Only for days, weeks and months: time of day \"HH:MM\" it goes out at; empty string means as soon as the delay is over; omit to keep",
      "default": null,
      "maxLength": 5
    },
    "birthdayFieldId": {
      "type": [
        "null",
        "string"
      ],
      "description": "Birthday follow-ups: ID of the date field holding the birthday; omit to keep",
      "default": null,
      "minLength": 1,
      "maxLength": 100
    },
    "birthdayTime": {
      "type": [
        "null",
        "string"
      ],
      "description": "Birthday follow-ups: time of day \"HH:MM\" it goes out on the birthday; omit to keep",
      "default": null,
      "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
    },
    "repeat": {
      "type": [
        "null",
        "boolean"
      ],
      "description": "Email/SMS follow-ups, only before it ever went out: whether renewed tagging with a repeat tag sends it again; omit to keep",
      "default": null
    },
    "repeatTagIds": {
      "type": "array",
      "maxItems": 50,
      "uniqueItems": true,
      "items": {
        "type": "integer",
        "minimum": 1
      },
      "default": null
    },
    "accountId": {
      "type": [
        "null",
        "integer"
      ],
      "description": "User ID of the account; omit for the account of the access token",
      "default": null,
      "minimum": 1
    }
  },
  "required": [
    "autoresponderId"
  ],
  "additionalProperties": false
}
```

## Output schema:

```json
{
  "type": "object",
  "required": [
    "accountId",
    "autoresponderId",
    "kind",
    "name",
    "notes",
    "labels",
    "status",
    "isSplitTest",
    "email",
    "sms",
    "trigger",
    "audience",
    "missingForActivation",
    "editUrl",
    "scheduleUrl",
    "statisticsUrl"
  ],
  "properties": {
    "accountId": {
      "type": "integer"
    },
    "autoresponderId": {
      "type": "integer"
    },
    "kind": {
      "type": "string",
      "enum": [
        "email",
        "sms",
        "birthday-email",
        "birthday-sms"
      ]
    },
    "name": {
      "type": "string"
    },
    "notes": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "draft",
        "paused",
        "scheduled",
        "active"
      ]
    },
    "labels": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "isSplitTest": {
      "type": "boolean"
    },
    "email": {
      "type": [
        "object",
        "null"
      ],
      "required": [
        "emailId",
        "subject",
        "preheader",
        "reportSpamHeader",
        "editorUrl",
        "contentUrl"
      ],
      "properties": {
        "emailId": {
          "type": "integer"
        },
        "subject": {
          "type": "string"
        },
        "preheader": {
          "type": [
            "string",
            "null"
          ]
        },
        "reportSpamHeader": {
          "type": "boolean"
        },
        "editorUrl": {
          "type": "string"
        },
        "contentUrl": {
          "type": "string"
        }
      }
    },
    "sms": {
      "type": [
        "object",
        "null"
      ],
      "required": [
        "smsId",
        "text",
        "senderName",
        "provider",
        "linkTracking",
        "contentUrl"
      ],
      "properties": {
        "smsId": {
          "type": "integer"
        },
        "text": {
          "type": "string"
        },
        "senderName": {
          "type": "string"
        },
        "provider": {
          "type": "string"
        },
        "linkTracking": {
          "type": "boolean"
        },
        "contentUrl": {
          "type": "string"
        }
      }
    },
    "trigger": {
      "type": "object",
      "required": [
        "delayUnit",
        "delayValue",
        "dateFieldId",
        "weekdays",
        "sendAtTime",
        "birthdayFieldId",
        "birthdayTime",
        "repeat",
        "repeatTagIds"
      ],
      "properties": {
        "delayUnit": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "immediately",
            "seconds",
            "minutes",
            "hours",
            "days",
            "weeks",
            "months",
            "custom-field",
            null
          ]
        },
        "delayValue": {
          "type": [
            "integer",
            "null"
          ]
        },
        "dateFieldId": {
          "type": [
            "string",
            "null"
          ]
        },
        "weekdays": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "integer"
          }
        },
        "sendAtTime": {
          "type": [
            "string",
            "null"
          ]
        },
        "birthdayFieldId": {
          "type": [
            "string",
            "null"
          ]
        },
        "birthdayTime": {
          "type": [
            "string",
            "null"
          ]
        },
        "repeat": {
          "type": "boolean"
        },
        "repeatTagIds": {
          "type": "array",
          "items": {
            "type": "integer"
          }
        }
      }
    },
    "audience": {
      "type": "object",
      "required": [
        "mode"
      ],
      "properties": {
        "mode": {
          "type": "string",
          "enum": [
            "all_contacts",
            "saved_audience",
            "tag_conditions"
          ]
        }
      },
      "additionalProperties": true
    },
    "missingForActivation": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "editUrl": {
      "type": "string"
    },
    "scheduleUrl": {
      "type": "string"
    },
    "statisticsUrl": {
      "type": "string"
    }
  }
}
```

