Skip to main content

AppleScript Support

BusyContacts for Mac includes an AppleScript automation API covering the same 33 contact commands available in the AI & MCP Server, plus get URL for opening busycontacts:// links. You can list address books, tags, and Smart Filters, search contacts, check upcoming birthdays and anniversaries, read mail and calendar activity metadata, create or patch cards, edit individual fields, manage notes and tags, compare address books, import and export vCards, and work with photos directly from a script. Changes save through BusyContacts' editing pipeline and sync through your connected accounts.

note

BusyContacts' AppleScript support is Mac-only and requires macOS 13.5 or later. AppleScript uses normal macOS Apple Events authorization (System Settings > Privacy & Security > Automation) and does not require turning on the MCP server in Settings > Automation.

For visual workflows and voice actions, see Siri and Shortcuts. For AI assistants such as Claude, Codex, ChatGPT, or Gemini, see AI & MCP Server.

Getting Started​

Open Script Editor (in /Applications/Utilities) and paste any of the examples below to try them out.

Call all commands inside a tell application "BusyContacts" block. Each command accepts labeled parameters after given and returns an AppleScript record with camelCase user-labeled keys. Every automation command supports both a camelCase name and a spaced lowercase synonym (for example, searchContacts or search contacts, createContact or create contact). This guide uses the spaced names in examples for readability.

tell application "BusyContacts"
set resultRecord to list address books given writableOnly:true
return |items| of resultRecord
end tell

You can also run scripts from Terminal using osascript:

osascript -e 'tell application "BusyContacts" to list address books'

For multi-line scripts, save the script to a file (for example contacts.applescript) and run:

osascript contacts.applescript

Data commands do not open or activate a BusyContacts window; only open contact and show smart filter bring up or change the app window. If BusyContacts is still starting up when a script runs, the command waits until the contacts database is ready before executing.

Always use piped user labels for record keys

Input records (contact, changes, field, and items inside updates) must use user-labeled camelCase keys. Wrap record keys in vertical pipes (|...|) when building input records and when reading fields from returned records, especially for AppleScript reserved words like |id|, |name|, |text|, |date|, and |items|. Passing an unpiped standard AppleScript property keyword (such as name: instead of |name|:) rejects the entire command with invalidArguments rather than silently ignoring the key.

Record Values, Dates, and Nulls​

BusyContacts maps AppleScript values onto its contact schema with strict type checks:

  • Null values (missing value): Use missing value to clear nullable scalar fields in update contact / update contacts, clear structured address or profile components in update contact field, clear the primary image in set contact photo (inputFile:missing value), or represent a birthday or custom date without a year ({|year|:missing value, |month|:12, |day|:10}). Omitting a key preserves its current value. Returned null properties (such as nextOffset on the last page or age when no birth year is stored) also appear as missing value.
  • Timestamps vs. calendar days:
    • Timestamp parameters (createdSince and modifiedSince on search contacts and list contacts, plus start and end on query activity) accept either a real AppleScript date (such as (current date) - (7 * days)) or an ISO 8601 string with Z or an explicit offset (such as "2026-11-01T00:00:00Z"). Passing an AppleScript date to any other parameter is rejected.
    • Calendar-day parameters (birthdayStart, birthdayEnd, and list upcoming dates start / end) take Gregorian YYYY-MM-DD text strings with an optional IANA timeZone string (such as "America/New_York" or "UTC").
    • Returned dates: createdAt, modifiedAt, and activity date are returned as real AppleScript date values. occursOn is returned as YYYY-MM-DD text, and ContactDate values use {|year|:..., |month|:..., |day|:...}.
  • Lists and numbers: Array parameters take AppleScript lists ({"Client", "VIP"}), and integers must fit in 32-bit signed integers. Unknown keys in input records are rejected (invalidArguments).

Command Summary​

Utility:

  • get URL: open a busycontacts:// URL action

