> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zavu.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Contacts

> Create, list, retrieve and update contacts via the Zavu Ruby SDK. Manage profile metadata, channels and merge suggestions from your code.

Contacts are automatically created when you send messages. You can retrieve and update contact information.

## Get Contact

```ruby theme={null}
result = client.contacts.get(contact_id: "con_abc123")

puts result.id
puts result.phone_number
puts result.country_code
puts result.available_channels
puts result.default_channel
```

## Get Contact by Phone

```ruby theme={null}
result = client.contacts.get_by_phone(phone_number: "+14155551234")

puts result.id
puts result.available_channels # ["sms", "whatsapp"]
```

## Update Contact

```ruby theme={null}
result = client.contacts.update(
  contact_id: "con_abc123",
  default_channel: "whatsapp",
  metadata: {
    "name" => "John Doe",
    "tier" => "premium"
  }
)
```

## List Contacts

```ruby theme={null}
result = client.contacts.list(limit: 50)

result.items.each do |contact|
  puts "#{contact.id} #{contact.phone_number}"
end

# Filter by phone number
result = client.contacts.list(phone_number: "+1415")

# Pagination
cursor = nil
loop do
  result = client.contacts.list(cursor: cursor, limit: 50)
  result.items.each { |contact| puts contact.id }
  cursor = result.next_cursor
  break if cursor.nil?
end
```

## Phone Introspection

Validate a phone number and check available channels:

```ruby theme={null}
result = client.introspect.phone(phone_number: "+14155551234")

puts result.valid_number       # true
puts result.country_code       # "US"
puts result.national_format    # "(415) 555-1234"
puts result.line_type          # "mobile"
puts result.available_channels # ["sms", "whatsapp"]
puts result.carrier&.name      # "Verizon Wireless"
```
