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
category | string | |
is_active | boolean | |
search | string |
İ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ı
namezorunlu | string | |
contentzorunlu | string | |
category | string | Varsayılan: "general" |
language | string | Varsayılan: "tr" |
variables | string[] |
İ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şturuldu400Gövde veya sorgu parametreleri geçersiz
get
/templates/{id}Şablon detayı
Gerekli yetki: messages:read
Yol parametreleri
idzorunlu | uuid | Kaynak 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
idzorunlu | uuid | Kaynak kimliği (UUID). |
Gövde alanları
name | string | |
content | string | |
category | string | |
language | string | |
variables | string[] | |
is_active | boolean |
İ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üncellendi404Kaynak bulunamadı
delete
/templates/{id}Şablonu sil
Gerekli yetki: messages:send
Yol parametreleri
idzorunlu | uuid | Kaynak 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ı
200Silindi404Kaynak 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ı
tozorunlu | string | |
template_id | uuid | |
template_name | string | `template_id` yerine kullanılabilir. |
variables | object |
İ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