Settings & Profile
How to integrate your Butler with The Butler's settings and profile system. Access user preferences, manage Butler permissions, and handle account settings through the core experience.
Overview
The Butler centralizes account, preferences, data export, and Butler permissions in the core experience. Your Butler can access user preferences and must declare the permissions it needs. Users can manage all settings from The Butler's settings interface.
User Preferences
Access user preferences that are managed centrally by The Butler.
Get User Preferences
// Get user preferences
const preferences = await window.lifeButler.getUserPreferences();
// Returns:
// {
// locale: 'en-US',
// theme: 'dark',
// timezone: 'America/New_York',
// currency: 'USD',
// dateFormat: 'MM/DD/YYYY',
// notifications: { ... },
// privacy: { ... }
// }
// Subscribe to preference changes
window.lifeButler.onPreferencesChange((preferences) => {
// Update your UI when preferences change
updateLocale(preferences.locale);
updateTheme(preferences.theme);
});Butler Permissions
Your Butler must declare the permissions it needs, and users can grant or revoke these permissions at any time through The Butler's settings.
Declare Permissions
// In your Butler manifest
{
"permissions": {
"data": {
"read": ["Transaction", "Contact"],
"write": ["Transaction"],
"explanation": "Need to read and create transactions for expense tracking"
},
"notifications": {
"schedule": true,
"explanation": "Need to schedule reminders for recurring expenses"
},
"calendar": {
"read": true,
"write": true,
"explanation": "Need to create calendar entries for bill due dates"
}
}
}Check Permissions
// Check if permission is granted
const hasPermission = await window.lifeButler.hasPermission({
type: 'data',
action: 'write',
resource: 'Transaction'
});
if (!hasPermission) {
// Request permission or show message
await window.lifeButler.requestPermission({
type: 'data',
action: 'write',
resource: 'Transaction',
explanation: 'Need to create transactions for expense tracking'
});
}
// Listen for permission changes
window.lifeButler.onPermissionChange((permission, granted) => {
if (!granted) {
// Handle permission revocation
disableFeaturesRequiringPermission(permission);
}
});Account Information
Access basic account information that is managed by The Butler.
// Get account information
const account = await window.lifeButler.getAccount();
// Returns:
// {
// id: 'user-123',
// email: 'user@example.com',
// name: 'John Doe',
// avatar: '/avatars/user-123.png',
// createdAt: '2024-01-01T00:00:00Z'
// }
// Note: Butlers cannot modify account information directly
// Account changes must go through The Butler's settings interfaceData Export
Users can export all their data from The Butler's settings. Your Butler should ensure all data it creates is accessible through the data export system.
Data Export Integration
Data created by your Butler is automatically included in data exports. Ensure your data follows the platform's data schema so it can be properly exported.
// Your Butler's data is automatically included in exports
// Ensure you use the Data API for all data operations:
await window.lifeButler.data.create('Transaction', {
amount: 25.50,
category: 'groceries',
date: '2024-01-15'
});
// This data will be included in user's data export automaticallyRequirements
- Declare permissions: Clearly declare all permissions your Butler needs in the manifest with explanations.
- Check permissions: Always check if permissions are granted before using protected features.
- Handle revocation: Gracefully handle permission revocation by disabling features that require the permission.
- Respect preferences: Use user preferences (locale, theme, timezone) in your Butler's UI and functionality.
- Use Data API: Store all data through the Data API so it's included in data exports automatically.