Discovery and reading:

  • list address books (listAddressBooks): list eligible address books, accounts, and write access
  • list tags (listTags): list tags and distinct eligible physical-card counts
  • list smart filters (listSmartFilters): list saved Smart Filters without activating them
  • list contacts (listContacts): enumerate physical or merged contacts with structured filters
  • search contacts (searchContacts): search contacts by free text and structured filters
  • get contact (getContact): fetch a contact (or "me") and its accessible linked cards
  • selected contacts (selectedContacts): read the contacts currently selected in the main window
  • list upcoming dates (listUpcomingDates): list upcoming birthdays, anniversaries, and custom dates
  • query activity (queryActivity): read Apple Mail and BusyCal activity metadata for a contact
  • compare address books (compareAddressBooks): find cards in one address book missing from another
  • parse contact text (parseContactText): preview Quick Entry parsing without saving

Creating and editing:

  • create contact (createContact): create a structured person or company card
  • create contact from text (createContactFromText): parse Quick Entry text and create a card
  • update contact (updateContact): patch scalar properties on one physical card
  • update contacts (updateContacts): patch 1 to 100 physical cards atomically
  • add contact field (addContactField): add one typed field row and return its field record
  • update contact field (updateContactField): patch one exact field row by fieldID
  • remove contact field (removeContactField): remove one exact field row by fieldID
  • append note (appendNote): append plain text (optionally dated or private) to a card's note
  • add tags (addTags): add tags to 1 to 100 physical cards
  • remove tags (removeTags): remove exact tags from 1 to 100 physical cards
  • duplicate contact (duplicateContact): duplicate a physical card into the same or another book

Organizing, linking, and deleting:

  • move contacts (moveContacts): move 1 to 100 physical cards to another writable address book
  • link contacts (linkContacts): link 2 to 100 physical cards without merging their data
  • unlink contacts (unlinkContacts): remove local links for selected physical cards
  • merge contacts (mergeContacts): merge physical cards and return surviving cards and transitions
  • delete contacts (deleteContacts): delete 1 to 100 physical cards

Import, export, and photos:

  • export contacts (exportContacts): export up to 500 cards as vCard 3.0 (inline text or file)
  • import contacts (importContacts): import vCard text or a vCard file into a writable address book
  • get contact photo (getContactPhoto): read a contact's primary photo or logo as PNG
  • set contact photo (setContactPhoto): set or clear a contact's primary image

Navigation:

  • open contact (openContact): reveal a physical card in the main window or a floating Info window
  • show smart filter (showSmartFilter): activate a saved Smart Filter in the main window

Identity, Scope, and Permissions​

BusyContacts returns edition-scoped opaque identifiers across all automation surfaces:

PrefixIdentifiesNotes
bcc1.…Physical contact cardRequired by all write commands. "me" is accepted only by get contact.
bcf1.…Individual field rowReturned on contact reads and add contact field (|id| of |field| of result).
bcb1.…Address bookReturned by list address books.
bca1.…AccountReturned inside address book records.
bcs1.…Saved Smart FilterReturned by list smart filters.
bct1.…TagReturned by list tags.

Keep these rules in mind when scripting BusyContacts:

  • Merged reads vs. physical writes: search contacts and get contact merge accessible linked sets by default, while list contacts defaults to physical cards (view:"physical"). Every write command targets explicit physical card IDs (bcc1.…). Moving or merging contacts can create new card IDs returned in idTransitions; update any saved IDs from idTransitions or refetch the contact after moves, merges, or sync refreshes.
  • Address book permissions and excluded sources: Read-only address books reject edits to synced fields (readOnlyContact or readOnlyAddressBook), and sources excluded in BusyContacts' source list stay hidden from scripts. Unchecked address books remain readable unless their source is excluded. Group cards are omitted from ordinary contact queries.
  • Private fields (My Notes and My Tags): Omitted from searches, reads, and tag counts unless you pass includePrivate:true.
  • Contact activity access: query activity requires Share contact activity with automation to be turned on in BusyContacts > Settings > Integrations. It returns metadata only (never message bodies) and never launches BusyCal.
  • Destructive commands run directly: Unlike Siri and Shortcuts, AppleScript commands such as delete contacts and merge contacts do not display an interactive confirmation sheet in BusyContacts. Double-check target IDs before running destructive scripts.

