Skip to content

getUserList

Returns CRM users for server-side call logging user mapping.

Optional interface

Implement this when admins should be able to map RingCentral extensions to CRM users for server-side logging ownership.

Signature

async function getUserList({
  user,
  authHeader,
  proxyConfig
}) {
  return [
    {
      id: 'crm-user-id',
      name: 'Jane Smith',
      email: 'jane@example.com'
    }
  ];
}

Input

Field Description
user Connected CRM user used to access the CRM user list.
authHeader Prepared CRM auth header.
proxyConfig Proxy configuration when applicable.

Return

Return an array of CRM user records:

Field Description
id CRM user ID used by your connector for ownership/assignment.
name CRM user display name.
email CRM user email. Core uses this for automatic mapping to RingCentral extensions.

Core auto-matches CRM users to RingCentral extensions by email or name. Admins can manually fix unmatched users.

Reference

const axios = require('axios');

// Used to get user list for server-side call logging user mapping
async function getUserList({ user, authHeader }) {
    //--------------------------------------
    //--- TODO: Add CRM API call here ------
    //--------------------------------------
    // const userListResponse = await axios.get('https://api.crm.com/users', {
    //     headers: {
        //         'Authorization': authHeader
        //     }
        // });
        const mockUserListResponse = {
            data: [
                {
                    id: 'testUserId',
                    name: 'Test User',
                    email: 'test@example.com'
                },
                {
                    id: 'testUserId2',
                    name: 'Test User 2',
                    email: 'test2@example.com'
                },
                {
                    id: 'testUserId3',
                    name: 'Test User 3',
                    email: 'test3@example.com'
                }
            ]
        }
    return mockUserListResponse.data.map(user => ({
        id: user.id,
        name: user.name,
        email: user.email
    }));
}

module.exports = getUserList;