{
  "info": {
    "name": "Trengo API",
    "description": "REST API for the Trengo omnichannel customer-engagement platform. Bearer-token authentication; base URL https://app.trengo.com/api/v2.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      { "key": "token", "value": "{{bearerToken}}", "type": "string" }
    ]
  },
  "variable": [
    { "key": "baseUrl", "value": "https://app.trengo.com/api/v2" }
  ],
  "item": [
    {
      "name": "Tickets",
      "item": [
        {
          "name": "List all tickets",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/tickets", "host": ["{{baseUrl}}"], "path": ["tickets"] }
          }
        },
        {
          "name": "Create a ticket",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"channel_id\": 0,\n  \"contact_identifier\": \"\",\n  \"subject\": \"\"\n}", "options": { "raw": { "language": "json" } } },
            "url": { "raw": "{{baseUrl}}/tickets", "host": ["{{baseUrl}}"], "path": ["tickets"] }
          }
        },
        {
          "name": "Assign a ticket",
          "request": {
            "method": "PATCH",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"user_id\": 0,\n  \"team_id\": 0\n}", "options": { "raw": { "language": "json" } } },
            "url": { "raw": "{{baseUrl}}/tickets/:ticket_id/assign", "host": ["{{baseUrl}}"], "path": ["tickets", ":ticket_id", "assign"] }
          }
        },
        {
          "name": "Close a ticket",
          "request": {
            "method": "PATCH",
            "header": [],
            "url": { "raw": "{{baseUrl}}/tickets/:ticket_id/close", "host": ["{{baseUrl}}"], "path": ["tickets", ":ticket_id", "close"] }
          }
        }
      ]
    },
    {
      "name": "Messages",
      "item": [
        {
          "name": "List all messages",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/tickets/:ticket_id/messages", "host": ["{{baseUrl}}"], "path": ["tickets", ":ticket_id", "messages"] }
          }
        },
        {
          "name": "Send a ticket message",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"body\": \"\"\n}", "options": { "raw": { "language": "json" } } },
            "url": { "raw": "{{baseUrl}}/tickets/:ticket_id/messages", "host": ["{{baseUrl}}"], "path": ["tickets", ":ticket_id", "messages"] }
          }
        },
        {
          "name": "Send a ticket media message",
          "request": {
            "method": "POST",
            "header": [],
            "body": { "mode": "formdata", "formdata": [{ "key": "body", "value": "", "type": "text" }, { "key": "file", "type": "file", "src": [] }] },
            "url": { "raw": "{{baseUrl}}/tickets/:ticket_id/messages/media", "host": ["{{baseUrl}}"], "path": ["tickets", ":ticket_id", "messages", "media"] }
          }
        }
      ]
    },
    {
      "name": "Contacts",
      "item": [
        {
          "name": "List contacts",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/contacts", "host": ["{{baseUrl}}"], "path": ["contacts"] }
          }
        },
        {
          "name": "Create a contact",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"name\": \"\",\n  \"identifier\": \"\",\n  \"channel_id\": 0\n}", "options": { "raw": { "language": "json" } } },
            "url": { "raw": "{{baseUrl}}/contacts", "host": ["{{baseUrl}}"], "path": ["contacts"] }
          }
        },
        {
          "name": "Get a contact",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/contacts/:contact_id", "host": ["{{baseUrl}}"], "path": ["contacts", ":contact_id"] }
          }
        },
        {
          "name": "Update a contact",
          "request": {
            "method": "PUT",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"name\": \"\"\n}", "options": { "raw": { "language": "json" } } },
            "url": { "raw": "{{baseUrl}}/contacts/:contact_id", "host": ["{{baseUrl}}"], "path": ["contacts", ":contact_id"] }
          }
        },
        {
          "name": "Delete a contact",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": { "raw": "{{baseUrl}}/contacts/:contact_id", "host": ["{{baseUrl}}"], "path": ["contacts", ":contact_id"] }
          }
        }
      ]
    },
    {
      "name": "Channels",
      "item": [
        {
          "name": "List all voice channels",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/channels/voice", "host": ["{{baseUrl}}"], "path": ["channels", "voice"] }
          }
        }
      ]
    },
    {
      "name": "Teams and Users",
      "item": [
        {
          "name": "Create a team",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"name\": \"\"\n}", "options": { "raw": { "language": "json" } } },
            "url": { "raw": "{{baseUrl}}/teams", "host": ["{{baseUrl}}"], "path": ["teams"] }
          }
        },
        {
          "name": "List users",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/users", "host": ["{{baseUrl}}"], "path": ["users"] }
          }
        }
      ]
    },
    {
      "name": "Labels and Custom Fields",
      "item": [
        {
          "name": "Attach a label to a ticket",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"label_id\": 0\n}", "options": { "raw": { "language": "json" } } },
            "url": { "raw": "{{baseUrl}}/tickets/:ticket_id/labels", "host": ["{{baseUrl}}"], "path": ["tickets", ":ticket_id", "labels"] }
          }
        },
        {
          "name": "Create a custom field",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"title\": \"\",\n  \"type\": \"TEXT\"\n}", "options": { "raw": { "language": "json" } } },
            "url": { "raw": "{{baseUrl}}/custom_fields", "host": ["{{baseUrl}}"], "path": ["custom_fields"] }
          }
        }
      ]
    },
    {
      "name": "Webhooks",
      "item": [
        {
          "name": "Create a webhook",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"url\": \"\",\n  \"name\": \"\"\n}", "options": { "raw": { "language": "json" } } },
            "url": { "raw": "{{baseUrl}}/webhooks", "host": ["{{baseUrl}}"], "path": ["webhooks"] }
          }
        },
        {
          "name": "Update a webhook",
          "request": {
            "method": "PUT",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"url\": \"\"\n}", "options": { "raw": { "language": "json" } } },
            "url": { "raw": "{{baseUrl}}/webhooks/:webhook_id", "host": ["{{baseUrl}}"], "path": ["webhooks", ":webhook_id"] }
          }
        },
        {
          "name": "Delete a webhook",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": { "raw": "{{baseUrl}}/webhooks/:webhook_id", "host": ["{{baseUrl}}"], "path": ["webhooks", ":webhook_id"] }
          }
        }
      ]
    },
    {
      "name": "WhatsApp",
      "item": [
        {
          "name": "Send a WhatsApp template",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"recipient_phone_number\": \"\",\n  \"hsm_id\": 0,\n  \"channel_id\": 0,\n  \"params\": []\n}", "options": { "raw": { "language": "json" } } },
            "url": { "raw": "{{baseUrl}}/whatsapp/messages", "host": ["{{baseUrl}}"], "path": ["whatsapp", "messages"] }
          }
        }
      ]
    }
  ]
}