Utility​

get URL​

Opens a busycontacts:// URL, just like clicking a BusyContacts link. See URL Handler for supported URL formats.

ParameterTypeRequiredDescription
Direct parameterTextYesThe busycontacts:// URL to open (for example busycontacts://show/ada@example.com or busycontacts://new/...).
tell application "BusyContacts"
get URL "busycontacts://show/ada@example.com"
end tell

Discovery and Reading​

list address books​

Primary name: listAddressBooks · Synonym: list address books

Returns eligible address books, their owning accounts, and write-access flags (read_only, read_write, or owner).

ParameterTypeRequiredDescription
accountIDTextNoRestrict results to one eligible account (bca1.…).
writableOnlyBooleanNoReturn only address books that allow creating contacts.
offsetIntegerNoPagination offset (0 to 100000, default 0).
limitIntegerNoMaximum items to return (1 to 500, default 50).

list tags​

Primary name: listTags · Synonym: list tags

Returns tags and the number of distinct eligible physical cards carrying each tag.

ParameterTypeRequiredDescription
addressBookIDsList of TextNoCount memberships only inside these address books.
scopeTextNo"global" (default), "local", or "both". "local" and "both" require includePrivate:true.
includePrivateBooleanNoOpt in to My Tags. Default: false.
offsetIntegerNoPagination offset.
limitIntegerNoMaximum items to return (1 to 500, default 50).

list smart filters​

Primary name: listSmartFilters · Synonym: list smart filters

Returns your saved Smart Filters (including remembersAddressBooks, requiresPrivate, and addressBookIDs when remembered) without activating them in the BusyContacts window.

ParameterTypeRequiredDescription
offsetIntegerNoPagination offset.
limitIntegerNoMaximum items to return (1 to 500, default 50).

list contacts​

Primary name: listContacts · Synonym: list contacts

Enumerates eligible contacts using structured filters without free-text search. Defaults to physical cards (view:"physical").

ParameterTypeRequiredDescription
viewTextNo"physical" (default) or "merged".
addressBookIDsList of TextNoRestrict to these address books.
smartFilterIDTextNoIntersect with a saved Smart Filter (bcs1.…).
tagsAny, tagsAll, tagsExactlyList of TextNoMatch contacts carrying any, all, or exactly these tag names.
tagScopeTextNo"global" (default), "local", or "both" (local/both require includePrivate:true).
company, email, phoneTextNoExact company, normalized email, or phone match.
phoneCountryTextNoISO region code for interpreting phone (for example "US" or "GB").
hasFields, lacksFieldsList of TextNoRequire presence or absence of field kinds (phone, email, url, address, date, related_name, social_profile, instant_message, custom).
birthdayStart, birthdayEndTextNoBoth required together: recurring Gregorian window (YYYY-MM-DD, end exclusive).
createdSince, modifiedSinceDate or TextNoInclusive lower bounds on timestamps (AppleScript date or zoned ISO 8601 text).
sortTextNo"display_name" (default), "first_name", "last_name", "company", "created_at", or "modified_at".
descendingBooleanNoReverse primary sort order (ID tie-break stays ascending).
includePrivateBooleanNoInclude My Notes and My Tags in matching and output. Default: false.
timeZoneTextNoIANA time zone for day-based filters (for example "UTC").
offset, limitIntegerNoPagination (offset 0 to 100000, limit 1 to 500, default 50).

search contacts​

Primary name: searchContacts · Synonym: search contacts

Searches eligible contacts by optional free text combined with any structured filters from list contacts using AND. Merges accessible linked cards by default.

ParameterTypeRequiredDescription
textTextNoNormalized free-text search terms (AND/prefix matching).
includeAllCardsBooleanNoReturn one physical record per matching card instead of merged linked sets. Default: false.
Structured filtersVariousNoSupports the same addressBookIDs, smartFilterID, tagsAny, tagsAll, tagsExactly, tagScope, company, email, phone, phoneCountry, hasFields, lacksFields, birthdayStart, birthdayEnd, createdSince, modifiedSince, sort, descending, includePrivate, timeZone, offset, and limit parameters as list contacts.

