API Reference
updateProfile()
API reference for manually updating user profiles.
Method Signature
amp.updateProfile(params: UpdateProfileParams): Promise<MotivationProfile>Parameters
interface UpdateProfileParams {
userId: string;
// Optional fields to update
preferredFraming?: 'achievement' | 'learning' | 'micro_task' | 'challenge';
communicationStyle?: 'brief_directive' | 'detailed_explanatory' | 'conversational' | 'technical';
complexityPreference?: 'full_solution' | 'break_into_steps' | 'hints_only' | 'high_level';
encouragementLevel?: 'high' | 'moderate' | 'minimal' | 'none';
metadata?: Record<string, any>;
}When to Use
Use updateProfile() when you have explicit user preferences:
- User completes an onboarding questionnaire
- User manually selects communication preferences
- You want to override learned preferences
- Importing preferences from another system
Examples
Update From User Settings
// User selected preferences in settings
await amp.updateProfile({
userId: 'user_123',
communicationStyle: 'brief_directive',
encouragementLevel: 'minimal'
});Import From External System
// Migrate user preferences from old system
await amp.updateProfile({
userId: 'user_123',
preferredFraming: legacyProfile.taskFraming,
metadata: {
imported: true,
source: 'legacy_system'
}
});💡 Note: Manual updates have higher weight than learned preferences, but AMP will still adapt based on actual outcomes.
Response
Returns the updated profile:
{
userId: 'user_123',
preferredFraming: 'achievement',
communicationStyle: 'brief_directive',
complexityPreference: 'break_into_steps',
encouragementLevel: 'minimal',
lastUpdated: '2024-01-15T10:30:00Z',
profileVersion: '2.1'
}Error Codes
INVALID_USER_ID- User ID is missing or invalidINVALID_PREFERENCE- Invalid preference valueUNAUTHORIZED- Not authorised to update this profile