> ## Documentation Index
> Fetch the complete documentation index at: https://yardim.whattalk.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Oturum Durumunu Getir

> Bir WhatsApp konuşması için 24 saatlik mesajlaşma penceresi durumunu kontrol edin

Bu endpoint, WhatsApp göndereniz ile belirli bir alıcı arasında aktif bir 24 saatlik mesajlaşma penceresinin olup olmadığını kontrol eder. Bunu [serbest form mesajlar](/api-reference/whatsapp/send-freeform) gönderip gönderemeyeceğinizi veya [şablon mesajı](/api-reference/whatsapp/send-template) kullanmanız gerekip gerekmediğini belirlemek için kullanın.

### Sorgu Parametreleri

<ParamField query="sender_id" type="integer" required>
  WhatsApp göndereninin kimliği ([Gönderenleri Getir](/api-reference/whatsapp/get-senders) endpoint'inden elde edilir)
</ParamField>

<ParamField query="recipient_phone" type="string" required>
  Alıcının uluslararası formattaki telefon numarası (ör. `+1234567890`)
</ParamField>

### Yanıt Alanları

<ResponseField name="success" type="boolean">
  İsteğin başarılı olup olmadığı
</ResponseField>

<ResponseField name="has_conversation" type="boolean">
  Bu alıcıyla bir konuşmanın mevcut olup olmadığı
</ResponseField>

<ResponseField name="conversation_id" type="integer">
  Konuşma kimliği (yalnızca `has_conversation` `true` olduğunda mevcuttur)
</ResponseField>

<ResponseField name="customer_name" type="string">
  Müşterinin adı (mevcutsa, yalnızca `has_conversation` `true` olduğunda mevcuttur)
</ResponseField>

<ResponseField name="last_customer_message_at" type="string">
  Müşterinin son mesajının ISO 8601 zaman damgası (yalnızca `has_conversation` `true` olduğunda mevcuttur)
</ResponseField>

<ResponseField name="session_status" type="object">
  <Expandable title="Oturum durumu özellikleri">
    <ResponseField name="is_open" type="boolean">
      24 saatlik mesajlaşma penceresinin şu anda açık olup olmadığı
    </ResponseField>

    <ResponseField name="can_send_freeform" type="boolean">
      Şu anda serbest form (şablonsuz) mesajlar gönderilip gönderilemeyeceği
    </ResponseField>

    <ResponseField name="requires_template" type="boolean">
      Bu alıcıya mesaj göndermek için şablon mesajı gerekip gerekmediği
    </ResponseField>

    <ResponseField name="message" type="string">
      Mevcut oturum durumunun okunabilir açıklaması
    </ResponseField>

    <ResponseField name="minutes_remaining" type="integer">
      24 saatlik pencerede kalan dakika sayısı (yalnızca oturum açık olduğunda mevcuttur)
    </ResponseField>

    <ResponseField name="expires_at" type="string">
      Oturumun sona ereceği ISO 8601 zaman damgası (oturum açık olduğunda veya müşteri mesajı olmadığında mevcuttur)
    </ResponseField>

    <ResponseField name="expired_at" type="string">
      Oturumun süresinin dolduğu ISO 8601 zaman damgası (yalnızca oturum süresi dolduğunda mevcuttur)
    </ResponseField>
  </Expandable>
</ResponseField>

### Hata Yanıtları

<ResponseField name="404 Not Found">
  <Expandable title="Hata Yanıtı">
    <ResponseField name="success" type="boolean">`false`</ResponseField>
    <ResponseField name="error" type="string">`Sender not found`</ResponseField>
    <ResponseField name="error_code" type="string">`SENDER_NOT_FOUND`</ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://app.whattalk.ai/api/user/whatsapp/session-status?sender_id=12&recipient_phone=+1234567890" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const params = new URLSearchParams({
    sender_id: '12',
    recipient_phone: '+1234567890'
  });

  const response = await fetch(
    `https://app.whattalk.ai/api/user/whatsapp/session-status?${params}`,
    {
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    }
  );

  const data = await response.json();

  if (data.session_status.can_send_freeform) {
    console.log('Session is active — freeform messages allowed');
  } else {
    console.log('Session expired — use a template message');
  }
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://app.whattalk.ai/api/user/whatsapp/session-status',
      headers={'Authorization': 'Bearer YOUR_API_KEY'},
      params={
          'sender_id': 12,
          'recipient_phone': '+1234567890'
      }
  )

  data = response.json()
  session = data['session_status']

  if session['can_send_freeform']:
      print('Session is active — freeform messages allowed')
  else:
      print('Session expired — use a template message')
  ```
</RequestExample>

<ResponseExample>
  ```json 200 Aktif Oturum theme={null}
  {
    "success": true,
    "has_conversation": true,
    "conversation_id": 1234,
    "customer_name": "John Doe",
    "last_customer_message_at": "2026-02-24T10:30:00+00:00",
    "session_status": {
      "is_open": true,
      "can_send_freeform": true,
      "requires_template": false,
      "message": "Session open (23 hr 45 min remaining). Unlimited free-form messages allowed.",
      "minutes_remaining": 1425,
      "expires_at": "2026-02-25T10:30:00+00:00"
    }
  }
  ```

  ```json 200 Süresi Dolmuş Oturum theme={null}
  {
    "success": true,
    "has_conversation": true,
    "conversation_id": 1234,
    "customer_name": "John Doe",
    "last_customer_message_at": "2026-02-22T14:00:00+00:00",
    "session_status": {
      "is_open": false,
      "can_send_freeform": false,
      "requires_template": true,
      "message": "Session expired. Send a template or wait for customer to reply.",
      "expired_at": "2026-02-23T14:00:00+00:00"
    }
  }
  ```

  ```json 200 Konuşma Yok theme={null}
  {
    "success": true,
    "has_conversation": false,
    "session_status": {
      "is_open": false,
      "can_send_freeform": false,
      "requires_template": true,
      "message": "No conversation exists with this recipient. Send a template message first."
    }
  }
  ```

  ```json 404 Gönderen Bulunamadı theme={null}
  {
    "success": false,
    "error": "Sender not found",
    "error_code": "SENDER_NOT_FOUND"
  }
  ```
</ResponseExample>

### Tipik İş Akışı

Bu endpoint'i mesaj gönderme akışının bir parçası olarak kullanın:

1. Mesaj göndermeden önce **oturum durumunu kontrol edin**
2. `can_send_freeform` `true` ise -> [Serbest Form Mesaj Gönder](/api-reference/whatsapp/send-freeform) kullanın
3. `requires_template` `true` ise -> [Şablon Mesajı Gönder](/api-reference/whatsapp/send-template) kullanın

### Notlar

* 24 saatlik pencere, müşterinin son gelen mesaj zaman damgasına dayanır.
* Her yeni müşteri mesajı 24 saatlik zamanlayıcıyı sıfırlar.
* Bu endpoint bakiye tüketmez -- yalnızca okuma amaçlı bir durum kontrolüdür.
