How to display GC services as modules on your Android app?

How to display GC services as modules on your Android app?

The following keys are essential to call the methods for displaying the conversation AI in your app.
  1. orgId
  2. flowId
  3. domain 
The values of these keys appear under the Code Snippet section on the setup page of the ASAP help widget in Zoho Desk.  

There is an additional key called 'preferred language,' which is an optional parameter. The language code (e.g., en_us) should be provided as the value for the preferred language parameter. If the GC flow languages include the preferred language, it will load; otherwise, the default language flow will load. If no value is provided for the preferred language, the default language flow will load.

SHOW BOT


Kotlin

Without an optional parameter:

  1. ZohoGC.showFlow(activity, orgId, flowId, domain)


With optional parameter:
  1. ZohoGC.showFlow(activity, orgId, flowId, domain, "en_us") 


Java


Without an optional parameter:
  1. ZohoGC.showFlow(activity, orgId, flowId, domain, "")


With optional parameter:
  1. ZohoGC.showFlow(activity, orgId, flowId, domain, "en_us")


Setting up location block    


To enable the location block, please follow the below steps:
NotesLearn how to get the API key from Google                                                                                      

  1. Get the API key for Google Maps from Google.                     
  2. Go to the Androidmanifet.xml file and add the below lines.  

Also add the generated map API key.

  1. <meta-data
    android:name="com.google.android.geo.API_KEY"
    android:value="YOUR_MAP_API_KEY"
    tools:replace="android:value"/>

  1. Open the strings.xml file and add the following line:
  1. <string name="zoho_gc_places_api_key">YOUR_MAP_API_KEY</string>

Search option

The search option enables the user to search for a location and share it. This option will be displayed by default. If not required, follow the below method in your preferred language to hide it:

The "search option" for searching for an address is a paid service.

  

Kotlin

  1. ZConfigUtil.hideLocationSearch = true

Java

  1. ZConfigUtil.hideLocationSearch = true

What are session variables?    

These variables are dynamically retrieved during the conversation. These variables are org-specific and accessible across flows.
Learn more: Session variable

 

You can perform the following actions with the session variable:

Set Session Variable

Kotlin
  1. val sessionVariableMap = HashMap<String, Any>()
    sessionVariableMap.apply

         {
    this["name"] = "exampleName"
    this["value"] = "exampleValue"
         }

    val sessionVariableList = ArrayList<HashMap<String, Any>>()

    sessionVariableList.add(sessionVariableMap)

    ZohoGC.setSessionVariables(widgetId,sessionVariableList)

Java

  1. HashMap<String, Object> sessionVariableMap= new HashMap<>();

                sessionVariableMap.put("name","exampleName");

                sessionVariableMap.put("value","exampleValue");

                ArrayList<HashMap<String,Object>> sessionVariableList= new
    ArrayList<>();

                sessionVariableList.add(sessionVariableMap);

    ZohoGC.setSessionVariables(widgetId,sessionVariableList);


Update Session Variable 

Kotlin

  1. val sessionVariableMap = HashMap<String, Any>()
    sessionVariableMap.apply

          {
     this["name"] = "exampleName"
     this["value"] = "exampleValue"
          }

    val sessionVariableList = ArrayList<HashMap<String, Any>>()

    sessionVariableList.add(sessionVariableMap)

    ZohoGC.updateSessionVariables(context,orgId, widgetId, domain,sessionVariableList)

Java

  1. HashMap<String, Object> sessionVariableMap= new HashMap<>();
    sessionVariableMap.put("name","exampleName");
    sessionVariableMap.put("value","exampleValue");
    ArrayList<HashMap<String,Object>> sessionVariableList= new ArrayList<>();
    sessionVariableList.add(sessionVariableMap);
    ZohoGC.updateSessionVariables(context,orgId, widgetId, domain,sessionVariableList)