get contact​

Primary name: getContact · Synonym: get contact

Fetches the accessible merged contact anchored by a physical contactID (or "me" for your unambiguous Me card).

ParameterTypeRequiredDescription
contactIDTextYesPhysical card ID (bcc1.…) or "me".
includeAllCardsBooleanNoAlso return physicalCards listing every accessible physical card in the linked set. Default: false.
includePrivateBooleanNoInclude My Notes and My Tags. Default: false.

selected contacts​

Primary name: selectedContacts · Synonym: selected contacts

Reads the contacts currently selected in the main BusyContacts window without opening or activating a window.

ParameterTypeRequiredDescription
includeAllCardsBooleanNoExpand selection to physical card records. Default: false.
includePrivateBooleanNoInclude My Notes and My Tags. Default: false.
offset, limitIntegerNoPagination (limit up to 500).

list upcoming dates​

Primary name: listUpcomingDates · Synonym: list upcoming dates

Lists recurring birthdays, anniversaries, and custom dates (excluding death dates) occurring in a Gregorian day range.

ParameterTypeRequiredDescription
start, endTextNoGregorian YYYY-MM-DD window (start inclusive, end exclusive, 1 to 366 days; defaults to 30 days from today).
kindsList of TextNoAny subset of "birthday", "anniversary", and "other".
addressBookIDsList of TextNoRestrict to specific address books.
timeZoneTextNoIANA time zone for computing today and day boundaries.
offset, limitIntegerNoPagination (limit up to 500).

query activity​

Primary name: queryActivity · Synonym: query activity

Returns Apple Mail and BusyCal calendar activity metadata for a contact along with per-source availability (mailkit, spotlight, busycal). Message bodies are never returned and BusyCal is never launched automatically. Requires Share contact activity with automation in BusyContacts > Settings > Integrations.

ParameterTypeRequiredDescription
contactIDTextYesPhysical card ID (bcc1.…) anchoring the accessible linked contact.
kindsList of TextNo"mail", "calendar", or both.
start, endDate or TextNoRange bounds (end exclusive, up to 366 days). Accepts AppleScript date values or zoned ISO 8601 text.
limitIntegerNoMaximum merged activity items (1 to 500).

compare address books​

Primary name: compareAddressBooks · Synonym: compare address books

Returns physical cards in sourceAddressBookID that have no matching card in targetAddressBookID, without editing either address book.

ParameterTypeRequiredDescription
sourceAddressBookIDTextYesSource address book ID (bcb1.…).
targetAddressBookIDTextYesDistinct target address book ID (bcb1.…).
matchByTextNo"linked_or_email" (default) or "linked".
offset, limitIntegerNoPagination for unmatched source cards.

parse contact text​

Primary name: parseContactText · Synonym: parse contact text

Previews how BusyContacts' Quick Entry parser interprets free text (up to 64 KiB UTF-8) and reports any provider warnings without saving a contact.

ParameterTypeRequiredDescription
textTextYesNon-empty Quick Entry text (up to 64 KiB UTF-8).
addressBookIDTextNoOptional destination book ID used to evaluate provider label/slot warnings.

Creating and Editing​

create contact​

Primary name: createContact · Synonym: create contact

Creates one person or company card in an explicit writable address book. The contact record must supply at least a name, company, field, or photo (notes and tags alone are rejected).

ParameterTypeRequiredDescription
addressBookIDTextYesExplicit writable address book ID (bcb1.…).
contactRecordYesUser-labeled record supporting firstName, middleName, lastName, prefix, suffix, phoneticFirstName, phoneticMiddleName, phoneticLastName, maidenName, nickname, company, department, office, jobTitle, notes, privateNotes, birthday (record with year, month, and day), photoPath (absolute path starting with /), contactType ("person" or "company"), nameOrder ("default", "first_last", or "last_first"), tags, privateTags, and fields.

