Entitlements control which features and capabilities are available to your account. You can check available entitlements, enable new features, and manage access permissions through the Entitlements API.
import { Contiguity } from 'contiguity';const contiguity = new Contiguity('contiguity_sk_...');// List all available entitlementsconst entitlements = await contiguity.entitlements.list();// Check a specific entitlementconst imessage = await contiguity.entitlements.get('imessage');// Apply an entitlementawait contiguity.entitlements.apply('imessage');
It’s good practice to check entitlements before attempting to use a feature:
async function sendImessage(to: string, message: string) { // Check if iMessage is enabled const imessageEntitlement = await contiguity.entitlements.get('imessage'); if (!imessageEntitlement.enabled) { throw new Error('iMessage is not enabled for this account'); } // Proceed with sending return contiguity.imessage.send({ to, message });}
Cache entitlement status locally to avoid making API calls on every operation. Refresh periodically or when operations fail due to missing entitlements.
Check before use - Verify entitlements before attempting to use features
Handle gracefully - Provide clear error messages when features aren’t available
Cache status - Don’t check entitlements on every single request
Monitor changes - Be aware that entitlements can change over time
Document requirements - Clearly communicate which entitlements your application needs