Users
Understanding users in Notiflows
Users
Users are the individuals in your system who receive notifications. In Notiflows, a user represents a person who can be targeted by your notiflows and receive messages through various channels.
User Identification
Each user in Notiflows must have a unique identifier. This identifier serves as the primary way to reference the user across all operations. It's recommended to use your application's internal user ID (such as a database primary key) as the Notiflows user identifier.
Important Considerations:
- Choose identifiers that are stable and won't change over time
- Avoid using email addresses or phone numbers as identifiers, as these can change
- Use consistent identifier formats across your application
User Attributes
Users can have both standard and custom attributes that help personalize notifications and enable channel-specific delivery.
Standard Attributes:
- id (required): The unique identifier for the user
- email: Primary email address, needed for email channel delivery
- name: Full name or display name of the user
- avatar: URL pointing to the user's profile picture
- phone_number: Phone number in E.164 format, required for SMS delivery
- timezone: User's time zone, useful for scheduling notifications at appropriate times
Custom Properties:
Beyond standard attributes, you can store any additional information as custom properties. These are key-value pairs that allow you to personalize notifications with user-specific data. For example, you might store subscription tier, language preference, or account status.
When updating user properties, Notiflows performs a deep merge, meaning existing properties are updated with new values, and you can remove properties by setting them to null.
Managing Users
Creating and Updating Users
Users are created or updated when you identify them in Notiflows. This can happen:
- Explicitly through the user identification API
- Automatically when a user is referenced in a notiflow trigger
- During user registration or profile updates in your application
Retrieving User Information
You can fetch the current state of any user, including all their attributes and properties, using the user retrieval API. This is useful for displaying user information in dashboards or verifying user data.
Deleting Users
When a user is removed from your system, you can delete them from Notiflows. This action:
- Prevents the user from receiving future notifications
- Removes them from user lists and dashboards
- Preserves historical notification data for audit purposes
Special Cases
Guest Users
For scenarios where you need to notify someone who isn't yet a registered user (like sending an invitation email), you can create temporary user records. Use a unique identifier such as a prefixed ID (e.g., guest_abc123) or their email address. If they later register, you can merge the guest record with their permanent user account.
Multiple User Types
If your application has different types of users (customers, administrators, vendors, etc.), you can distinguish them by prefixing their identifiers. For example: customer_123, admin_456, vendor_789. This helps organize and filter users while maintaining clear separation.
Non-User Entities
For notifying entities that aren't people (like systems, services, or automated processes), consider using a different approach or modeling them as special user types with appropriate identifiers.
Environment Isolation
Users are scoped to specific environments (development, staging, production). Each environment maintains its own separate set of users. This ensures that test data doesn't interfere with production notifications and allows you to safely experiment in development environments.
Best Practices
- Consistent Identification: Always use the same identifier format across your application
- Regular Updates: Keep user attributes current, especially contact information like email and phone numbers
- Privacy Considerations: Only store necessary user data and respect privacy regulations
- Error Handling: Implement fallbacks for cases where user data might be missing or incomplete
By properly managing users in Notiflows, you ensure that notifications reach the right people with the right information, delivered through their preferred channels.