create contact from text​

Primary name: createContactFromText · Synonym: create contact from text

Parses Quick Entry text (up to 64 KiB UTF-8) and saves a new contact in an explicit address book, a unique book hint in the text (such as /Work), or your eligible default address book.

ParameterTypeRequiredDescription
textTextYesNon-empty Quick Entry text (up to 64 KiB UTF-8).
addressBookIDTextNoExplicit writable destination address book (always wins over text hints).

update contact​

Primary name: updateContact · Synonym: update contact

Patches scalar properties on one physical card. Omitted keys stay unchanged; missing value clears nullable scalars (and |photoPath|:missing value clears the current primary image).

ParameterTypeRequiredDescription
contactIDTextYesExact physical card ID (bcc1.…).
changesRecordYesNon-empty user-labeled record with scalar keys to update or clear.

update contacts​

Primary name: updateContacts · Synonym: update contacts

Patches 1 to 100 distinct physical cards in a single atomic batch. Any validation error rejects the whole batch with no changes saved.

ParameterTypeRequiredDescription
updatesList of RecordsYesList of 1 to 100 user-labeled records, each containing contactID ("bcc1.…") and changes (a scalar patch record). Duplicate card IDs are rejected.

add contact field​

Primary name: addContactField · Synonym: add contact field

Adds one typed field row to a physical card and returns the created field record (including its |id|, which starts with bcf1.).

ParameterTypeRequiredDescription
contactIDTextYesExact physical card ID (bcc1.…).
fieldRecordYesUser-labeled record with kind ("phone", "email", "url", "address", "date", "related_name", "social_profile", "instant_message", or "custom"), value (text or structured record), and optional label (required for "custom"), labelType, and preference (0 to 100).

update contact field​

Primary name: updateContactField · Synonym: update contact field

Patches one exact field row, preserving omitted structured components, kind, sort order, and row identity. Structured components (address, social_profile, instant_message) accept missing value to clear individual parts.

ParameterTypeRequiredDescription
contactIDTextYesPhysical parent card ID (bcc1.…).
fieldIDTextYesExact field row ID (bcf1.…).
changesRecordYesUser-labeled record with at least one of value, label, labelType, or preference.

remove contact field​

Primary name: removeContactField · Synonym: remove contact field

Removes one exact field row. Returns fieldNotFound if the row is missing or stale.

ParameterTypeRequiredDescription
contactIDTextYesPhysical parent card ID (bcc1.…).
fieldIDTextYesExact field row ID (bcf1.…).

append note​

Primary name: appendNote · Synonym: append note

Appends up to 1 MiB UTF-8 of plain text to a card's synced Notes or private My Notes.

ParameterTypeRequiredDescription
contactIDTextYesExact physical card ID (bcc1.…).
textTextYesNon-empty plain text to append (up to 1 MiB UTF-8).
datedBooleanNoPrepend a date header. Default: false.
privateBooleanNoAppend to private My Notes instead of synced Notes. Default: false.

add tags​

Primary name: addTags · Synonym: add tags

Adds case-sensitive tags to 1 to 100 physical cards.

ParameterTypeRequiredDescription
contactIDsList of TextYes1 to 100 physical card IDs.
tagsList of TextYesNon-empty tag names to add.
scopeTextNo"global" (default, synced Tags), "local" (private My Tags), or "best" (uses synced Tags on writable cards and My Tags on read-only cards).

remove tags​

Primary name: removeTags · Synonym: remove tags

Removes exact tags from 1 to 100 physical cards using the same scope options as add tags.

ParameterTypeRequiredDescription
contactIDsList of TextYes1 to 100 physical card IDs.
tagsList of TextYesExact tag names to remove.
scopeTextNo"global" (default), "local", or "best".

duplicate contact​

Primary name: duplicateContact · Synonym: duplicate contact

Duplicates one physical card into its current address book or another writable address book and returns the new card record.

