> For the complete documentation index, see [llms.txt](https://docs.watzap.id/help/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.watzap.id/help/integrations/integrasi-dengan-google-form.md).

# Integrasi dengan Google Form

Kirim pesan WhatsApp otomatis ke setiap orang yang mengisi Google Form, lewat script Google Apps Script yang memakai API Key dan Number Key WatZap.

Dengan mengintegrasikan **Google Form** ke WatZap, setiap orang yang mengisi form otomatis menerima pesan WhatsApp dari nomor API WatZap Kamu. Jawaban form tetap tersimpan di Google Spreadsheet seperti biasa.

Integrasi ini memakai script Google Apps Script yang sudah disiapkan WatZap. Kamu cukup mengisi **API Key**, **Number Key**, dan isi pesannya.

## Sebelum mulai

1. **Paket WatZap Personal, Plus, atau Premium.** API Key hanya bisa disalin di paket ini.
2. **Minimal satu nomor API berstatus Online.** Caranya: [Menambahkan Nomor WA untuk API](https://docs.watzap.id/help/integrations/menambahkan-nomor-wa-untuk-api.md).
3. **Akun Google** untuk membuat Google Form dan Google Spreadsheet.

## Bagian 1: Siapkan Number Key dan API Key di WatZap

{% stepper %}
{% step %}

### Buka menu WhatsApp

Di dashboard WatZap, klik menu **WhatsApp** di bagian **WA UNOFFICIAL** pada menu samping.

![Menu WA UNOFFICIAL → WhatsApp](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2FIeMCHTRtXnFMl9n61Rld%2FF4-01-menu-whatsapp.png?alt=media)
{% endstep %}

{% step %}

### Salin Number Key di tab API

1. Klik tab **API**.
2. Pastikan **Status** nomornya **Online**. Kalau masih **Offline** seperti contoh ini, klik **Connect** lalu scan ulang QR Code.
3. Klik ikon salin di kolom **Number Key**. Simpan dulu, nanti ditempel ke script.

![Tab API: status nomor dan Number Key](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2FQNlj7AstPITQZRn1Q0Og%2FF4-02-number-key.png?alt=media)

Penjelasan lengkap Number Key ada di [Mendapatkan Number Key untuk API](https://docs.watzap.id/help/integrations/mendapatkan-number-key-untuk-api.md).
{% endstep %}

{% step %}

### Salin API Key

Di menu samping, gulir ke bagian **INTEGRATIONS**, lalu klik **API Key**.

![Menu INTEGRATIONS → API Key](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2FXHht6T3Cbeyv7qB0ajgE%2FF4-03-menu-api-key.png?alt=media)

Di halaman **API Key**:

1. Kolom **API Key** (isinya disembunyikan).
2. Ikon mata untuk menampilkan API Key.
3. **Copy** untuk menyalinnya.

![Kolom API Key dengan tombol Copy](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2FaT86ewmBWYHUW9scnNgm%2FF4-04-copy-api-key.png?alt=media)

{% hint style="warning" %}
API Key dan Number Key adalah kunci akses akun WatZap Kamu. Jangan bagikan Spreadsheet yang berisi script ini ke orang yang tidak Kamu percaya.
{% endhint %}
{% endstep %}
{% endstepper %}

## Bagian 2: Siapkan Google Form dan Spreadsheet

{% stepper %}
{% step %}

### Buat Google Form dengan kolom nomor WhatsApp

Buat Google Form baru, misalnya "Pre Order iPhone Baru".

![Contoh Google Form](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2FKp6BF7jVBLKretmMbHVj%2F1.jpg?alt=media\&token=3e075ae6-987c-436f-b582-824d7f3891ed)

Pastikan form punya pertanyaan **Nomor WhatsApp**. Nomor inilah yang akan menerima pesan.

![Pertanyaan Nomor WhatsApp di Google Form](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2FKRFYMNoiSAUR0sm8Ef2L%2F2.jpg?alt=media\&token=713df117-ec35-4a7d-9afc-a236a0c74d92)
{% endstep %}

{% step %}

### Hubungkan form ke Google Spreadsheet

Buka tab **Jawaban** (di samping **Pertanyaan**).

![Tab Jawaban di Google Form](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2FprSCR2UZ7HDlJSBqvBoM%2F3.jpg?alt=media\&token=ae384af6-667a-49b2-b551-af506c4e5a0e)

Klik ikon **Google Spreadsheet**.

![Ikon Google Spreadsheet](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2Flj0mdciJn5WdIg9iacBR%2F4.jpg?alt=media\&token=6cbb7726-b528-4e1f-932a-bd0bf4f56732)

Klik **Buat** untuk membuat spreadsheet baru.

![Tombol Buat](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2F5bvVaqWT7TQKamAyFPfZ%2F5.jpg?alt=media\&token=760e534e-91da-4b7e-a9fc-be222c9829e4)

Spreadsheet jawaban terbuka. Kolom pertama biasanya berisi waktu pengisian, lalu diikuti kolom setiap pertanyaan sesuai urutan di form.

![Spreadsheet jawaban Google Form](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2FTMx8Q7hKQFNbuFuShUt9%2F6.jpg?alt=media\&token=a32e75fe-4af6-4f3b-bdd4-c458c5c30d36)
{% endstep %}
{% endstepper %}

## Bagian 3: Pasang script WatZap

{% stepper %}
{% step %}

### Buka Apps Script

Di Spreadsheet, klik menu **Ekstensi → Apps Script**.

![Menu Ekstensi → Apps Script](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2FiuF29utAOPwyJllzFlFh%2F7.jpg?alt=media\&token=f36909e6-b6a0-4751-93be-5ad16522c61a)

Hapus semua kode bawaan sampai editornya kosong.

![Hapus kode bawaan](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2FgkU2cIsMPcvXLA3CzT2J%2F9.jpg?alt=media\&token=e60258c0-30f3-4d91-b375-dd38468b65c7)
{% endstep %}

{% step %}

### Tempel script WatZap

Salin [script WatZap untuk Google Form](https://pastebin.com/1Egiek5a), lalu tempel ke editor.

![Script WatZap ditempel di Apps Script](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2FMZeuxGuA0x2kwitZhj9e%2FScreenshot_2.png?alt=media\&token=655b1f56-e230-4e60-a343-79b68eccbe0c)
{% endstep %}

{% step %}

### Sesuaikan pengaturan di bagian atas script

![Pengaturan di bagian atas script](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2FdrPGRXDQBWTLUdieCWrW%2FScreenshot_3.png?alt=media\&token=70bc4e7c-3b73-46e4-a43e-27117870bc4f)

Ubah nilai di antara tanda kutip:

| Baris                                                                 | Isinya                                                                                                                                                    |
| --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `var kolom_no_wa = 3;`                                                | Urutan kolom nomor WhatsApp di Spreadsheet, dihitung dari kiri (kolom A = 1). Kalau nomor WhatsApp ada di kolom D, isi `4`.                               |
| `var api_key = '...';`                                                | **API Key** WatZap dari Bagian 1.                                                                                                                         |
| `var number_key = 'ALL';`                                             | **Number Key** nomor API pengirim dari Bagian 1. Biarkan `ALL` kalau ingin pesan dikirim dari salah satu nomor API Kamu yang sedang Online, dipilih acak. |
| `var message = 'Terimakasih *{column_2}* telah mengisi form ini :*';` | Isi pesan. `{column_2}` diganti isi kolom ke-2 pada baris jawaban, misalnya nama. Pakai `{column_3}`, `{column_4}`, dan seterusnya untuk kolom lain.      |
| `var default_country_code = '62';`                                    | Kode negara. Nomor yang diawali `0` otomatis diganti kode ini, misalnya `0812...` menjadi `62812...`.                                                     |
| {% endstep %}                                                         |                                                                                                                                                           |

{% step %}

### Simpan script

Klik ikon **Simpan** (disket).

![Ikon Simpan di Apps Script](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2FdXAJRrWAsdrjxE9ShGnU%2FScreenshot_4.png?alt=media\&token=980bd631-d631-4c9d-bd90-dce3f8ca6a37)
{% endstep %}
{% endstepper %}

## Bagian 4: Pasang pemicu saat form dikirim

{% stepper %}
{% step %}

### Buka menu Pemicu

Klik menu **Pemicu** (ikon jam) di sisi kiri Apps Script.

![Menu Pemicu](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2FchuNaRkJhiCafhvIAN2L%2FUntitled-2.png?alt=media\&token=cdec9a4d-2d26-42ea-9abe-3739f79992f9)

Klik **Tambah Pemicu** di kanan bawah.

![Tombol Tambah Pemicu](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2FsbJFZjQ23DdvRaHvsXCF%2F14-2.jpg?alt=media\&token=c2937c56-4cb6-4e7d-bd6f-d328804b86ad)
{% endstep %}

{% step %}

### Pilih jenis acara "Saat mengirim formulir"

Klik kolom **Pilih jenis acara**.

![Kolom Pilih jenis acara](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2FOcFJ7jJHc0NAE2eb8mlt%2F15-1.jpg?alt=media\&token=a92ffb49-cf4b-43af-930b-64c0194b6ee2)

Pilih **Saat mengirim formulir**, supaya script berjalan setiap kali ada yang mengirim form.

![Pilihan Saat mengirim formulir](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2FDu3gDoUEc0PO7CzdgiX6%2F16.jpg?alt=media\&token=0096c39c-0a5d-4998-9027-5abed16eb80e)

Klik **Simpan**.

![Tombol Simpan pemicu](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2FyQ6ClrtiH2SXrs4KFUdz%2F17.jpg?alt=media\&token=589ece77-c50a-46e3-9aac-5f72264fcdda)
{% endstep %}

{% step %}

### Beri izin akun Google

Pilih akun Google yang dipakai untuk Spreadsheet ini.

![Pilih akun Google](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2FXdr8PN2klNMxZxBviLAR%2F18.jpg?alt=media\&token=d51f2436-bb47-47be-84ff-0fe64ac92b0d)

Kalau muncul peringatan aplikasi belum diverifikasi, klik **Lanjutan**.

![Klik Lanjutan](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2FWk2Nwm69XjnsibBVWdhV%2F19.jpg?alt=media\&token=322799ad-1713-44ea-85a9-55a5772551d4)

Gulir ke bawah, lalu klik **Buka project tak berjudul (tidak aman)**.

![Klik Buka project tak berjudul (tidak aman)](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2F5XT7JALyObs2Eic21x75%2F20.jpg?alt=media\&token=d12d571e-231c-4956-9fe1-bf5158ab0843)

Gulir lagi, lalu klik **Izinkan**.

![Klik Izinkan](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2F8QyWY7YSshH8T8ilv4F1%2F21.jpg?alt=media\&token=3ca53feb-0051-43ae-976d-99b36cb9a7cb)
{% endstep %}

{% step %}

### Selesai

Pemicu baru tampil di daftar **Pemicu** dengan acara *Dari Spreadsheet - Saat mengirim formulir*. Artinya Google Form Kamu sudah terhubung dengan WatZap.

![Pemicu tersimpan, integrasi selesai](https://4182233851-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5hxDGBLGZN4N69IP4zHp%2Fuploads%2FNTIwAXyswxkQZdrSmYpy%2F22.jpg?alt=media\&token=55b051c1-0ad7-4a1e-be19-0402f2db2b11)

Coba isi form sekali dengan nomor WhatsApp Kamu sendiri untuk memastikan pesannya masuk.
{% endstep %}
{% endstepper %}

## Masalah umum

<details>

<summary>Pesan tidak masuk setelah form diisi</summary>

Cek satu per satu:

* Nomor API di tab **API** berstatus **Online**.
* `api_key` dan `number_key` di script sama persis dengan yang ada di WatZap, tanpa spasi tambahan.
* `kolom_no_wa` menunjuk ke kolom nomor WhatsApp yang benar.
* Pemicu sudah dibuat dengan jenis acara **Saat mengirim formulir**.

</details>

<details>

<summary>Pesan masuk tapi nama atau data lain tidak sesuai</summary>

Angka di `{column_...}` harus sama dengan urutan kolom di Spreadsheet, dihitung dari kiri. Kalau Kamu menambah atau memindah pertanyaan di form, urutan kolomnya ikut berubah. Sesuaikan lagi script-nya lalu simpan.

</details>

<details>

<summary>Kolom API Key buram dan tidak bisa disalin</summary>

Paket Kamu belum mendukung API. Klik kolomnya untuk melihat pilihan upgrade, atau ikuti [Cara Mengganti Paket Langganan](https://docs.watzap.id/help/subscription/cara-mengganti-paket-langganan.md).

</details>
