mail_extract_bookings
Extract exact bookings and appointments from an email's structured data before booking. Get ready-to-use calendar event arguments from schema.org or .ics files.
Instructions
Extract exact bookings and appointments from one email's structured data (schema.org booking markup, .ics attachments), each with calendar_create_event arguments.
Use when: before booking anything from a confirmation or invitation email. Not for booking it (review, then use calendar_create_event) or for answering an invitation (use calendar_respond_to_event). Parameters:
folder is where the message lives: an alias (INBOX, Sent, Archive and so on; case-insensitive) or a name copied exactly from mail_list_folders.
uid is an integer valid only in that folder, from mail_search_messages, mail_get_thread, mail_list_changes or mail_list_senders (latest_uid).
uidvalidity comes from the same result as the uid. Passed, a renumbered folder is refused instead of reading the wrong message, and a message a recent search already saw is fetched without its large non-calendar attachments (PDFs, images). Omitted, the check is skipped and the whole message is fetched. Behavior:
read-only; nothing is guessed from the wording.
Values are copied from schema.org data (flight, hotel, train, bus, rental car, restaurant, event, boat, taxi) and every event in a calendar or .ics part. Items without a start are dropped.
A cancelled booking has kind 'cancellation' and no calendar_event: cancel the existing event instead.
Confirm with the owner before booking. Returns: {folder, uid, subject, from, items, found, note}.
Up to 20 items (found counts all), each with kind, source, details and calendar_event {summary, start, end, location, description, request_id}.
Keep request_id when booking, so a repeat never books twice.
Empty items means no structured data: read it with mail_get_message and book only what it states plainly. Errors: 'No message with uid' or 'uids are out of date' (search again), 'Could not open the folder' (check mail_list_folders).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uid | Yes | Message uid in that folder (from mail_search_messages). | |
| folder | Yes | Mail folder, e.g. INBOX, Sent, Archive or a custom name. | |
| uidvalidity | No | The 'uidvalidity' from the result the uid came from: a renumbered folder is then refused, not misread. |