{
  "app": {
    "name": "sendinbox",
    "title": "SendInbox",
    "description": "Email-рассылки, транзакционные письма, подписчики, автоматизации и события SendInbox поверх REST API v1.",
    "homepage": "https://app.working-esender.ru",
    "docs": "https://app.working-esender.ru/developers",
    "language": "ru"
  },
  "auth": {
    "type": "api_key",
    "fields": [
      {
        "name": "apiKey",
        "title": "API-ключ",
        "type": "string",
        "secret": true,
        "required": true,
        "help": "Кабинет SendInbox → Настройки → API-ключи (sk_live_…)."
      },
      {
        "name": "baseUrl",
        "title": "Базовый URL API",
        "type": "string",
        "required": false,
        "default": "https://app.working-esender.ru/api/v1",
        "help": "Измените для собственного/white-label домена."
      }
    ],
    "request": {
      "headers": { "Authorization": "Bearer {{auth.apiKey}}" }
    },
    "test": { "method": "GET", "url": "{{auth.baseUrl}}/me" }
  },
  "triggers": [
    {
      "name": "email_event",
      "title": "Событие письма",
      "description": "Мгновенное срабатывание на событие: доставка, открытие, клик, отписка, жалоба, возврат.",
      "type": "webhook",
      "subscribe": {
        "method": "POST",
        "url": "{{auth.baseUrl}}/hooks",
        "body": { "url": "{{webhook.url}}", "events": "{{parameters.events}}" },
        "result": { "id": "{{response.id}}" }
      },
      "unsubscribe": { "method": "DELETE", "url": "{{auth.baseUrl}}/hooks/{{subscription.id}}" },
      "parameters": [
        {
          "name": "events",
          "title": "Типы событий",
          "type": "multiselect",
          "options": ["sent", "delivered", "open", "click", "hard_bounce", "soft_bounce", "spam", "unsubscribe", "deferred"],
          "default": ["delivered", "open", "click"]
        }
      ],
      "payload_example": {
        "type": "click",
        "email": "user@mail.ru",
        "messageId": "msg_abc123",
        "url": "https://example.ru/promo",
        "occurredAt": "2026-07-19T10:00:00.000Z"
      }
    },
    {
      "name": "new_subscriber",
      "title": "Новый подписчик",
      "description": "Периодический опрос новых подписчиков аккаунта.",
      "type": "polling",
      "poll": { "method": "GET", "url": "{{auth.baseUrl}}/subscribers?limit=50&order=desc" },
      "dedup_key": "id"
    }
  ],
  "actions": [
    {
      "name": "send_email",
      "title": "Отправить письмо",
      "description": "Транзакционное письмо с подтверждённого домена (DKIM, трекинг, учёт suppression и квоты).",
      "request": { "method": "POST", "url": "{{auth.baseUrl}}/emails" },
      "fields": [
        { "name": "to", "title": "Кому", "type": "string", "required": true },
        { "name": "from.email", "title": "От (email)", "type": "string", "required": true },
        { "name": "from.name", "title": "От (имя)", "type": "string" },
        { "name": "subject", "title": "Тема", "type": "string", "required": true },
        { "name": "html", "title": "HTML", "type": "text" },
        { "name": "text", "title": "Текст", "type": "text" },
        { "name": "templateId", "title": "ID шаблона", "type": "string" },
        { "name": "variables", "title": "Переменные", "type": "object" }
      ]
    },
    {
      "name": "add_subscriber",
      "title": "Добавить подписчика",
      "request": { "method": "POST", "url": "{{auth.baseUrl}}/subscribers" },
      "fields": [
        { "name": "email", "title": "Email", "type": "string", "required": true },
        { "name": "name", "title": "Имя", "type": "string" },
        { "name": "list", "title": "ID списка", "type": "string" }
      ]
    },
    {
      "name": "trigger_automation",
      "title": "Запустить автоматизацию по событию",
      "request": { "method": "POST", "url": "{{auth.baseUrl}}/automations/trigger" },
      "fields": [
        { "name": "event", "title": "Событие", "type": "string", "required": true },
        { "name": "email", "title": "Email", "type": "string", "required": true },
        { "name": "data", "title": "Данные", "type": "object" }
      ]
    }
  ]
}
