Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 2 Current »

You may wish to use Send2CRM service contexts to identify which services should be used for particular purposes.

Adding Contexts

New contexts can be added after service registration.

send2crm.services.addContext('customContext', 'myAlias');

Check if a Service has Context

Test whether a specific service has a context enabled.

let isCustomContext = send2crm.services.hasContext('customContext', 'myAlias');

Find all Services with Context

Use your custom contexts to retrieve a subset of service configurations.

let ctxServices = send2crm.services.getServicesFor('customContext');
// Result:
[
  {
    alias: 'myAlias',
    apiUrl: 'https://example.com',
    apiKey: '<key>',
    contexts: ['customContext']
  }
]

This will return an array of objects with service configuration data, may be empty if no matches.

  • No labels