Sign In Try it free

Listing Mailboxes


Overview

Mailboxes are synonymous with:

  • labels in Gmail
  • folders in O365
  • mailboxes in IMAP

A mailbox is a container for emails (sent, received, drafts) and each account can have many.

Mailbox model

See mailbox model in the reference.

Listing the mailboxes

A call to list mailboxes will, by default, return all mailboxes for all connected email accounts.

WorkAPI does not attempt to merge mailboxes together, instead returning each as a separate entity. Requests to list emails can then be filtered by one or more mailbox IDs to allow the developer to fetch all mails in all inboxes.

Example

token = "<user's token>"
client = LivilApi::Service.new(token) 

mailboxes = client.list_mailboxes

mailboxes
# => [LivilApi::Mailbox(id: '...', name: 'INBOX', unread_count: 100, ...), LivilApi::Mailbox(id: '...', name: 'SENT', unread_count: 0, ...), ...]

First 50,000 requests are free every month