# Tích hợp Firebase với ABOT

Bước 1: Tạo tài khoản và đăng nhập Firebase tại <https://firebase.google.com/>

Bước 2: Tạo dự án mới hoặc sử dụng dự án đã có sẵn của bạn.

<figure><img src="/files/tLiQRBfpISESVVeBI1uj" alt=""><figcaption><p><strong>Tạo project firebase mới</strong></p></figcaption></figure>

Bước 3: Sau khi đã có một dự án firebase bạn hãy tạo 1 app web firebase

<figure><img src="/files/lg7c9pVLbwpDjouehq78" alt=""><figcaption><p>Tạo app web firebase</p></figcaption></figure>

Bước 4: Tiếp theo hãy nhấn vào cài đặt và vào mục Project Settings

<figure><img src="/files/gw61k2jxRTbbuzVWrLtw" alt=""><figcaption></figcaption></figure>

Di chuyển tới phần Your App > Chọn app web vừa tạo và chọn phần config

<figure><img src="/files/FYRIkaDpHd3siu5TY9r8" alt=""><figcaption><p>Config web apps</p></figcaption></figure>

Bước 5. Vào mục plugin trên ABOT và chọn plugin Firebase.

Copy đầy đủ các thông số bên ABOT cần

Bước 6: Chuyển sang tab Cloud message và nhấn vào Generate key pair. Sau đó copy Key pair được tạo ra và dán vào phần Server key của ABOT.

<figure><img src="/files/DUuASiSOwQntjndfUi1X" alt=""><figcaption><p>Generate key pair firebase</p></figcaption></figure>

<figure><img src="/files/MXPVTcj3zkXMPSQTHjnC" alt=""><figcaption><p>Cài đặt thông số firebase trên abot</p></figcaption></figure>

### Cài đặt các tính năng Push notification

<figure><img src="/files/fvM4PwpT333HZbZhDMnz" alt=""><figcaption></figcaption></figure>

**Mobile app notifications:**  Bật push notification trên mobile app

**Enabled on landing pages:** Bật push notification trên landing page của ABOT

**Enable on tracked pages**: Bật thông báo đẩy trên các trang được gắn [mã tracking của ABOT](/tracking/su-dung-ma-tracking-abot-tren-ladipage.md)

**Icon/image URL**: Hình ảnh, icon hiển thị khi nhận thông báo đẩy.

**Prompt browser notification window automaticaly**: Bật modal nhắc nhở nhận thông báo. Nếu khách hàng từ chối nhận tin thì 1 ngày sau hệ thống sẽ hiển thị lại thông báo này.

**Browser notification window content**: Nội dung hiển thị trên modal thông báo.

**Welcome notification - Title**: Tiêu đề push notification khi khách hàng đồng ý nhận tin.

**Welcome notification - Text**: Nội dung push notification khi khách hàng đồng ý nhận tin.

**Welcome notification - URL**: Đường dấn trong push notification khi khách hàng đồng ý nhận tin. Khách hàng click vào thông báo đẩy sẽ được dẫn tới trang đó.

#### Supported Platforms For Mobile Push

**iOS**: Bật thông báo đẩy trên IOS

**Android**: Bật thông báo đẩy trên Android

### Cách push notification tới khách hàng

Bước 1: Tạo nội dung thông báo đẩy.

Bước 2: Cài đặt vào chiến dịch (Campaign). [Xem hướng dẫn cài đặt chiến dịch](/huong-dan-su-dung-phan-mem-abot/campaign.md#bat-dau)

### Tài liệu cài đặt push notification trên web

Khi tích hợp push notification với Firebase bạn có thể kết nối với không giới hạn các website.&#x20;

Để push notification trên web bạn cần cài đặt [code tracking](/tracking/su-dung-ma-tracking-abot-tren-ladipage.md) của abot lên website. Bạn xem hướng dẫn cụ thể [tại đây.](/tracking/su-dung-ma-tracking-abot-tren-ladipage.md)

### Tài liệu cài đặt mobile app

Bạn hãy xem [tài liệu Firebase Cloud Message](https://firebase.google.com/docs/cloud-messaging)&#x20;

Tài liệu cài đặt push notification trên IOS [tại đây.](https://firebase.google.com/docs/cloud-messaging/ios/client)

Tài liệu cài đặt push notification trên Android [tại đây.](https://firebase.google.com/docs/cloud-messaging/android/client)

Sau khi đã kết nối thành công với Firebase Cloud Message bạn hãy gửi token lên ABOT:

Ví dụ:

```
curl --location --request POST 'https://company.abot.vn/fcm/appcallback' \
--header 'Content-Type: application/json' \
--header 'apikey: AIzaSyDMxUf8QakKg9vCd-53c_jH3kYqqborfSx' \
--data-raw '{
    "email": "email@gmail.com",
    "push_id": "fOfkYKlUIGGrEQWu-smYbh:APA91bEgb8wnZNPWPd5sC4cWTh8LLO1Y9sJj80p12DExSRZWrLaVYPFg38EANnyCDjZoDINgNz2GtrY2X8ODkhL802EM8_QrSVmVjjfJVNmK96js0osuB_FVHTi9Ch9HfjrJB1qEpIrs",
    "enabled": true
}'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.abot.vn/tich-hop/tich-hop-firebase-voi-abot.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
