Get All Users

Usage

Use this method to obtain a list of all users registered in a Messenger instance. It also lets you:

  • Filter the returned users through a set of parameters.
  • Control pagination of the returned results.
  • Define how many records will be returned.
    client.getAllUsers().then(data => {}).catch(error => {})

Data

If you want to obtain a list of all users, this method requires no data.

Filter options

If you want to obtain a specific list of users, provide a value for one or more of the following parameters:

Name Type Description
name string The name of the user you want the response to contain
address string The address of the user you want the response to contain
agent boolean "True" or "False" to obtain information about whether the returned users are agents or not
page integer The number of pages of results that will be returned. Has to be equal to or greater than 1.
items integer The amount of items returned on each page. Has to be equal to or greater than 1.

Response data format

The getAllUsers method returns a list of the requested users. For the full response model, please see the Responses section for the GET /users endpoint on the Messenger API Routes page.

Examples

An example call using filters could have the following structure:

client.getAllUsers().then(function(result){
console.log(result);
});

client.getAllUsers({
    address: '<email_address>',
    page: <page_number>,
    items: <total_items>
}).then(function(result){
console.log(result);
});

An example call without filters would have the following structure:

client.getAllUsers().then(data => {}).catch(error => {})