Skip to main content

Firebase Realtime Chat

This Realtime Chat feature helps to chat between the Vendor and the Client. When you click on the "Realtime Chat" item in the Smart Chat tab, the conversation screen of Firebase Realtime Chat will pop up.

Realtime Chat setup

1. Precondition

Create your project on Firebase. Then add iOS App into your project following this guide Firebase Settings. (Skip this step if you already did)

2. Configuration

Go to Features > Smart Chat > turn on Enable Smart Chat. Then enable Use Realtime Chat and input Admin Email and Admin Name:

While creating a new Firebase chat option, you can input "firebase" in App to activate it:

Remember to enable Firebase in Features:

If it is still not able to turn on this feature , please double-check the following instructions: Enable Cloud Firestore at your Firebase project by following Cloud Firestore Get Started Docs until Step 5.

Your Admin Email will be the default email that all of your users would communicate with. By signing in using Admin Email , you would see the chat list containing all of the messages from your customers when choosing Realtime Chat at Smart Chat

3. Result

The result will be like this:

Using Firebase Smartchat as a normal account:

Using Firebase Smartchat as the Admin account:

Message Notifications

When users chat with a vendor using Firebase Realtime Chat, this feature allows notifications to be displayed on the device when messages arrive whether the app is running in the background or completely shut down, facilitating quick responses from users, vendors, and administrators, ensuring Don't miss any messages.

Precondition:

Please follow these steps to set up:

  1. Go to the Cloud Functions overview page in the Google Cloud console - https://console.cloud.google.com/functions/list

Make sure that the Google Cloud project to which you want to deploy Cloud Functions is selected.

  1. Click Create function.

  1. Fill in the information in the fields as shown below:

  1. Click Save then expand the Runtimebuild... section at the end of the page for additional configuration and security options.

Detail:

Name 1: FIREBASE_CONFIG

Value 1:

{

"projectId": "`https://snipboard.io/H6JDbz.jpg

"databaseURL": "`https://snipboard.io/w6dviT.jpg

"storageBucket": "`https://snipboard.io/gPelmt.jpg

"locationId": "`https://snipboard.io/XlS9mI.jpg

}

Name 2: GCLOUD_PROJECT

Value 2: [Project ID]

Name 3: EVENTARC_CLOUD_EVENT_SOURCE

Value 3: projects/[Project ID]/locations/[region]/functions/sendNotification

5. BuildConnections and Security and image repo section remain unchanged.

  1. Click Next to move to the Code step.
  1. In the Source Code field, select the ZIP Upload option and fill in the remaining information as shown below.

  1. In the Destination bucket field, Click Browse and Select storageBucket

  1. In the ZIP file field, please DOWNLOAD the ZIP file I have attached using the link then upload your project and Click Deploy.

Download link here

  1. Continue Click Create Function.
  1. Fill in the information and fields as shown below:

  1. Click Save then expand the Runtimebuild... section at the end of the page for additional configuration and security options (Similar to step 4)

13. BuildConnections and Security and image repo section remain unchanged (Similar to step 5).

  1. Click Next to move to the Code step.
  1. In the Source Code field, select the ZIP Upload option and fill in the remaining information as shown below.

  1. In the Destination bucket field, Click Browse and Select storageBucket

  1. In the ZIP file field, please DOWNLOAD the ZIP file I have attached using the link then upload your project and Click Deploy.

Download link here

  1. When deployment finishes successfully, functions appear with a green check mark in the Cloud Functions overview page in the Google Cloud console:

  1. Select pushNotification function to Edit.

  1. Click Next to move to the Code step.
  1. Select the .runtimeconfig.json file and Edit your project's information, referring to the suggestions in step 4.

  1. After completing editing, Click Deploy again.
  1. Similarly, Edit the .runtimeconfig.json file in the sendNotification function and click Deploy again.
  1. Done.