Google Apps Script tự động đồng bộ data từ Google Form (36 cột) vào Bitrix24 CRM.
KH điền Google Form (36 cột)
│
▼
Google Sheet (Form Responses)
│
▼ (installable trigger: onFormSubmit)
Google Apps Script
│
├──► Bitrix24 REST API
│ ├── Lead (create / update by phone match)
│ ├── Contact (name, phone +84, email, chức vụ, facebook)
│ ├── Company (tên, website)
│ ├── Requisite (RQ_COMPANY_NAME, RQ_VAT_ID, Legal Address)
│ ├── Timeline Comment (HTML survey results)
│ └── Link: Contact ↔ Company ↔ Lead
│
└──► VietQR API
└── MST → Tên pháp lý + Địa chỉ GPKD
| Google Form | Bitrix24 entity | Ghi chú |
|---|---|---|
| Cột 1-5: Họ tên, Email, Phone, Facebook, Vai trò | Contact | Phone BẮT BUỘC +84 |
| Cột 6: Nguồn | Lead SOURCE_ID | Map → RECOMMENDATION / WEB / OTHER |
| Cột 7: Tên DN | Company TITLE + Lead COMPANY_TITLE | |
| Cột 8: MST → VietQR API | Requisite + Legal Address | Tên pháp lý + Địa chỉ GPKD |
| Cột 9: Website | Company WEB | |
| Cột 10-35: Khảo sát | Lead timeline comment | HTML formatted |
npm install -g @google/clasp
clasp loginclasp create --type standalone --title "SYNITY Form to Bitrix"clasp pushMở GAS editor (clasp open), chạy function setupProperties() một lần:
BITRIX_WEBHOOK = https://tamgiac.bitrix24.com/rest/1/xxxxx/
FORM_SHEET_ID = 1TlJVGqQD9peFQ94oYMNOucC0jtosHiI0P0m3uUz5L4o
DEFAULT_ASSIGNED = 1
ERROR_LOG_SHEET = (optional)
QUAN TRỌNG: Thay
xxxxxbằng webhook token thật. KHÔNG commit token vào Git.
Chạy createTrigger() một lần từ GAS editor.
- Chạy
testFormSubmit()từ GAS editor (dùng sample data thật) - Hoặc: điền Google Form → kiểm tra Bitrix24
Kiểm tra:
- Lead mới/cập nhật — stage = Submitted Form
- Contact — có SĐT +84, Email, Chức vụ, Facebook
- Company — có Website
- Requisite — có RQ_COMPANY_NAME, RQ_VAT_ID, Legal Address
- Timeline comment — HTML "KẾT QUẢ KHẢO SÁT NHU CẦU"
HONORIFIC (Danh xưng: Anh/Chị) không có trong Google Form → nhân sự bổ sung thủ công.
clasp push # Upload to GAS
clasp open # Open GAS editor
clasp logs # View execution logs
git add . && git commit -m "feat: ..."
git pushsynity-gas/
├── src/
│ ├── main.js # onFormSubmit handler, Bitrix + VietQR API, setup functions
│ ├── config.js # 36-column mapping, survey sections, SOURCE_MAP, defaults
│ └── utils.js # Phone (+84), name split, address parser, HTML builder
├── appsscript.json # GAS manifest
├── .clasp.json # Script ID (auto-generated)
├── .claspignore # Exclude non-GAS files from push
├── .gitignore
├── package.json
└── README.md
- SOP Bước 02 — Survey
- Tech: Lead Capture
- Bitrix24 Portal:
tamgiac.bitrix24.com