{
  "info": {
    "name": "Mimin Omnichannel API",
    "description": "Requests from the Mimin Omnichannel API guide (https://docs.mimin.io/omnichannel-api). Contains placeholder values only — run Login with your own account first.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [
    {
      "name": "Login",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/auth/login",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "auth",
            "login"
          ]
        },
        "description": "Exchange your e-mail and password for an access token.",
        "auth": {
          "type": "noauth"
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"email\": \"\",\n  \"password\": \"\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      },
      "response": [],
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "// Saves the token so every other request can use it.",
              "pm.collectionVariables.set(\"token\", pm.response.json().token);"
            ]
          }
        }
      ]
    },
    {
      "name": "Create customer",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/customer/create",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "customer",
            "create"
          ]
        },
        "description": "Register a new customer (name and phone number).",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"name\": \"{{your_customer_name}}\",\n  \"phone\": \"{{your_customer_phone}}\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      },
      "response": []
    },
    {
      "name": "List customers",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{base_url}}/customer/get?order=_id&sort=1&page=1&limit=10&value=",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "customer",
            "get"
          ],
          "query": [
            {
              "key": "order",
              "value": "_id"
            },
            {
              "key": "sort",
              "value": "1"
            },
            {
              "key": "page",
              "value": "1"
            },
            {
              "key": "limit",
              "value": "10"
            },
            {
              "key": "value",
              "value": ""
            }
          ]
        },
        "description": "Get your customers, page by page, with optional search."
      },
      "response": []
    },
    {
      "name": "Create chatroom",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/message/create",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "message",
            "create"
          ]
        },
        "description": "Start a new conversation (chatroom) with a customer.",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"name\": \"Budi Santoso\",\n  \"phone\": \"6281234567890\",\n  \"priority\": \"\",\n  \"message_label\": [],\n  \"message_inbox\": \"665f1a2b3c4d5e6f7a8b9c02\",\n  \"notes\": \"\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      },
      "response": []
    },
    {
      "name": "List conversations",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{base_url}}/message/get?limit=10&page=1&sort=-1&customer=665f1a2b3c4d5e6f7a8b9c01",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "message",
            "get"
          ],
          "query": [
            {
              "key": "limit",
              "value": "10"
            },
            {
              "key": "page",
              "value": "1"
            },
            {
              "key": "sort",
              "value": "-1"
            },
            {
              "key": "customer",
              "value": "665f1a2b3c4d5e6f7a8b9c01"
            }
          ]
        },
        "description": "Get your conversations (chatrooms), with filters and pagination."
      },
      "response": []
    },
    {
      "name": "Send message",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/message/send/:messageId",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "message",
            "send",
            ":messageId"
          ],
          "variable": [
            {
              "key": "messageId",
              "value": "665f1a2b3c4d5e6f7a8b9c0d"
            }
          ]
        },
        "description": "Send a reply (text and/or media) into an existing chatroom.",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"text\": \"Hello, this is a reply from the API\",\n  \"private\": false,\n  \"context_id\": \"\",\n  \"additional_data\": {}\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      },
      "response": []
    }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{token}}",
        "type": "string"
      }
    ]
  },
  "variable": [
    {
      "key": "base_url",
      "value": "https://mimin-api.mimin.io/mimin-backend/api/v1"
    },
    {
      "key": "token",
      "value": ""
    }
  ]
}