ParameterTypeRequiredDescription
contactIDTextYesExact physical card ID (bcc1.…).
addressBookIDTextNoOptional destination writable address book (bcb1.…).

Organizing, Linking, and Deleting​

move contacts​

Primary name: moveContacts · Synonym: move contacts

Moves 1 to 100 physical cards to another writable address book and returns the destination cards along with idTransitions (oldID, newID, reason:"move").

ParameterTypeRequiredDescription
contactIDsList of TextYes1 to 100 physical card IDs.
addressBookIDTextYesWritable destination address book ID (bcb1.…).

Primary name: linkContacts · Synonym: link contacts

Links 2 to 100 distinct physical cards (and their eligible peers) without merging field values. Rejects the request if an existing linked peer is excluded.

ParameterTypeRequiredDescription
contactIDsList of TextYes2 to 100 distinct physical card IDs.

Primary name: unlinkContacts · Synonym: unlink contacts

Removes local link relationships for the supplied physical cards.

ParameterTypeRequiredDescription
contactIDsList of TextYesPhysical card IDs to unlink.
includeLinkedCardsBooleanNoDetach every member of each selected linked set. Default: false.

merge contacts​

Primary name: mergeContacts · Synonym: merge contacts

Merges the supplied physical cards and returns survivors, retainedCardIDs, relinkedCardIDs, deletedCardIDs, and idTransitions.

ParameterTypeRequiredDescription
contactIDsList of TextYesPhysical contributor card IDs.
includeLinkedCardsBooleanNoExpand contributors to include their accessible linked sets. Default: false.

delete contacts​

Primary name: deleteContacts · Synonym: delete contacts

Deletes 1 to 100 explicit physical cards and returns deletedCount and deletedCardIDs.

ParameterTypeRequiredDescription
contactIDsList of TextYes1 to 100 physical card IDs.
includeLinkedCardsBooleanNoAlso delete accessible linked peers of the supplied cards. Default: false.

Import, Export, and Photos​

export contacts​

Primary name: exportContacts · Synonym: export contacts

Exports up to 500 cards (and up to 4 MiB total) as vCard 3.0. Supply exactly one of contactIDs, addressBookID, or tag. Private notes and My Tags are always omitted.

ParameterTypeRequiredDescription
contactIDsList of TextConditional1 to 500 physical card IDs (mutually exclusive with addressBookID and tag).
addressBookIDTextConditionalExport all eligible cards in one address book.
tagTextConditionalExport eligible cards carrying one global tag.
mergeLinkedBooleanNoExport merged linked sets instead of separate physical cards. Default: false.
includeNotesBooleanNoInclude synced Notes. Default: true.
includePhotosBooleanNoInclude inline photos/logos within the 4 MiB vCard budget. Default: false.
outputFileTextNoLiteral absolute POSIX path starting with / (no ~ expansion). Omit to receive vCard text in the text field (|text|).
overwriteBooleanNoAllow replacing an existing outputFile. Default: false (returns fileExists if the file already exists).

import contacts​

Primary name: importContacts · Synonym: import contacts

Imports UTF-8 vCard data (up to 500 cards and 4 MiB, including affected cleanup cards) into an explicit writable address book and updates the local Last Import tag. Supply exactly one of vcardText or inputFile.

ParameterTypeRequiredDescription
addressBookIDTextYesExplicit writable destination address book ID (bcb1.…).
vcardTextTextConditionalInline UTF-8 vCard text.
inputFileTextConditionalLiteral absolute POSIX path starting with / to a .vcf file.

get contact photo​

Primary name: getContactPhoto · Synonym: get contact photo

Reads a contact's primary photo or company logo as lossless PNG (proportionally scaled to at most 4 MiB and 40 megapixels without altering stored attachments).

ParameterTypeRequiredDescription
contactIDTextYesPhysical card ID (bcc1.…).
outputFileTextNoLiteral absolute POSIX path starting with /. Omit to receive dataBase64 inline.
overwriteBooleanNoAllow replacing an existing outputFile. Default: false.

set contact photo​

