Profile feature provides methods for managing your own account’s display name, status text (about), and profile picture.
Access
Access profile operations through the client:Methods
set_push_name
set_push_name(&str) returns Result<PushNameOutcome, ProfileError>. An empty name is rejected. A presence transport failure returns an error before changing the local name. Otherwise, the client attempts app-state synchronization and updates the local name.
Synced means the app-state step completed. SyncPending { source } retains the original AppStateError after presence was sent and the local name updated. Neither outcome proves that every linked device displays the name or that all local state is durable. Transport acceptance is not a server ACK.
sync_push_name
sync_push_name(&str) returns Result<(), AppStateError>. Retry this step after the connection or keys become available. It sends only the app-state mutation, without resending presence or changing the local name. Retry only if the pending name is still desired; do not overwrite a newer choice.
set_text_status
Set your About text, with an optional emoji and an explicit expiry. This uses the text-status MEX mutation.TextStatusExpiry::After(std::time::Duration::from_secs(3600)) for an expiring About. Durations must be at least one second. ProfileError::Mex preserves a failed mutation.
clear_text_status
client.profile().clear_text_status().await? sends null text with zero duration to remove the About.
set_status_text
set_status_text(&str) remains available for the legacy status IQ. A successful IQ does not establish that phone clients display the new About. Prefer set_text_status. These operations are separate from audience-selected status posts.
set_profile_picture
Set your profile picture.image_data- JPEG image bytes
SetProfilePictureResponse- Contains the new picture ID
remove_profile_picture
Remove your profile picture.SetProfilePictureResponse- Confirmation of removal
Since v0.6 the remove IQ omits the
<picture/> child entirely, matching WA Web’s SendProfilePictureJob. Sending an empty <picture> child was rejected by some hosts.Types
SetProfilePictureResponse
Response from profile picture operations.Retain pending synchronization
Theset_name helper above returns the outcome to its caller. Store the pending name and cause before starting unrelated profile operations, so a later picture or status-text failure cannot discard the synchronization result.
Error handling
Profile updates returnResult<T, ProfileError>; the app-state-only retry returns Result<(), AppStateError>:
InvalidArgument— e.g., empty push nameIq— server rejected the status text or picture IQClient(ClientError::NotLoggedIn)— not authenticatedInternal— network errors, encoding failures