im.locations sends Find My location-sharing requests and reads friend locations that are already visible to the current iMessage account.
Use request(chat, address) when you want to ask someone to share location. Use list(...), get(...), and watch(...) after location is already shared with the current account.
What You Can Do
Before You Use It
Request Location Sharing
Send a visible Find My request card in an existing direct or group chat:
The
address must belong to someone in chat. In a direct chat, that means the other participant. In a group chat, that means an existing group member.
Returns LocationRequestReceipt. A successful call means the request card was sent or the server accepted the request operation. It does not mean the other person is now sharing location.
The returned receipt includes:
When
messageGuid is present, use it like any other message GUID. For example, you can look it up with im.messages.get(...).
For idempotent retries from your job system, pass clientMessageId:
clientMessageId is only needed when your queue or worker may rerun the same logical request after a crash or timeout. Most direct calls can omit it. See error handling for details.get(...), list(...), or watch(...) to read their location.
List Shared Locations
list(...) takes no arguments.
Returns SharedFriendLocation[]. If no friends are sharing location, the array is empty. Each item is a location snapshot, and a snapshot is not guaranteed to include coordinates.
latitude and longitude are optional. They may be absent while a device is still locating, when location is unavailable, or when only address metadata is available.
Get One Friend Location
Phone numbers must include the country code, start with
+, and omit spaces, parentheses, and dashes.
Returns SharedFriendLocation. If the address is not sharing location or is not visible to the current account, get(...) throws NotFoundError.
The returned object looks like this:
Location Types
location.locationType describes how fresh the snapshot is:
locationType only describes freshness. It does not guarantee that coordinates are present.
Watch Live Updates
Scope
Watch every visible friend’s location updates:
Do not pass
chat.guid or a display name to watch(...).
Update Shape
Each update isSharedFriendLocationUpdated:
for await loop closes the live stream.