Primary name: setContactPhoto · Synonym: set contact photo

Sets a contact's primary image from an absolute file path (scaled proportionally to PNG up to 4 MiB and 40 megapixels without modifying the source file), or clears the current primary image when given missing value.

ParameterTypeRequiredDescription
contactIDTextYesPhysical card ID (bcc1.…).
inputFileText or missing valueYesLiteral absolute POSIX path starting with /, or missing value to clear the primary photo/logo.

open contact​

Primary name: openContact · Synonym: open contact

Reveals a physical contact card in the main BusyContacts window or in a floating Info window. May open and activate BusyContacts.

ParameterTypeRequiredDescription
contactIDTextYesExact physical card ID (bcc1.…).
floatingBooleanNoOpen the card in a separate floating Info window. Default: false.

show smart filter​

Primary name: showSmartFilter · Synonym: show smart filter

Activates a saved Smart Filter in the main BusyContacts window. May open and activate BusyContacts.

ParameterTypeRequiredDescription
smartFilterIDTextYesSaved Smart Filter ID (bcs1.…).

Examples​

List writable address books and find a book ID​

tell application "BusyContacts"
set booksResult to list address books given writableOnly:true
set outputLines to {}
repeat with bookItem in (|items| of booksResult)
set end of outputLines to (|title| of bookItem) & " (" & (|id| of bookItem) & ")"
end repeat
return outputLines
end tell
tell application "BusyContacts"
set oneWeekAgo to (current date) - (7 * days)
set found to search contacts given tagsAll:{"Client"}, lacksFields:{"phone"}, modifiedSince:oneWeekAgo, limit:25
set names to {}
repeat with person in (|items| of found)
set end of names to |displayName| of person
end repeat
return names
end tell

Check upcoming birthdays and anniversaries​

tell application "BusyContacts"
set upcoming to list upcoming dates given start:"2026-12-01", end:"2027-01-01", kinds:{"birthday", "anniversary"}, timeZone:"UTC"
set summary to {}
repeat with entry in (|items| of upcoming)
set personName to |displayName| of (|contact| of entry)
set onDay to |occursOn| of entry
set end of summary to onDay & " - " & personName
end repeat
return summary
end tell

Preview Quick Entry text and create a contact​

tell application "BusyContacts"
set signatureText to "Grace Hopper, Rear Admiral, grace@example.com, +1 202-555-0199"
set preview to parse contact text given text:signatureText
-- Inspect preview before saving, then create in your default or explicit book:
set created to create contact from text given text:signatureText
return |id| of (|contact| of created)
end tell

Create a structured contact, edit fields, append a note, and tag​

tell application "BusyContacts"
-- Pick the first writable address book
set books to |items| of (list address books given writableOnly:true)
set bookID to |id| of item 1 of books

-- Create a contact with a yearless birthday
set created to create contact given addressBookID:bookID, contact:{|firstName|:"Ada", |lastName|:"Lovelace", |company|:"Analytical Engines", |jobTitle|:"Chief Engineer", |birthday|:{|year|:missing value, |month|:12, |day|:10}}
set cardID to |id| of (|contact| of created)

-- Add an email field and capture its field ID
set added to add contact field given contactID:cardID, field:{|kind|:"email", |label|:"work", |value|:"ada@example.com"}
set emailFieldID to |id| of (|field| of added)

-- Update that exact email field without changing its label or order
update contact field given contactID:cardID, fieldID:emailFieldID, changes:{|value|:"ada.lovelace@example.com"}

-- Clear a scalar property using missing value (omitted fields stay intact)
update contact given contactID:cardID, changes:{|jobTitle|:"Principal Engineer", |notes|:missing value}

-- Append a dated note and add a tag
append note given contactID:cardID, text:"Met at the engineering summit.", dated:true
add tags given contactIDs:{cardID}, tags:{"Conference"}

return cardID
end tell

Batch-update multiple contacts atomically​

