---
name: Pipedrive & Zoho CRM
priority: 2
keywords: pipedrive, zoho crm, زوهو سي ار ام, زوهو, leads, deals, pipeline, مبيعات, متابعة
---

# Pipedrive & Zoho CRM

## متى تستخدم
أي عمليات على Pipedrive (deals/persons/orgs) أو Zoho CRM (leads/contacts/deals/accounts).

## Pipedrive
Auth: API token (أبسط من OAuth). Base: `https://api.pipedrive.com/v1`
```bash
# قائمة deals
exec_command "curl -s 'https://api.pipedrive.com/v1/deals?status=open&api_token=$PIPEDRIVE_TOKEN&limit=20'"

# إنشاء deal
exec_command "curl -s -X POST -H 'Content-Type: application/json' \
  -d '{\"title\":\"TaseesAI - Q3\",\"value\":50000,\"currency\":\"SAR\",\"stage_id\":1,\"person_id\":42}' \
  'https://api.pipedrive.com/v1/deals?api_token=$PIPEDRIVE_TOKEN'"

# إنشاء person
exec_command "curl -s -X POST -H 'Content-Type: application/json' \
  -d '{\"name\":\"Ahmed Al-Saudi\",\"email\":[\"ahmed@example.com\"],\"phone\":[\"+966500000000\"]}' \
  'https://api.pipedrive.com/v1/persons?api_token=$PIPEDRIVE_TOKEN'"

# نقل deal لمرحلة
exec_command "curl -s -X PUT -H 'Content-Type: application/json' \
  -d '{\"stage_id\":3,\"status\":\"won\"}' \
  'https://api.pipedrive.com/v1/deals/$DEAL_ID?api_token=$PIPEDRIVE_TOKEN'"

# Pipeline summary
exec_command "curl -s 'https://api.pipedrive.com/v1/dealFields?api_token=$PIPEDRIVE_TOKEN'"
```

## Zoho CRM
Auth: OAuth2 token. Base: `https://www.zohoapis.com/crm/v6` (هذي v6، مختلفة عن Books)
```bash
# قائمة leads
exec_command "curl -s -H 'Authorization: Zoho-oauthtoken $ZOHO_CRM_TOKEN' \
  'https://www.zohoapis.com/crm/v6/Leads?fields=Last_Name,Email,Phone,Company,Lead_Status&per_page=20'"

# إنشاء lead
exec_command "curl -s -X POST -H 'Authorization: Zoho-oauthtoken $ZOHO_CRM_TOKEN' -H 'Content-Type: application/json' \
  -d '{\"data\":[{\"Last_Name\":\"Al-Saudi\",\"First_Name\":\"Ahmed\",\"Email\":\"ahmed@example.com\",\"Phone\":\"+966500000000\",\"Company\":\"TaseesAI\",\"Lead_Source\":\"Web\"}]}' \
  'https://www.zohoapis.com/crm/v6/Leads'"

# تحديث deal
exec_command "curl -s -X PUT -H 'Authorization: Zoho-oauthtoken $ZOHO_CRM_TOKEN' -H 'Content-Type: application/json' \
  -d '{\"data\":[{\"id\":\"$DEAL_ID\",\"Stage\":\"Closed Won\",\"Amount\":50000}]}' \
  'https://www.zohoapis.com/crm/v6/Deals'"

# COQL (Zoho's SOQL)
exec_command "curl -s -X POST -H 'Authorization: Zoho-oauthtoken $ZOHO_CRM_TOKEN' -H 'Content-Type: application/json' \
  -d '{\"select_query\":\"SELECT Last_Name, Email, Lead_Status FROM Leads WHERE Created_Time > '\\''2026-01-01T00:00:00Z'\\'' LIMIT 10\"}' \
  'https://www.zohoapis.com/crm/v6/coql'"
```

## أنماط مشتركة (تنطبق على أي CRM)
1. **Lead capture flow**: WhatsApp/form → contact في CRM → tag بمصدر → assign لـowner.
2. **Pipeline velocity**: قياس أيام بين مرحلتين، اتجاه الشهر.
3. **Stale deals**: deals لم تُحدّث منذ X يوم → flag للمتابعة.
4. **Source attribution**: فحص lead source لكل deal مغلق فائز → ROI لكل قناة.

## أمثلة
- "اضف Lead في Pipedrive لـahmed بقيمة 50K" → create person + create deal.
- "كم deals مغلقة فائزة في Zoho هذا الشهر" → COQL with WHERE Stage='Closed Won' AND Closing_Date.
- "deals صامتة 14 يوم" → search where Modified_Time < now-14d AND Stage NOT IN closed-states.

## القواعد الذهبية
- ❌ **استخدم rate-limit-aware retries** — Pipedrive: 100/10s، Zoho: 100/min.
- ✅ **خزّن stage IDs** بعد أول قراءة (هي ثابتة) في `remember`.
- ✅ **لا تكرّر contacts** — ابحث بالإيميل أولاً.
