Initializing Client

All communication with TigerConnect is performed with a single TigerConnect.Client instance. The client can hold a single authenticated user, and will execute all commands on this user's behalf.

You can create a client by using our provided constructor.

Definition

new TigerConnect.Client({
apiEnv: ?string = 'production',
baseUrl: ?string,
defaultOrganizationId: ?string = null,
logLevel: ?string = 'error',
partnerName: string,
version: ?string
}):<Client>

Parameters

ParameterTypeDescription
apiEnv?stringEnvironment to use (default: production). For testing purposes, it is recommended to set this to uat. Will be ignored if baseUrl is provided. Please coordinate this value with your TigerConnect support representative.
baseUrl?stringExact URL to use when contacting the TigerConnect API servers (default: not provided, in which case the apiEnv parameter will be used to formulate the URL). Please coordinate this value with your TigerConnect support representative.
defaultOrganizationId?stringThe default organization used to send all messages; if not provided, no default organization will be used
logLevel?stringHow verbose logging should be, can be one of debug/info/warn/error/fatal
partnerNamestringA name used to identify a specific partner of TigerConnect. Please coordinate this value with your TigerConnect support representative.
version?stringA version number which identifies the partner's own code deployment

Returns

A client object that can be used to sign in with a user and execute commands.

Example

const client = new TigerConnect.Client({
apiEnv: 'uat',
defaultOrganizationId: 'some-org-id',
partnerName: 'a-partner-name'
});
const session = await client.signIn(
'user@mail.com', 's3cr3t'
);
console.log('Signed in as', session.user.displayName);
const message = await client.messages.sendToUser(
'someone@mail.com', 'hello!'
);
console.log(
'sent', message.body, 'to', message.recipient.displayName
);
client.events.connect();
client.models.Message.on('afterInject', function(resource, message) {
console.log(
'message received from',
message.sender.displayName,
'to',
message.recipient.displayName,
':',
message.body
);
});