tell application "BusyContacts"
set results to update contacts given updates:{{|contactID|:"bcc1.REPLACE_1", |changes|:{|company|:"Analytical Engines"}}, {|contactID|:"bcc1.REPLACE_2", |changes|:{|company|:"Analytical Engines", |department|:"Research"}}}
return |cardResults| of results
end tell

Export vCards to a file and set or clear a photo​

tell application "BusyContacts"
set selected to |items| of (selected contacts given includeAllCards:true)
if (count of selected) is 0 then return "No contacts selected."

set cardID to |id| of item 1 of selected
set exportPath to POSIX path of (path to desktop) & "contact-export.vcf"

export contacts given contactIDs:{cardID}, includeNotes:true, outputFile:exportPath, overwrite:true

-- Set a photo from an absolute path, or clear it with missing value:
-- set contact photo given contactID:cardID, inputFile:"/Users/yourname/Pictures/ada.png"
-- set contact photo given contactID:cardID, inputFile:missing value

return exportPath
end tell

Compare two address books and track moved card IDs​

tell application "BusyContacts"
set books to |items| of (list address books)
set sourceBookID to |id| of item 1 of books
set targetBookID to |id| of item 2 of books

set diffResult to compare address books given sourceAddressBookID:sourceBookID, targetAddressBookID:targetBookID, matchBy:"linked_or_email"
set unmatchedIDs to {}
repeat with card in (|items| of diffResult)
set end of unmatchedIDs to |id| of card
end repeat

-- Example: move the first unmatched card and read its new ID from idTransitions
if (count of unmatchedIDs) > 0 then
set moved to move contacts given contactIDs:{item 1 of unmatchedIDs}, addressBookID:targetBookID
return |idTransitions| of moved
end if
return {}
end tell

Review contact activity metadata and open a card​

tell application "BusyContacts"
set matches to |items| of (search contacts given text:"Ada Lovelace", limit:1)
if (count of matches) is 0 then return "Not found."

set cardID to |id| of item 1 of matches
set activity to query activity given contactID:cardID, kinds:{"mail", "calendar"}, limit:10
open contact given contactID:cardID, floating:true
return |items| of activity
end tell

Error Handling​

Every BusyContacts service error returns AppleScript error number -10000 with a message prefixed by its stable error code ("<code>: <message>"). macOS Apple Events permission errors (such as -1743 when Automation access is denied in System Settings) keep their system error numbers.

Common error codes include:

  • invalidArguments: Unknown record key, unpiped AppleScript property keyword, invalid date format, or out-of-range pagination/batch count.
  • notFound / staleIdentifier: The contact, address book, or Smart Filter ID no longer exists (refetch after moves, merges, or sync refreshes).
  • fieldNotFound: The exact fieldID was removed or rebuilt during a sync refresh; fetch the contact again with get contact.
  • readOnlyAddressBook / readOnlyContact: Attempted a global write on a read-only address book or card.
  • privateDataRequired: Requested local/private tags or a Smart Filter referencing private fields without includePrivate:true.
  • providerLimit: Violated an Exchange EWS or Microsoft Graph field/slot limit.
  • fileExists / fileAccessDenied: Destination file exists without overwrite:true, or the path is not an accessible literal absolute path.
  • photoNotFound / invalidImage: Contact has no primary image, or the supplied file is not a valid image.
  • payloadTooLarge: Request, vCard, note, Quick Entry text, or affected card count exceeded its limit.

Wrap commands in a try block to handle failures cleanly:

tell application "BusyContacts"
try
set resultRecord to list tags given scope:"local"
on error errMsg number errNum
if errNum is -10000 and errMsg starts with "privateDataRequired:" then
set resultRecord to list tags given scope:"local", includePrivate:true
else
error errMsg number errNum
end if
end try
end tell
  • Siri and Shortcuts: Build visual workflows in the Shortcuts app and run App Shortcuts with Siri.
  • AI & MCP Server: Connect Claude, Codex, ChatGPT, Gemini, or other MCP assistants to BusyContacts.
  • URL Handler: Open or create contacts via busycontacts:// links and launcher integrations like Alfred and LaunchBar.