> ## Documentation Index
> Fetch the complete documentation index at: https://whatsapp-rust.jlucaso.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Profile

> Manage your own profile - push name, status text, and profile picture

The `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:

```rust theme={null}
let profile = client.profile();
```

## Methods

### set\_push\_name

Set your display name (push name).

```rust theme={null}
pub async fn set_push_name(&self, name: &str) -> Result<(), ProfileError>
```

**Parameters:**

* `name` - The new display name (cannot be empty)

Updates the local device store, sends a presence stanza with the new name, and propagates the change via app state sync for cross-device synchronization.

**Example:**

```rust theme={null}
client.profile().set_push_name("My Bot").await?;
```

<Note>
  The push name change takes effect immediately via presence, but app state sync may fail if keys aren't available yet (e.g., right after pairing before initial sync completes).
</Note>

### set\_status\_text

Set your status text (about).

```rust theme={null}
pub async fn set_status_text(&self, text: &str) -> Result<(), ProfileError>
```

**Parameters:**

* `text` - The new status text

Sets the profile "About" text. This is different from ephemeral text status updates.

**Example:**

```rust theme={null}
client.profile().set_status_text("Available 24/7").await?;
```

### set\_profile\_picture

Set your profile picture.

```rust theme={null}
pub async fn set_profile_picture(
    &self,
    image_data: Vec<u8>
) -> Result<SetProfilePictureResponse, ProfileError>
```

**Parameters:**

* `image_data` - JPEG image bytes

**Returns:**

* `SetProfilePictureResponse` - Contains the new picture ID

The image should already be properly sized/cropped by the caller. WhatsApp typically uses 640x640 images.

**Example:**

```rust theme={null}
use std::fs;

let image_bytes = fs::read("profile.jpg")?;
let response = client.profile().set_profile_picture(image_bytes).await?;
println!("New picture ID: {:?}", response.id);
```

<Warning>
  The image must be a valid JPEG. Other formats are not supported.
</Warning>

### remove\_profile\_picture

Remove your profile picture.

```rust theme={null}
pub async fn remove_profile_picture(&self) -> Result<SetProfilePictureResponse, ProfileError>
```

**Returns:**

* `SetProfilePictureResponse` - Confirmation of removal

**Example:**

```rust theme={null}
client.profile().remove_profile_picture().await?;
```

<Note>
  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.
</Note>

## Types

### SetProfilePictureResponse

Response from profile picture operations.

```rust theme={null}
pub struct SetProfilePictureResponse {
    /// The new picture ID (or None if removed)
    pub id: Option<String>,
}
```

## Complete example

```rust theme={null}
use whatsapp_rust::Client;
use std::sync::Arc;
use std::fs;

async fn setup_profile(client: &Arc<Client>) -> anyhow::Result<()> {
    // Set display name
    client.profile().set_push_name("My WhatsApp Bot").await?;
    
    // Set status text
    client.profile().set_status_text("Automated responses").await?;
    
    // Set profile picture
    let image_bytes = fs::read("bot_avatar.jpg")?;
    let response = client.profile().set_profile_picture(image_bytes).await?;
    
    if let Some(id) = response.id {
        println!("Profile picture updated: {}", id);
    }
    
    Ok(())
}
```

## Error handling

All methods return `Result<T, ProfileError>`:

```rust theme={null}
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum ProfileError {
    #[error("{0}")]
    Iq(#[from] IqError),
    #[error("{0}")]
    Client(#[from] ClientError),
    #[error("invalid argument: {0}")]
    InvalidArgument(String),
    #[error("{0}")]
    Internal(#[from] anyhow::Error),
}
```

Common errors:

* `InvalidArgument` — e.g., empty push name
* `Iq` — server rejected the status text or picture IQ
* `Client(ClientError::NotLoggedIn)` — not authenticated
* `Internal` — network errors, encoding failures

```rust theme={null}
use whatsapp_rust::ProfileError;

match client.profile().set_push_name("").await {
    Ok(_) => println!("Name updated"),
    Err(ProfileError::InvalidArgument(msg)) => eprintln!("Invalid: {}", msg),
    Err(e) => eprintln!("Failed: {}", e),
}
```

## See also

* [Contacts](/api/contacts) - Get profile pictures for other users
* [Presence](/api/presence) - Set online/offline status
