{
  "info": {
    "_postman_id": "3f61991c-3ae6-42d2-a0da-8955e3f1714f",
    "name": "OnlineAsistan Sağlayıcı API v1",
    "description": "Kendi yazılımınızda AÇACAĞINIZ uçlar. Biz çağırırız, siz cevaplarsınız.\n\nKULLANIM\n1. Ortamı (environment) içe aktarın, base_url / client_id / client_secret girin.\n2. Klasörleri SIRAYLA çalıştırın (Runner ile toplu da çalışır).\n3. Her istekte zarf ve alan sınamaları var; hepsi yeşilse sözleşmeye uygunsunuz.\n\nSözleşme metni: ornekler/SAGLAYICI-API.md · https://onlineasistan.net/entegrasyon",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "yol",
      "value": "/api/onlineasistan/v1",
      "description": "Yol öneki. ISS Manager kullanıyorsanız /api/iss/v2 yazın."
    }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{access_token}}"
      }
    ]
  },
  "item": [
    {
      "name": "1 · Kimlik (zorunlu)",
      "item": [
        {
          "name": "Jeton al",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-Request-Id",
                "value": "{{$guid}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}{{yol}}/auth/token"
            },
            "description": "Basic client_id:client_secret → Bearer jeton. Jeton ortama yazılır.",
            "auth": {
              "type": "basic",
              "basic": [
                {
                  "key": "username",
                  "value": "{{client_id}}"
                },
                {
                  "key": "password",
                  "value": "{{client_secret}}"
                }
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"grant_type\": \"client_credentials\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": [],
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const g = pm.response.json();",
                  "pm.test('Zarf var (data / meta / errors)', function () {",
                  "    pm.expect(g).to.have.property('data');",
                  "    pm.expect(g).to.have.property('errors');",
                  "});",
                  "pm.test('errors dizi ve boş', function () {",
                  "    pm.expect(g.errors, 'errors dizi olmalı').to.be.an('array');",
                  "    pm.expect(g.errors.length, JSON.stringify(g.errors)).to.eql(0);",
                  "});",
                  "const d = pm.response.json().data || {};",
                  "pm.test('access_token geldi', () => pm.expect(d.access_token, 'access_token boş').to.be.a('string').and.not.empty);",
                  "pm.test('expires_in sayı', () => pm.expect(Number(d.expires_in)).to.be.above(0));",
                  "pm.environment.set('access_token', d.access_token);"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "2 · Zorunlu uçlar",
      "item": [
        {
          "name": "Müşteri ara (telefonla)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-Request-Id",
                "value": "{{$guid}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}{{yol}}/customers/find?find={{test_telefon}}&records=5&page=0",
              "query": [
                {
                  "key": "find",
                  "value": "{{test_telefon}}"
                },
                {
                  "key": "records",
                  "value": "5"
                },
                {
                  "key": "page",
                  "value": "0"
                }
              ]
            },
            "description": "Telefon 10 hane, başında 0 YOK. Kayıt yoksa records: [] dönün (hata değil)."
          },
          "response": [],
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const g = pm.response.json();",
                  "pm.test('Zarf var (data / meta / errors)', function () {",
                  "    pm.expect(g).to.have.property('data');",
                  "    pm.expect(g).to.have.property('errors');",
                  "});",
                  "pm.test('errors dizi ve boş', function () {",
                  "    pm.expect(g.errors, 'errors dizi olmalı').to.be.an('array');",
                  "    pm.expect(g.errors.length, JSON.stringify(g.errors)).to.eql(0);",
                  "});",
                  "const d = pm.response.json().data || {};",
                  "const kayitlar = d.records || d.rows || d.customers || (Array.isArray(d) ? d : []);",
                  "pm.test('records dizisi var', () => pm.expect(kayitlar).to.be.an('array'));",
                  "if (kayitlar.length) {",
                  "    const k = kayitlar[0];",
                  "    pm.test('abone_no var', () => pm.expect(String(k.abone_no || '')).to.not.be.empty);",
                  "    pm.test('ad-soyad MASKESİZ', function () {",
                  "        const ad = String(k.isim || '') + String(k.soyisim || '');",
                  "        pm.expect(ad, 'maskeli ad asistanın adıyla hitap etmesini engeller').to.not.include('*');",
                  "    });",
                  "    pm.test('para alanı tutarlı', function () {",
                  "        if (k.toplam_borc === undefined || k.toplam_borc === null) return;",
                  "        const tip = typeof k.toplam_borc;",
                  "        pm.expect(['number', 'string']).to.include(tip);",
                  "    });",
                  "    (k.faturalar || []).forEach(function (f) {",
                  "        pm.test('fatura_no var (tekilleştirme için şart)', () => pm.expect(String(f.fatura_no || '')).to.not.be.empty);",
                  "    });",
                  "    pm.environment.set('abone_no', String(k.abone_no || ''));",
                  "}"
                ]
              }
            }
          ]
        },
        {
          "name": "Kimlik doğrula — YANLIŞ bilgi",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-Request-Id",
                "value": "{{$guid}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}{{yol}}/agent/verify"
            },
            "description": "Yanlış bilgide dogrulandi:false + kalan_deneme beklenir.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"abone_no\": \"{{abone_no}}\",\n  \"arayan_no\": \"{{test_telefon}}\",\n  \"ad_soyad\": \"Olmayan Kisi\",\n  \"tc_son4\": \"0000\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": [],
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const g = pm.response.json();",
                  "pm.test('Zarf var (data / meta / errors)', function () {",
                  "    pm.expect(g).to.have.property('data');",
                  "    pm.expect(g).to.have.property('errors');",
                  "});",
                  "pm.test('errors dizi ve boş', function () {",
                  "    pm.expect(g.errors, 'errors dizi olmalı').to.be.an('array');",
                  "    pm.expect(g.errors.length, JSON.stringify(g.errors)).to.eql(0);",
                  "});",
                  "const r = (pm.response.json().data || {}).result || pm.response.json().data || {};",
                  "pm.test('dogrulandi false', () => pm.expect(Boolean(r.dogrulandi)).to.eql(false));",
                  "pm.test('kalan_deneme bildirilmiş', () => pm.expect(r).to.have.property('kalan_deneme'));"
                ]
              }
            }
          ]
        },
        {
          "name": "Kimlik doğrula — DOĞRU bilgi",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-Request-Id",
                "value": "{{$guid}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}{{yol}}/agent/verify"
            },
            "description": "Doğru bilgide dogrulandi:true. Birden çok kayıt varsa abonelikler[] doldurun.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"abone_no\": \"{{abone_no}}\",\n  \"arayan_no\": \"{{test_telefon}}\",\n  \"ad_soyad\": \"{{test_ad_soyad}}\",\n  \"tc_son4\": \"{{test_tc_son4}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": [],
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const g = pm.response.json();",
                  "pm.test('Zarf var (data / meta / errors)', function () {",
                  "    pm.expect(g).to.have.property('data');",
                  "    pm.expect(g).to.have.property('errors');",
                  "});",
                  "pm.test('errors dizi ve boş', function () {",
                  "    pm.expect(g.errors, 'errors dizi olmalı').to.be.an('array');",
                  "    pm.expect(g.errors.length, JSON.stringify(g.errors)).to.eql(0);",
                  "});",
                  "const r = (pm.response.json().data || {}).result || pm.response.json().data || {};",
                  "pm.test('dogrulandi true', () => pm.expect(Boolean(r.dogrulandi), 'test verisini ortamda doğru girin').to.eql(true));",
                  "if (Array.isArray(r.abonelikler) && r.abonelikler.length > 1) {",
                  "    pm.test('her abonelikte abone_no var', function () {",
                  "        r.abonelikler.forEach(a => pm.expect(String(a.abone_no || '')).to.not.be.empty);",
                  "    });",
                  "}"
                ]
              }
            }
          ]
        },
        {
          "name": "Asistan yapılandırması",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-Request-Id",
                "value": "{{$guid}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}{{yol}}/agent/config"
            },
            "description": "Öğretiler, devir hedefi, marka bilgisi. 2 dk önbelleklenir."
          },
          "response": [],
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const g = pm.response.json();",
                  "pm.test('Zarf var (data / meta / errors)', function () {",
                  "    pm.expect(g).to.have.property('data');",
                  "    pm.expect(g).to.have.property('errors');",
                  "});",
                  "pm.test('errors dizi ve boş', function () {",
                  "    pm.expect(g.errors, 'errors dizi olmalı').to.be.an('array');",
                  "    pm.expect(g.errors.length, JSON.stringify(g.errors)).to.eql(0);",
                  "});",
                  "const d = pm.response.json().data || {};",
                  "pm.test('ogretiler dizi', () => pm.expect(d.ogretiler || []).to.be.an('array'));",
                  "(d.ogretiler || []).forEach(function (o) {",
                  "    pm.test('öğretide icerik var', () => pm.expect(String(o.icerik || '')).to.not.be.empty);",
                  "});",
                  "pm.test('aktarma bloğu var', () => pm.expect(d).to.have.property('aktarma'));"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "3 · İsteğe bağlı uçlar",
      "item": [
        {
          "name": "Hizmet durumu",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-Request-Id",
                "value": "{{$guid}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}{{yol}}/customers/connection-check"
            },
            "description": "status: online | offline | inactive | expired | radacct_only | inconsistent | mikrotik_unreachable",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"abone_no\": \"{{abone_no}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": [],
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const g = pm.response.json();",
                  "pm.test('Zarf var (data / meta / errors)', function () {",
                  "    pm.expect(g).to.have.property('data');",
                  "    pm.expect(g).to.have.property('errors');",
                  "});",
                  "pm.test('errors dizi ve boş', function () {",
                  "    pm.expect(g.errors, 'errors dizi olmalı').to.be.an('array');",
                  "    pm.expect(g.errors.length, JSON.stringify(g.errors)).to.eql(0);",
                  "});",
                  "const r = (pm.response.json().data || {}).result || pm.response.json().data || {};",
                  "const gecerli = ['online','offline','inactive','expired','radacct_only','inconsistent','mikrotik_unreachable'];",
                  "pm.test('status sözlükten', () => pm.expect(gecerli).to.include(String(r.status || '')));"
                ]
              }
            }
          ]
        },
        {
          "name": "Talep / arıza kaydı aç",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-Request-Id",
                "value": "{{$guid}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}{{yol}}/tickets"
            },
            "description": "Kayıt numarası dönmezse asistan 'açıldı' DEMEZ. Açık kayıt varsa existing:true.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"abone_no\": \"{{abone_no}}\",\n  \"type_id\": 0,\n  \"description\": \"[Web Asistan] Sözleşme sınaması — bu kaydı kapatabilirsiniz\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": [],
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const g = pm.response.json();",
                  "pm.test('Zarf var (data / meta / errors)', function () {",
                  "    pm.expect(g).to.have.property('data');",
                  "    pm.expect(g).to.have.property('errors');",
                  "});",
                  "pm.test('errors dizi ve boş', function () {",
                  "    pm.expect(g.errors, 'errors dizi olmalı').to.be.an('array');",
                  "    pm.expect(g.errors.length, JSON.stringify(g.errors)).to.eql(0);",
                  "});",
                  "const d = pm.response.json().data || {};",
                  "const no = d.ticket_id || d.id || d.kayit_no;",
                  "pm.test('kayıt numarası döndü', () => pm.expect(String(no || ''), 'ticket_id/id/kayit_no yok').to.not.be.empty);"
                ]
              }
            }
          ]
        },
        {
          "name": "Talep — İKİNCİ kez (mükerrer koruması)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-Request-Id",
                "value": "{{$guid}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}{{yol}}/tickets"
            },
            "description": "Aynı abonede açık kayıt varken yenisi AÇILMAMALI: existing:true dönün.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"abone_no\": \"{{abone_no}}\",\n  \"type_id\": 0,\n  \"description\": \"[Web Asistan] Sözleşme sınaması — mükerrer denemesi\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": [],
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const g = pm.response.json();",
                  "pm.test('Zarf var (data / meta / errors)', function () {",
                  "    pm.expect(g).to.have.property('data');",
                  "    pm.expect(g).to.have.property('errors');",
                  "});",
                  "pm.test('errors dizi ve boş', function () {",
                  "    pm.expect(g.errors, 'errors dizi olmalı').to.be.an('array');",
                  "    pm.expect(g.errors.length, JSON.stringify(g.errors)).to.eql(0);",
                  "});",
                  "const d = pm.response.json().data || {};",
                  "pm.test('mükerrer kayıt açılmadı', function () {",
                  "    const zaten = d.existing || d.already_open;",
                  "    pm.expect(Boolean(zaten), 'aynı sorun için kayıt yığılıyor').to.eql(true);",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Mesaj gönder (link/şifre)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-Request-Id",
                "value": "{{$guid}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}{{yol}}/agent/message"
            },
            "description": "tur: odeme_linki | oim_linki | pppoe_sifresi | oim_sifresi. Mesajı SİZ gönderirsiniz.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"abone_no\": \"{{abone_no}}\",\n  \"tur\": \"odeme_linki\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": [],
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const g = pm.response.json();",
                  "pm.test('Zarf var (data / meta / errors)', function () {",
                  "    pm.expect(g).to.have.property('data');",
                  "    pm.expect(g).to.have.property('errors');",
                  "});",
                  "pm.test('errors dizi ve boş', function () {",
                  "    pm.expect(g.errors, 'errors dizi olmalı').to.be.an('array');",
                  "    pm.expect(g.errors.length, JSON.stringify(g.errors)).to.eql(0);",
                  "});",
                  "const r = (pm.response.json().data || {}).result || pm.response.json().data || {};",
                  "pm.test('kanal bildirildi', () => pm.expect(['whatsapp','sms','']).to.include(String(r.kanal || '')));"
                ]
              }
            }
          ]
        },
        {
          "name": "Kapsama sorgusu",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-Request-Id",
                "value": "{{$guid}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}{{yol}}/agent/altyapi"
            },
            "description": "Mahalle adını ESNEK eşleştirin: müşteri 'Özgür Mahallesi' der, kaydınızda 'ÖZGÜR' yazar. Birebir eşleştirme, hizmet verdiğiniz adrese 'bölgemizde değil' dedirtir.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"il\": \"{{test_il}}\",\n  \"ilce\": \"{{test_ilce}}\",\n  \"mahalle\": \"{{test_mahalle}}\",\n  \"sokak\": \"{{test_sokak}}\",\n  \"bina_no\": \"5\",\n  \"daire_no\": \"13\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": [],
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const g = pm.response.json();",
                  "pm.test('Zarf var (data / meta / errors)', function () {",
                  "    pm.expect(g).to.have.property('data');",
                  "    pm.expect(g).to.have.property('errors');",
                  "});",
                  "pm.test('errors dizi ve boş', function () {",
                  "    pm.expect(g.errors, 'errors dizi olmalı').to.be.an('array');",
                  "    pm.expect(g.errors.length, JSON.stringify(g.errors)).to.eql(0);",
                  "});",
                  "const r = (pm.response.json().data || {}).result || pm.response.json().data || {};",
                  "pm.test('bulundu alanı var', () => pm.expect(r).to.have.property('bulundu'));",
                  "pm.test('altyapilar dizi', () => pm.expect(r.altyapilar || []).to.be.an('array'));",
                  "pm.environment.set('kapsama_bulundu', String(Boolean(r.bulundu)));"
                ]
              }
            }
          ]
        },
        {
          "name": "Kapsama — mahalle EKİYLE (esneklik sınaması)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-Request-Id",
                "value": "{{$guid}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}{{yol}}/agent/altyapi"
            },
            "description": "Bir önceki istekle AYNI sonucu vermeli. Vermiyorsa eşleştirmeniz birebir demektir.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"il\": \"{{test_il}}\",\n  \"ilce\": \"{{test_ilce}}\",\n  \"mahalle\": \"{{test_mahalle}} Mahallesi\",\n  \"sokak\": \"{{test_sokak}}\",\n  \"bina_no\": \"5\",\n  \"daire_no\": \"13\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": [],
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const g = pm.response.json();",
                  "pm.test('Zarf var (data / meta / errors)', function () {",
                  "    pm.expect(g).to.have.property('data');",
                  "    pm.expect(g).to.have.property('errors');",
                  "});",
                  "pm.test('errors dizi ve boş', function () {",
                  "    pm.expect(g.errors, 'errors dizi olmalı').to.be.an('array');",
                  "    pm.expect(g.errors.length, JSON.stringify(g.errors)).to.eql(0);",
                  "});",
                  "const r = (pm.response.json().data || {}).result || pm.response.json().data || {};",
                  "pm.test('ekli yazım da bulunuyor', function () {",
                  "    const oncekiBulundu = pm.environment.get('kapsama_bulundu');",
                  "    if (oncekiBulundu === undefined || oncekiBulundu === null || oncekiBulundu === '') { pm.expect(true).to.eql(true); return; }",
                  "    pm.expect(String(Boolean(r.bulundu)), 'mahalle adını sadeleştirin (ek at, Türkçe küçült)').to.eql(String(oncekiBulundu));",
                  "});"
                ]
              }
            }
          ]
        },
        {
          "name": "Genel duyuru / toplu kesinti",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-Request-Id",
                "value": "{{$guid}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}{{yol}}/agent/genel-ariza?abone_no={{abone_no}}",
              "query": [
                {
                  "key": "abone_no",
                  "value": "{{abone_no}}"
                }
              ]
            },
            "description": "abone_no verildiğinde O MÜŞTERİNİN etkilenip etkilenmediğini dönün."
          },
          "response": [],
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const g = pm.response.json();",
                  "pm.test('Zarf var (data / meta / errors)', function () {",
                  "    pm.expect(g).to.have.property('data');",
                  "    pm.expect(g).to.have.property('errors');",
                  "});",
                  "pm.test('errors dizi ve boş', function () {",
                  "    pm.expect(g.errors, 'errors dizi olmalı').to.be.an('array');",
                  "    pm.expect(g.errors.length, JSON.stringify(g.errors)).to.eql(0);",
                  "});",
                  "const d = pm.response.json().data || {};",
                  "pm.test('arizalar dizi', () => pm.expect(d.arizalar || []).to.be.an('array'));"
                ]
              }
            }
          ]
        },
        {
          "name": "Görüşme sonucu yaz",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-Request-Id",
                "value": "{{$guid}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}{{yol}}/agent/calls"
            },
            "description": "Görüşme özeti müşteri kartınıza düşsün diye. İsteğe bağlı.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"uniqueid\": \"kont-sinama-1\",\n  \"arayan_no\": \"0{{test_telefon}}\",\n  \"dahili\": \"201\",\n  \"yon\": \"gelen\",\n  \"durum\": \"cevaplandi\",\n  \"konu\": \"Sözleşme sınaması\",\n  \"ozet\": \"Bu bir sınama kaydıdır.\",\n  \"abone_no\": \"{{abone_no}}\",\n  \"sure_sn\": 42\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "response": [],
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const g = pm.response.json();",
                  "pm.test('Zarf var (data / meta / errors)', function () {",
                  "    pm.expect(g).to.have.property('data');",
                  "    pm.expect(g).to.have.property('errors');",
                  "});",
                  "pm.test('errors dizi ve boş', function () {",
                  "    pm.expect(g.errors, 'errors dizi olmalı').to.be.an('array');",
                  "    pm.expect(g.errors.length, JSON.stringify(g.errors)).to.eql(0);",
                  "});"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "4 · OnlineAsistan uçları (bizi çağıracaklarınız)",
      "item": [
        {
          "name": "Devredilen görüşmeyi oku",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-Request-Id",
                "value": "{{$guid}}"
              }
            ],
            "url": {
              "raw": "{{onlineasistan_url}}/api/chat/{{chat_token}}"
            },
            "description": "Devir webhook'u aldıktan sonra görüşmenin tamamını okur. Bearer: cevap anahtarı (inbound_token).",
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{cevap_anahtari}}"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Temsilci cevabı yaz",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-Request-Id",
                "value": "{{$guid}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{onlineasistan_url}}/api/chat/{{chat_token}}/reply"
            },
            "description": "Kendi yazılımınızdaki temsilci buradan yazar.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"mesaj\": \"Merhaba, ben canlı temsilci.\",\n  \"temsilci\": \"Ayşe\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{cevap_anahtari}}"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Görüşmeyi kapat",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-Request-Id",
                "value": "{{$guid}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{onlineasistan_url}}/api/chat/{{chat_token}}/close"
            },
            "description": "Görüşme kapanır, müşteriye bildirilir.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"not\": \"Çözüldü.\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{cevap_anahtari}}"
                }
              ]
            }
          },
          "response": []
        }
      ]
    }
  ]
}