Account linking in pre-built messaging integrations

  • Release version: Zurich
  • Updated July 31, 2025
  • 2 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of Account linking in pre-built messaging integrations

    Account linking in Virtual Agent enables mapping users from supported chat or messaging applications to their ServiceNow user profiles. This process authenticates messaging users, allowing them seamless access to Virtual Agent topics that involve ServiceNow records. Users can be linked automatically or manually, and they also have the option to unlink or relink their accounts as needed.

    Show full answer Show less

    Key Features

    • Account auto-linking: Available for Conversational Integrations such as Slack, Microsoft Teams, and Workplace from Facebook. When enabled, users are automatically linked based on matching email accounts between their messaging app and ServiceNow profile, eliminating manual linking prompts.
    • Manual linking and unlinking: Users can unlink their ServiceNow account during Virtual Agent conversations via a logout command and will be prompted to link their account again in subsequent sessions.
    • Configuration: Account auto-linking is enabled by selecting the connection record in syscsprovider.list, checking the “Allow account linking” and “Auto link users’ ServiceNow profiles” options, and providing an account linking script to map email addresses to ServiceNow user records.
    • Domain considerations: Auto-linking works only for users in the domain used to install Microsoft Teams. To auto-link users from other domains, the Teams installation must use the global domain.

    Practical Use and Benefits

    By enabling account auto-linking, ServiceNow customers can streamline user authentication within messaging integrations, removing friction from Virtual Agent interactions. This improves user experience by providing instant access to personalized Virtual Agent services tied to their ServiceNow records.

    Administrators maintain control through configuration settings and scripts, ensuring accurate user identification and secure linking. Users retain flexibility to unlink and relink accounts, supporting scenarios where account changes or privacy considerations arise.

    In Virtual Agent, account linking maps the users of a supported chat or messaging application to their ServiceNow user profile. Account auto-linking authenticates your messaging users, which enables users to automatically access Virtual Agent topics that involve ServiceNow records. If needed, users can also manually unlink from or link to their ServiceNow accounts.

    How account auto-linking works

    In the Conversational Integrations for Slack, Microsoft Teams, and Workplace from Facebook, you have the option to enable account auto-linking, which automatically links messaging users to their ServiceNow accounts. If you enable the account auto-linking feature on the Messaging Apps Integration page, your users are not prompted to link to their ServiceNow accounts when they engage with the virtual agent.

    In earlier releases, messaging users were prompted to link to their ServiceNow accounts or continue as guests. However, for the Conversational Integrations for Slack, Microsoft Teams, and Workplace, if you enable account auto-linking, your users do not manually link their messaging accounts to their ServiceNow accounts, provided that they use the same email account for their messaging and ServiceNow accounts. During auto-linking, Virtual Agent maps the email accounts of messaging users to their email accounts defined in their profiles in the Users [sys_user] table. When the email accounts match, the user is automatically linked (authenticated) and they do not see the Link to ServiceNow button when they begin a bot conversation.

    In messaging integrations, your users can still use the logout command during bot conversations to unlink from their ServiceNow accounts. However, in all subsequent conversations after unlinking, Virtual Agent prompts them to link their accounts. When they engage with the virtual agent, they are prompted to link to their ServiceNow account or continue as a guest user.

    Account auto-linking

    You can allow a user's 3rd party accounts to be auto-linked to their ServiceNow® profile.

    You can enable account auto-linking in the sys_cs_provider.list. This feature bypasses the prompt for the users to link their accounts manually.
    Note:
    Account linking is possible only for users who belong to the same domain that was used for installing Microsoft Teams on an instance. To auto-link users from other domains, ensure that Microsoft Teams installation is done using the global domain.

    In the navigation filter type sys_cs_provider.list. Select the connection record you wish to link. Check the Allow account linking box, then check the Auto link users' ServiceNow profiles box that appears. Fill in the Automatic link action field with the corresponding account linking script.

    Example: Account auto-linking script
    var response_body = inputs['response_body'];
    var status_code = inputs ['status_code'];
    var email_id = '';
    if(status_code>200 && status_code<=210){
        email_id = response_body && JSON.parse(response_body).userPrincipalName;
    }
    var sysUserId = null;
    
    if(email_id){
        var gr = new GlideRecord("sys_user");
        gr.addQuery("email",email_id);
        gr.query();
        while(gr.next()){
            sysUserId = gr.getUniqueValue();
        }
    }
    if(sysUserId){
        outputs['status'} = 'Success';
        outputs['userid'] = sysUserId;
    }
    else{
        outputs['status'] = 'Failure';
    }
    
    })(inputs,outputs);