Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
Embed Engagement Messenger in a native android app using Now Mobile SDK - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • Embed Engagement Messenger in a native android app using Now Mobile SDK
KB1587611

Embed Engagement Messenger in a native android app using Now Mobile SDK


660 Views Last updated : Feb 5, 2024 All Users, Any User, public Copy Permalink
KB Summary by Now Assist

This topic provides steps to embed Engagement Messenger in a native android mobile app built with Swift. 

Pre-requisite: 

To embed Engagement Messenger in the native applications, the developer or user needs to configure the following:

  • Now Mobile SDK libraries in the application. For more information, see Mobile SDK Libraries – Android in the ServiceNow® store.
  • Mobile SDK Plugin and OAuth JWT Authentication on your ServiceNow Instance. For more details, see Mobile SDK API reference - Android.
  • Install and configure the latest version of Engagement Messenger (Support v5.2 onwards) in your ServiceNow instance. For more details, see Setting up Engagement Messenger.
  • Copy the Engagement Messenger module ID, as you need it to embed messenger in the mobile app.

Procedure

  1. Open or create jwtsettings.xml file in the project and provide your instance_url in the respective tags.
    <string name = "instance_url">your_instance_url</string> 

  2. Open/Create emsettings.xml resource file and add a string for em_module_id with the Engagement Messenger module id.
    <string name="em_module_id">your_module_id</string> 

  3. Copy “EmViewModel.kt”, “EmViewDelegate.kt” and “NowServiceManager.kt” files to your app project from the sampleapp project.

  4.  In NowServiceManager.kt class, ensure that while creating NowWebService object, EmViewDelegate object is passed as nowWebSdkCallbacks parameter.suspend fun getNowWebService(emViewDelegate: EmViewDelegate? = null): NowWebService? { 
        webService?.also { return it } 
     
        val settings = getSettings() ?: return null 
     
        return suspendCoroutine { cont -> 
            NowWebSDK.makeWebService(URL(settings.instanceBaseURL), 
                { 
                    this.webService = it 
                    cont.resume(it) 
                }, { 
                    Log.e(TAG, "Unable to launch web: $it") 
                    cont.resumeWithException(it) 
                }, emViewDelegate)  
  5. Initialize EmViewModel object using activityViewModels() in the class from where Engagement Messenger needs to be launched.
    private val emViewModel: EmViewModel by activityViewModels() 

  6. On any click event or function, the loadEMfeature(context) function of EmViewModel can be used to launch Engagement Messenger. 

    Note: Activity or fragment Context needs to be passed to loadEMfeature method.

    // Open Engagement Messenger Home 

    emViewModel.loadEMFeature( 
        context = requireContext() 
    ) 

  7. Use the Deep linking functionality to launch any feature on Engagement Messenger. You can customize the loadEMfeature function with the feature name to launch any specific feature on Engagement Messenger. For more information, see Deep Linking Features in Engagement Messenger.

    // Open Engagement Messenger Chat feature 

    emViewModel.loadEMFeature( 
        featureName = "CHAT”, 
        context = requireContext() 
    ) 

     

    // Open Engagement Messenger feature with parameters 

    emViewModel.loadEMFeature( 
        featureName = "CATALOG_ITEM”, 
        params = mapOf("sys_id" to "3022c182d52d3904c602d97466d5a6b1"), 
        context = requireContext() 
    ) 

    // Open Engagement Messenger feature with lang parameter 

    emViewModel.loadEMFeature( 
        featureName = "VIEW_ARTICLE”, 
        lang = "en", 
        params = mapOf("sys_kb_id" to "ada238e89f011200550bf7b6077fcf87"), 
        context = requireContext() 
    ) 


    To see how Engagement Messenger works in the mobile application, developers can refer to the SampleApp Project that is available with Mobile SDK Libraries as SampleApp.zip and check how Engagement Messenger is implemented and configured in the Sample App.

The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.