İçeriğe geç
ZZenWapp Docs

API referansı

Templates

Değişken destekli mesaj şablonlarının yönetimi ve şablonla gönderim.

get/templates

Şablonları listele

Gerekli yetki: messages:read

Sorgu parametreleri

categorystring
is_activeboolean
searchstring

İstek örneği

curl -X GET "https://api.zenwapp.com/api/v1/whatsapp/external/templates" \
  -H "Authorization: Bearer $ZENWAPP_API_KEY"

Yanıt kodları

  • 200Şablon listesi
post/templates

Şablon oluştur

Şablon içeriğinde `{{degisken}}` biçiminde yer tutucular kullanılır; gönderim sırasında `variables` ile doldurulur.

Gerekli yetki: messages:send

Gövde alanları

namezorunlustring
contentzorunlustring
categorystringVarsayılan: "general"
languagestringVarsayılan: "tr"
variablesstring[]

İstek örneği

curl -X POST "https://api.zenwapp.com/api/v1/whatsapp/external/templates" \
  -H "Authorization: Bearer $ZENWAPP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"kargo_bildirimi","content":"Merhaba {{ad}}, {{siparis_no}} numaralı siparişiniz kargoya verildi.","variables":["ad","siparis_no"]}'

Yanıt 400

{
  "error": "validation_error",
  "message": "Missing required field: to"
}

Yanıt kodları

  • 201Şablon oluşturuldu
  • 400Gövde veya sorgu parametreleri geçersiz
get/templates/{id}

Şablon detayı

Gerekli yetki: messages:read

Yol parametreleri

idzorunluuuidKaynak kimliği (UUID).

İstek örneği

curl -X GET "https://api.zenwapp.com/api/v1/whatsapp/external/templates/00000000-0000-0000-0000-000000000000" \
  -H "Authorization: Bearer $ZENWAPP_API_KEY"

Yanıt 404

{
  "error": "not_found",
  "message": "Resource not found"
}

Yanıt kodları

  • 200Şablon detayı
  • 404Kaynak bulunamadı
put/templates/{id}

Şablonu güncelle

Gerekli yetki: messages:send

Yol parametreleri

idzorunluuuidKaynak kimliği (UUID).

Gövde alanları

namestring
contentstring
categorystring
languagestring
variablesstring[]
is_activeboolean

İstek örneği

curl -X PUT "https://api.zenwapp.com/api/v1/whatsapp/external/templates/00000000-0000-0000-0000-000000000000" \
  -H "Authorization: Bearer $ZENWAPP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"is_active":false}'

Yanıt 404

{
  "error": "not_found",
  "message": "Resource not found"
}

Yanıt kodları

  • 200Güncellendi
  • 404Kaynak bulunamadı
delete/templates/{id}

Şablonu sil

Gerekli yetki: messages:send

Yol parametreleri

idzorunluuuidKaynak kimliği (UUID).

İstek örneği

curl -X DELETE "https://api.zenwapp.com/api/v1/whatsapp/external/templates/00000000-0000-0000-0000-000000000000" \
  -H "Authorization: Bearer $ZENWAPP_API_KEY"

Yanıt 404

{
  "error": "not_found",
  "message": "Resource not found"
}

Yanıt kodları

  • 200Silindi
  • 404Kaynak bulunamadı
post/messages/send-template

Şablonla mesaj gönder

Şablonu `template_id` veya `template_name` ile seçer, `variables` içindeki değerlerle doldurup gönderir.

Gerekli yetki: messages:send

Gövde alanları

tozorunlustring
template_iduuid
template_namestring`template_id` yerine kullanılabilir.
variablesobject

İstek örneği

curl -X POST "https://api.zenwapp.com/api/v1/whatsapp/external/messages/send-template" \
  -H "Authorization: Bearer $ZENWAPP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":"905551234567","template_name":"kargo_bildirimi","variables":{"ad":"Ahmet","siparis_no":"SP-10245"}}'

Yanıt 400

{
  "error": "validation_error",
  "message": "Missing required field: to"
}

Yanıt kodları

  • 202Kuyruğa alındı
  • 400Gövde veya sorgu parametreleri geçersiz