client.Bookings
Every method in this namespace: its signature, its parameters, what it returns and an example.
Methods
Public links where somebody books a meeting on a person's calendar: create a booking page, change its hours, questions and rules, pause or delete it, read the times it offers, list the meetings guests booked, and approve, decline or cancel one. An API key acts for the workspace owner, and an app for the person who connected it.
Bookings.ListPagesBookings.GetPageBookings.CreatePageBookings.UpdatePageBookings.UploadBackgroundBookings.RemoveBackgroundBookings.DeletePageBookings.ListTimesBookings.ListBookings.ListAllBookings.IterateBookings.GetBookings.ApproveBookings.DeclineBookings.CancelBookings.ResendEmailBookings.AnalyticsBookings.Reschedule
Bookings.ListPages
List the booking pages of the person
ListPages(ctx context.Context, opts ...nextmail.RequestOption) ([]nextmail.Object, error)Returns the booking pages of the person, oldest first unless nextmail.WithSort says otherwise. nextmail.WithQ searches the name and the link, nextmail.WithStatus keeps the active or the paused pages, and nextmail.WithSince and nextmail.WithUntil keep the pages made in a window. A booking page is a public link, /book/<slug>, where somebody picks a free time and books a meeting on the calendar of that person. Each page comes with its settings in config, the link to hand to guests in url, and in counts how many of its bookings are upcoming and how many wait for approval.
status is active while the page takes bookings and paused while its link works but offers no times. problem says what stops a page from taking bookings and is null when nothing does. away lists the out of office periods that close the page. A person holds at most 25 pages, so the list comes whole and is never paged.
Parameters
nextmail.WithQstringOnly the pages whose name or link contains this text, at most 200 characters. Case and accents are ignored.
nextmail.WithStatus...stringactivefor the pages that take bookings,pausedfor the ones that do not, one ofconstants.BookingPageStatusesValues. Left out, both.nextmail.WithSincetime.TimeOnly the pages made at or after this instant, as a
time.Time.nextmail.WithUntiltime.TimeOnly the pages made before this instant, later than
nextmail.WithSince.nextmail.WithSortstringoldest(the default) ornewestby when the page was made,namefrom A to Z, orupcomingwith the most upcoming meetings first, one ofconstants.BookingPageSortsValues.nextmail.WithAPIKeystringOverrides the client API key for this call only.
Returns
A []nextmail.Object. Each item has id, slug, name, status, url, problem, config, counts, away, createdAt and updatedAt.
Example
pages, err := client.Bookings.ListPages(ctx)if err != nil { return err} for _, page := range pages { counts := page.Object("counts") fmt.Println(page.String("name"), page.String("url"), page.String("status"), counts.Int("upcoming"), counts.Int("pending"))}Notes
A booking page belongs to one person. An API key acts as the workspace owner and reaches the pages of the owner, and a connected app reaches the pages of the person who connected it.
problemissenderwhenconfig.fromEmailcan no longer send,hourswhen no hours are open at all, andhostwhen the person left the workspace.A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.An
nextmail.WithUntilthat is not later thannextmail.WithSinceis 422invalid_parameter.
Also available in
Bookings.GetPage
Read one booking page by id
GetPage(ctx context.Context, id string, opts ...nextmail.RequestOption) (nextmail.Object, error)Looks up a single booking page and returns it in the same shape as a row of ListPages, with every setting in config: the meeting lengths, where the meeting happens, the weekly hours and the dates with their own hours, the notice, the buffers and the daily limit, whether a booking waits for approval, the address its emails come from, the questions a guest is asked, how the page looks and what a guest may change afterwards.
config.availability.weekly holds seven lists, Sunday first, of the hours open on that weekday, each as minutes after midnight in config.availability.timezone. problem says what stops the page from taking bookings, and away lists the out of office periods of config.fromEmail that are running or still to come. While config.busy.outOfOffice is true the page offers no times inside them.
Parameters
idstringRequiredBooking page id such as
bkp_5c1e9a7b3d2f48e6a0b4c7d1, asListPagesreturns it.nextmail.WithAPIKeystringOverrides the client API key for this call only.
Returns
An nextmail.Object with id, slug, name, status, url, problem, config, counts, away, createdAt and updatedAt.
Example
page, err := client.Bookings.GetPage(ctx, "bkp_5c1e9a7b3d2f48e6a0b4c7d1")if err != nil { return err} config := page.Object("config") fmt.Println(page.String("url"), config["durations"], config.Object("availability").String("timezone"), page.String("problem"))Notes
A missing page fails with an
*nextmail.Errorthat matchesnextmail.ErrNotFoundand codebooking_page_not_found. A page that belongs to somebody else in the workspace is missing too.A booking page belongs to one person. An API key acts as the workspace owner and reaches the pages of the owner, and a connected app reaches the pages of the person who connected it.
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.
Also available in
Bookings.CreatePage
Create a booking page
CreatePage(ctx context.Context, body nextmail.Body, opts ...nextmail.RequestOption) (nextmail.Object, error)Creates a booking page and returns it as it is stored. The page takes bookings at once, at the link in url. Only name is required: the page starts with weekdays from 09:00 to 17:00, 30 minute meetings, four hours of notice, times up to 60 days ahead and the first address the person may send from. Anything in config replaces that default, and what it leaves out keeps it.
slug is the last part of the public link, /book/<slug>. Left out, it is made from the name. timezone says which time zone the working hours are read in when config.availability.timezone is not sent.
The times a page offers are its working hours with everything taken out that makes the person busy: their calendar events, invitations they have not declined, calendars they subscribed to, bookings they already have, the gaps the page keeps around meetings, and the days they are out of office. A booking is a calendar event organised by config.fromEmail, and the guest is told by email from that address, so the call needs emails:send beside calendar:write.
Parameters
namestringRequiredWhat the page is called, shown to guests as its heading, such as
Intro call. Trimmed, 1 to 80 characters.slugstringThe last part of the public link: 3 to 60 lowercase letters and digits, with single hyphens between words. It is unique across Nextmail. Left out, it is made from the name.
timezonestringThe IANA time zone the working hours are read in, such as
Europe/Berlin, whenconfig.availability.timezoneis not sent. Defaults toUTC.config.descriptionstringText shown under the name of the page, up to 2,000 characters. Basic Markdown works: bold, italic, links and lists. Defaults to none.
config.hostNamestringThe name guests see as the person they meet, up to 80 characters. Defaults to the name of the account.
config.durations[]intThe meeting lengths a guest can pick, in minutes: 1 to 4 of them, each a multiple of 5 between 5 and 720. Defaults to one length of 30 minutes.
config.location.kindstringWhere the meeting happens:
videowith a fixed link invalue,phone, where the guest is asked for a number,in-personwith the address invalue, ornone. Defaults tonone.config.location.valuestringThe
https://link of avideomeeting or the address of anin-personone, up to 500 characters. It is dropped forphoneandnone.config.availability.timezonestringThe IANA time zone the hours of the page are read in. Defaults to
timezone.config.availability.weekly[][]nextmail.BodySeven lists, Sunday first, of the hours open on that weekday. Each range is a map with
startandendin minutes after midnight, so a map withstartset to540andendset to1020is 09:00 to 17:00. An empty list closes the day, and a day takes at most 6 ranges. Defaults to 09:00 to 17:00 from Monday to Friday.config.availability.overrides[]nextmail.BodyDates with their own hours, at most 180, each a map with
dateandranges.dateisYYYY-MM-DDin the time zone of the page, and an emptyrangescloses that date. Defaults to none.config.rules.noticeMinutesintHow many minutes ahead a booking has to be made, from 0 to 43,200. Defaults to 240.
config.rules.horizonDaysintHow many days ahead the page offers times, from 1 to 365. Defaults to 60.
config.rules.intervalMinutesint | nilMinutes between two start times: 5, 10, 15, 20, 30, 45, 60, 90 or 120. Null, the default, steps by the length of the meeting.
config.rules.bufferBeforeMinutesintMinutes kept free before every meeting, from 0 to 240. Defaults to 0.
config.rules.bufferAfterMinutesintMinutes kept free after every meeting, from 0 to 240. Defaults to 0.
config.rules.dailyLimitint | nilThe most bookings the page takes on one day, from 1 to 50. Null, the default, sets no limit.
config.approvalboolTrue holds each new booking as a request until
ApproveorDeclineanswers it. False, the default, confirms it at once.config.fromEmailstringThe address the booking emails are sent from and the calendar events are organised by. It has to be one the owner of the page may send from. Defaults to the first such address.
config.notifyHostboolWhether
fromEmailgets an email about each new, moved or cancelled booking. Defaults to true.config.questions[]nextmail.BodyWhat the guest is asked besides their name and email, at most 10, each a map with
id,kind,label,required,optionsandplaceholder.idis a stable key for the answers: 4 to 16 lowercase letters and digits, unique on the page.kindistext,long-text,phone,choiceorcheckbox.optionsholds the answers of achoicequestion, from 2 to 12, and is empty for the other kinds.placeholderis optional example text shown in the empty field of atext,long-textorphonequestion, up to 160 characters. Defaults to none.config.confirmationstringText shown to the guest after booking and added to the confirmation email, up to 1,000 characters. Defaults to none.
config.redirectUrlstringAn
https://page to send the guest to after booking, or an empty string for none, which is the default.config.appearance.accentstringThe colour of buttons and the picked day, as
#rrggbb. Defaults to#18181b.config.appearance.themestringautofollows the device of the guest, andlightordarkforces one. Defaults toauto.config.appearance.showAvatarboolWhether the page shows the photo of the person, or their initials when they have none. Defaults to true.
config.appearance.backgroundstringWhat fills the page behind the card:
default, one of the presetsdusk,mist,sand,night,meadow,dots,brush,trail,ember,canvas,bloom,field,wandererandgold, or a colour as#rrggbb. Defaults todefault.imageshows the photo ofUploadBackground, so a new page cannot start with it.config.appearance.fonts.primarystring | nilThe font of the text: one of the ids in
constants.BrandFontIDsValues, such asinterorgeorgia, or null for the default. Defaults to null.config.appearance.fonts.secondarystring | nilThe font of the title, such as
instrument-serif, or null to keep the title in the font of the text. Defaults to null.config.guestChanges.cancelboolWhether a guest may cancel from the link in their emails. Defaults to true.
config.guestChanges.rescheduleboolWhether a guest may move the meeting from the link in their emails. Defaults to true.
config.guestChanges.cutoffMinutesintHow many minutes before the meeting those changes close, from 0 to 20,160. Defaults to 0.
config.busy.addresses[]string | nilThe addresses whose invitations block time unless declined, at most 50. Null, the default, checks every address the person holds.
config.busy.subscriptionsboolWhether events from calendars the person subscribed to block time. Defaults to true.
config.busy.outOfOfficeboolWhether the page offers no times while
fromEmailis out of office. Defaults to true.config.seo.titlestringThe title of the browser tab and of a search result, up to 120 characters. Empty, the default, uses the name of the page and the host.
config.seo.descriptionstringThe summary under the title in a search result, up to 300 characters. Empty, the default, uses the start of the description.
config.seo.indexableboolWhether search engines may list the page. Defaults to false, which asks them not to.
config.extraGuestsintHow many other people a guest may add to a booking, 0 to 10. Each one gets the invitation and every later change. Defaults to 0, which hides the field.
config.reminders.guest[]intWhen the guest gets a reminder email, in minutes before the meeting, up to three of 10, 30, 60, 120, 1440, 2880 and 10080. Defaults to one day before, and an empty list sends none.
config.reminders.host[]intThe reminders each booked meeting carries on your own calendar, in minutes before it, up to three of 0, 5, 10, 15, 30, 60 and 1440. Defaults to 10.
nextmail.WithAPIKeystringOverrides the client API key for this call only.
Returns
An nextmail.Object with the new id, status active, the slug and url of its link, and config with every default filled in.
Example
page, err := client.Bookings.CreatePage(ctx, nextmail.Body{ "name": "Intro call", "timezone": "Europe/Berlin", "config": nextmail.Body{ "description": "A first conversation about your project.", "durations": []int{30, 60}, "location": nextmail.Body{"kind": "video", "value": "https://meet.example.com/ada"}, "rules": nextmail.Body{"bufferAfterMinutes": 15}, "approval": true, },})if err != nil { return err} fmt.Println(page.String("id"), page.String("url"), page.Object("config").String("fromEmail"))Notes
A booking page belongs to one person. An API key acts as the workspace owner and makes a page of the owner, and a connected app makes a page of the person who connected it.
A person holds at most 25 pages. One more is a 403
booking_page_limit_reached.A
sluganother page already uses is a 409booking_link_taken. A slug that is not a valid link, afromEmailthe person may not send from, avideolocation without a link, anin-personone without an address and two questions with the sameidare 422invalid_booking_page, with the reason in the message. A few slugs such asmanageandadminare reserved.A value of the wrong type or length, a range that ends before it starts and a time zone in
config.availabilitythat is not known are 422invalid_parameterwithparamnaming the field. A key besidename,slug,timezoneandconfigis 422unknown_parameter.A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.Not retried automatically. A slug made from the name gets a few random characters when the plain one is taken, so a retry after a lost response can leave two pages. List them and delete the spare.
Also available in
Bookings.UpdatePage
Change the name, the link, the status or any setting of a booking page
UpdatePage(ctx context.Context, id string, patch nextmail.Body, opts ...nextmail.RequestOption) (nextmail.Object, error)Changes a booking page and returns it as it is stored. Send only what changes: a field left out stays as it is, and a patch with nothing in it is a 422.
config is merged, not replaced. A top-level value such as approval or fromEmail replaces the stored one. Inside location, availability, rules, appearance, guestChanges, busy and seo each field is merged on its own, so a rules map that holds only dailyLimit leaves the notice and the buffers alone. A list is replaced whole: send every entry of durations, questions, availability.weekly or availability.overrides again, not only the ones that change.
Set status to paused to stop offering times without losing the link, and to active to offer them again. Bookings already made keep their time whatever changes. A new slug moves the page to a new link and the old one stops working, so links already handed out break.
Parameters
idstringRequiredBooking page id such as
bkp_5c1e9a7b3d2f48e6a0b4c7d1, asListPagesreturns it.namestringNew name, shown to guests as the heading of the page. Trimmed, 1 to 80 characters. Left out, the name stays.
slugstringNew last part of the public link: 3 to 60 lowercase letters and digits, with single hyphens between words. It is unique across Nextmail. Left out, the link stays.
statusstringactivetakes bookings.pausedkeeps the link working but offers no times. Left out, it stays.config.descriptionstringText shown under the name of the page, up to 2,000 characters. Basic Markdown works: bold, italic, links and lists. An empty string clears it.
config.hostNamestringThe name guests see as the person they meet, up to 80 characters.
config.durations[]intThe meeting lengths a guest can pick, in minutes, replacing the list the page had: 1 to 4 of them, each a multiple of 5 between 5 and 720.
config.location.kindstringWhere the meeting happens:
videowith a fixed link invalue,phone, where the guest is asked for a number,in-personwith the address invalue, ornone.config.location.valuestringThe
https://link of avideomeeting or the address of anin-personone, up to 500 characters. It is dropped forphoneandnone.config.availability.timezonestringThe IANA time zone the hours of the page are read in, such as
Europe/Berlin.config.availability.weekly[][]nextmail.BodyAll seven lists again, Sunday first, of the hours open on that weekday. Each range is a map with
startandendin minutes after midnight, so a map withstartset to540andendset to1020is 09:00 to 17:00. An empty list closes the day, and a day takes at most 6 ranges.config.availability.overrides[]nextmail.BodyEvery date with its own hours again, at most 180, each a map with
dateandranges.dateisYYYY-MM-DDin the time zone of the page, and an emptyrangescloses that date. An empty slice removes them all.config.rules.noticeMinutesintHow many minutes ahead a booking has to be made, from 0 to 43,200.
config.rules.horizonDaysintHow many days ahead the page offers times, from 1 to 365.
config.rules.intervalMinutesint | nilMinutes between two start times: 5, 10, 15, 20, 30, 45, 60, 90 or 120. Null steps by the length of the meeting.
config.rules.bufferBeforeMinutesintMinutes kept free before every meeting, from 0 to 240.
config.rules.bufferAfterMinutesintMinutes kept free after every meeting, from 0 to 240.
config.rules.dailyLimitint | nilThe most bookings the page takes on one day, from 1 to 50. Null sets no limit.
config.approvalboolTrue holds each new booking as a request until
ApproveorDeclineanswers it. False confirms it at once. Requests already waiting keep waiting.config.fromEmailstringThe address the booking emails are sent from and the calendar events are organised by. It has to be one the owner of the page may send from.
config.notifyHostboolWhether
fromEmailgets an email about each new, moved or cancelled booking.config.questions[]nextmail.BodyEvery question again, at most 10, each a map with
id,kind,label,required,optionsandplaceholder.idis a stable key for the answers: 4 to 16 lowercase letters and digits, unique on the page.kindistext,long-text,phone,choiceorcheckbox.optionsholds the answers of achoicequestion, from 2 to 12, and is empty for the other kinds.placeholderis optional example text shown in the empty field of atext,long-textorphonequestion, up to 160 characters. An empty slice asks nothing more.config.confirmationstringText shown to the guest after booking and added to the confirmation email, up to 1,000 characters. An empty string clears it.
config.redirectUrlstringAn
https://page to send the guest to after booking, or an empty string for none.config.appearance.accentstringThe colour of buttons and the picked day, as
#rrggbb.config.appearance.themestringautofollows the device of the guest, andlightordarkforces one.config.appearance.showAvatarboolWhether the page shows the photo of the person, or their initials when they have none.
config.appearance.backgroundstringWhat fills the page behind the card:
default, one of the presetsdusk,mist,sand,night,meadow,dots,brush,trail,ember,canvas,bloom,field,wandererandgold, a colour as#rrggbb, orimagefor the photo uploaded withUploadBackground.imagewithout an uploaded photo is a 422invalid_booking_page.config.appearance.fonts.primarystring | nilThe font of the text: one of the ids in
constants.BrandFontIDsValues, such asinterorgeorgia, or null for the default. Left out, it keeps its value.config.appearance.fonts.secondarystring | nilThe font of the title, such as
instrument-serif, or null to keep the title in the font of the text. Left out, it keeps its value.config.guestChanges.cancelboolWhether a guest may cancel from the link in their emails.
config.guestChanges.rescheduleboolWhether a guest may move the meeting from the link in their emails.
config.guestChanges.cutoffMinutesintHow many minutes before the meeting those changes close, from 0 to 20,160.
config.busy.addresses[]string | nilThe addresses whose invitations block time unless declined, at most 50. Null checks every address the person holds.
config.busy.subscriptionsboolWhether events from calendars the person subscribed to block time.
config.busy.outOfOfficeboolWhether the page offers no times while
fromEmailis out of office.config.seo.titlestringThe title of the browser tab and of a search result, up to 120 characters. An empty string goes back to the name of the page and the host.
config.seo.descriptionstringThe summary under the title in a search result, up to 300 characters. An empty string goes back to the start of the description.
config.seo.indexableboolWhether search engines may list the page.
config.extraGuestsintHow many other people a guest may add to a booking, 0 to 10. Each one gets the invitation and every later change. 0 hides the field.
config.reminders.guest[]intWhen the guest gets a reminder email, in minutes before the meeting, up to three of 10, 30, 60, 120, 1440, 2880 and 10080. An empty list sends none.
config.reminders.host[]intThe reminders each new booking carries on your own calendar, in minutes before it, up to three of 0, 5, 10, 15, 30, 60 and 1440.
nextmail.WithAPIKeystringOverrides the client API key for this call only.
Returns
An nextmail.Object with the unchanged id, and everything else as it is now.
Example
page, err := client.Bookings.UpdatePage(ctx, "bkp_5c1e9a7b3d2f48e6a0b4c7d1", nextmail.Body{ "config": nextmail.Body{ "durations": []int{45}, "rules": nextmail.Body{"bufferAfterMinutes": 15, "dailyLimit": 4}, },})if err != nil { return err} config := page.Object("config") fmt.Println(config["durations"], config.Object("rules"))Notes
A missing page is a 404
booking_page_not_found, and so is a page that belongs to somebody else in the workspace.A
sluganother page already uses is a 409booking_link_taken. A slug that is not a valid link, afromEmailthe person may not send from, avideolocation without a link, anin-personone without an address and two questions with the sameidare 422invalid_booking_page, with the reason in the message.An empty patch, a value of the wrong type or length, a range that ends before it starts and a time zone that is not known are 422
invalid_parameter. A key besidename,slug,statusandconfigis 422unknown_parameter.A booking page belongs to one person. An API key acts as the workspace owner and reaches the pages of the owner, and a connected app reaches the pages of the person who connected it.
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.The SDK retries this call after a network failure, since the same patch sent twice leaves the same page.
Also available in
Bookings.UploadBackground
Upload the background photo of a booking page
UploadBackground(ctx context.Context, id string, data io.Reader, opts ...nextmail.RequestOption) (nextmail.Object, error)Sends the image bytes as the request body, replacing the photo there was, and returns the page. The photo fills the public page behind the card: config.appearance.background becomes image and config.appearance.backgroundImage holds the address of the stored photo.
Up to 5 MB goes in, and it is fitted into 2560 by 1600 pixels and stored as WebP. It takes PNG, JPEG, WebP or GIF, and an animated image keeps its first frame. The type is read from nextmail.WithContentType, and without it the server refuses the bytes with 422 invalid_image.
To go back to a preset or a colour and keep the photo for later, set config.appearance.background with UpdatePage. RemoveBackground deletes the photo.
Parameters
idstringRequiredBooking page id such as
bkp_5c1e9a7b3d2f48e6a0b4c7d1, asListPagesreturns it.dataio.ReaderRequiredThe image, as an
io.Reader.nextmail.WithContentTypestringimage/png,image/jpeg,image/webporimage/gif. The server needs it to accept the image.nextmail.WithAPIKeystringOverrides the client API key for this call only.
Returns
An nextmail.Object showing the new photo in config.appearance.backgroundImage.
Example
source, err := os.Open("photo.jpg")if err != nil { return err} defer source.Close() page, err := client.Bookings.UploadBackground(ctx, "bkp_5c1e9a7b3d2f48e6a0b4c7d1", source, nextmail.WithContentType("image/jpeg"))if err != nil { return err} appearance := page.Object("config").Object("appearance") fmt.Println(appearance.String("background"), appearance.String("backgroundImage"))Notes
An SVG, an image over 5 MB or one that cannot be read is refused with 422
invalid_image.A missing page is a 404
booking_page_not_found, and so is a page that belongs to somebody else in the workspace.A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.A busy image service answers 503
image_busyand a failed save 502image_not_stored, which the SDK retries like any other retryable status, since the same image sent twice leaves the same page.
Also available in
Bookings.RemoveBackground
Remove the background photo of a booking page
RemoveBackground(ctx context.Context, id string, opts ...nextmail.RequestOption) (nextmail.Object, error)Deletes the stored background photo of a booking page and returns the page. A page that showed the photo goes back to the default background, and one that showed a preset or a colour keeps it. Removing a photo that is not set changes nothing.
Parameters
idstringRequiredBooking page id such as
bkp_5c1e9a7b3d2f48e6a0b4c7d1, asListPagesreturns it.nextmail.WithAPIKeystringOverrides the client API key for this call only.
Returns
An nextmail.Object with config.appearance.backgroundImage null.
Example
page, err := client.Bookings.RemoveBackground(ctx, "bkp_5c1e9a7b3d2f48e6a0b4c7d1")if err != nil { return err} appearance := page.Object("config").Object("appearance") fmt.Println(appearance.String("background"), appearance.String("backgroundImage"))Notes
A missing page is a 404
booking_page_not_found, and so is a page that belongs to somebody else in the workspace.A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.Retried automatically on network failure and retryable statuses, since a second attempt after one that went through finds nothing to remove.
Also available in
Bookings.DeletePage
Delete a booking page
DeletePage(ctx context.Context, id string, opts ...nextmail.RequestOption) (nextmail.Object, error)Deletes a booking page for good. Its public link stops working and the list of its bookings goes with it, so List no longer shows them and guests can no longer move or cancel through the links in their emails. The meetings already booked stay on the calendar, where Calendar.CancelEvent can still call one off.
There is no undo. To stop offering times and keep the page, its link and its bookings, use UpdatePage with status paused.
Parameters
idstringRequiredBooking page id such as
bkp_5c1e9a7b3d2f48e6a0b4c7d1, asListPagesreturns it.nextmail.WithAPIKeystringOverrides the client API key for this call only.
Returns
An nextmail.Object with object set to booking_page, id and deleted set to true.
Example
removed, err := client.Bookings.DeletePage(ctx, "bkp_5c1e9a7b3d2f48e6a0b4c7d1")if err != nil { return err} fmt.Println(removed.String("id"), removed.Bool("deleted"))Notes
It sends no email, so it needs
calendar:writealone. Guests are not told that the page is gone.The SDK does not retry a delete. A 404
booking_page_not_foundon your own second attempt after a lost response means the first one worked.A booking page belongs to one person. An API key acts as the workspace owner and reaches the pages of the owner, and a connected app reaches the pages of the person who connected it.
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.
Also available in
Bookings.ListTimes
List the times a booking page offers
ListTimes(ctx context.Context, id string, opts ...nextmail.RequestOption) (nextmail.Object, error)Returns the start times a guest could book on a page inside a window, in order. They are the hours of the page with everything taken out that makes the person busy: their calendar events, invitations they have not declined, calendars they subscribed to, bookings they already have, the gaps the page keeps around meetings, its daily limit, its notice and the out of office periods that close it.
The window starts at nextmail.WithFrom, or now, and ends at nextmail.WithTo, or 14 days later. It covers at most 62 days, and a later end is cut back to that. nextmail.WithDurationMinutes picks which meeting length the times are for and has to be one of the durations of the page. Left out, the shortest is used. Both bounds are a time.Time, sent as an ISO 8601 instant.
With nextmail.WithBookingID the times are the ones that booking can move to with Reschedule: its own time counts as free, and they are for its length.
A paused page still answers, so the times can be checked before it is turned on. A page with a problem offers nothing.
Parameters
idstringRequiredBooking page id such as
bkp_5c1e9a7b3d2f48e6a0b4c7d1, asListPagesreturns it.nextmail.WithFromtime.TimeThe start of the window. Defaults to now.
nextmail.WithTotime.TimeThe end of the window, later than its start. Defaults to 14 days after the start, and counts for at most 62 days after it.
nextmail.WithDurationMinutesintThe meeting length in minutes, one of the
durationsof the page. Defaults to the shortest.nextmail.WithBookingIDstringA booking on this page to find a new time for, such as
bkg_2b8d4f6a1c3e5079b6d8f0a2. Its own time counts as free and the times are for its length, sonextmail.WithDurationMinutesis ignored.nextmail.WithAPIKeystringOverrides the client API key for this call only.
Returns
An nextmail.Object with pageId, the timezone of the page, the durationMinutes the times are for, and times, every open start time in the window as an ISO 8601 instant in UTC.
Example
from := time.Now() open, err := client.Bookings.ListTimes( ctx, "bkp_5c1e9a7b3d2f48e6a0b4c7d1", nextmail.WithFrom(from), nextmail.WithTo(from.AddDate(0, 0, 7)), nextmail.WithDurationMinutes(30),)if err != nil { return err} for _, start := range open.Strings("times") { fmt.Println(start)}Notes
An
nextmail.WithTothat is not later thannextmail.WithFromand annextmail.WithDurationMinutesthe page does not offer are 422invalid_parameter. A missing page is a 404booking_page_not_found, and annextmail.WithBookingIDthat is not a booking of this page a 404booking_not_found.The times are instants, so show them to a person in a time zone:
timezonenames the one the hours of the page are read in.It reads the calendar as it is now and holds nothing. A time it lists can be gone a moment later, when a guest books it.
A booking page belongs to one person. An API key acts as the workspace owner and reaches the pages of the owner, and a connected app reaches the pages of the person who connected it.
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.
Also available in
Bookings.List
List the meetings guests booked, a page at a time
List(ctx context.Context, opts ...nextmail.RequestOption) (*nextmail.Page, error)Returns one page of bookings: the meetings guests booked on the booking pages of the person, or on some of them with nextmail.WithPageIDs. nextmail.WithQ searches the guest and the page, and nextmail.WithFrom and nextmail.WithTo keep the meetings that start in a window. ListAll collects every page and Iterate walks them lazily. A booking is a calendar event with the guest invited, so it shows wherever the calendar does, and a meeting moved or cancelled in the calendar reads as moved or cancelled here.
nextmail.WithView picks which bookings are listed. upcoming, the default, holds the confirmed meetings that are not over. pending holds the requests that wait for Approve or Decline, on a page whose config.approval is true. past holds the meetings that are over and the requests nobody answered in time, and ended holds the ones that were declined or cancelled. upcoming and pending come soonest first, past and ended latest first.
Each booking names its page in pageId and pageName, the guest in guest, what they answered in answers and its calendar event in eventId.
Parameters
nextmail.WithViewstringWhich bookings to list:
upcoming,pending,pastorended. Defaults toupcoming.nextmail.WithPageIDstringOnly the bookings of this booking page, by its id. Left out, the bookings of every page of the person are listed.
nextmail.WithPageIDs...stringOnly the bookings of these booking pages, at most 25 ids. Left out, every page of the person.
nextmail.WithQstringOnly the bookings whose guest name, guest email or page name contains this text, at most 200 characters. Case and accents are ignored.
nextmail.WithFromtime.TimeOnly the meetings that start at or after this instant, as a
time.Time.nextmail.WithTotime.TimeOnly the meetings that start before this instant, later than
nextmail.WithFrom.nextmail.WithLimitintPage size, from 1 to 100. The server defaults to 30.
nextmail.WithCursorstringThe
NextCursorof the previous page, passed back as it came. Leave it out for the first page.nextmail.WithAPIKeystringOverrides the client API key for this call only.
Returns
A *nextmail.Page with Items, HasMore and NextCursor. Each item has id, pageId, pageName, status, expired, past, start, end, durationMinutes, guest, answers, location, eventId, endedBy, endReason, rescheduleCount, guestMailFailed and createdAt.
Example
page, err := client.Bookings.List(ctx, nextmail.WithView("pending"))if err != nil { return err} for _, booking := range page.Items { fmt.Println(booking.String("id"), booking.String("pageName"), booking.Object("guest").String("name"), booking.String("start"))} fmt.Println(page.HasMore, page.NextCursor)Notes
statusispendingwhile a booking waits for approval,confirmedonce the meeting stands,declinedwhen a request was turned down andcancelledwhen a confirmed meeting was called off.expiredis true for a request nobody answered before its time came, andpastonce the meeting is over.An
nextmail.WithPageIDor one ofnextmail.WithPageIDsthat is not a page of the person answers 404booking_page_not_found, more than 25 page ids or annextmail.WithTothat is not later thannextmail.WithFrom422invalid_parameter, and a cursor this list did not hand out 400invalid_cursor.A search with
nextmail.WithQreads up to 1000 of the newest matching bookings of the view, so narrow an old view withnextmail.WithFromandnextmail.WithToto search all of it.The cursor marks how far into the view the last page reached. A booking that enters or leaves the view between two pages shifts the rows after it, so read the view again when an exact list matters.
An API key acts as the workspace owner and reads the bookings of the owner, and a connected app reads the bookings of the person who connected it. One guest address holds at most 3 upcoming bookings on a page.
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.
Also available in
- API
GET /bookings- TypeScript
nextmail.bookings.list()- Python
bookings.list()- Ruby
bookings.list- PHP
bookings->list- Java
bookings().list- C#
Bookings.ListAsync- CLI
openemail bookings list
Bookings.ListAll
Collect every booking of a view into one slice
ListAll(ctx context.Context, opts ...nextmail.RequestOption) ([]nextmail.Object, error)Walks every page of List and returns with all bookings of one view, in the order of that view: upcoming and pending soonest first, past and ended latest first. One request per page. Give nextmail.WithPageIDs, nextmail.WithQ, nextmail.WithFrom or nextmail.WithTo to collect only the bookings that match.
Parameters
nextmail.WithViewstringWhich bookings to collect:
upcoming,pending,pastorended. Defaults toupcoming.nextmail.WithPageIDstringOnly the bookings of this booking page, by its id. Left out, the bookings of every page of the person are collected.
nextmail.WithPageIDs...stringOnly the bookings of these booking pages, at most 25 ids. Left out, every page of the person.
nextmail.WithQstringOnly the bookings whose guest name, guest email or page name contains this text, at most 200 characters. Case and accents are ignored.
nextmail.WithFromtime.TimeOnly the meetings that start at or after this instant, as a
time.Time.nextmail.WithTotime.TimeOnly the meetings that start before this instant, later than
nextmail.WithFrom.nextmail.WithLimitintPage size for each request, from 1 to 100. The server defaults to 30.
nextmail.WithCursorstringStarts the walk after this cursor instead of the first page.
nextmail.WithAPIKeystringOverrides the client API key for every page of this walk.
Returns
A []nextmail.Object holding every booking of the view.
Example
bookings, err := client.Bookings.ListAll(ctx, nextmail.WithView("upcoming"), nextmail.WithLimit(100))if err != nil { return err} for _, booking := range bookings { if booking.Bool("guestMailFailed") { fmt.Println(booking.String("id"), booking.Object("guest").String("email"), booking.String("start")) }}Notes
If any page fails the call fails and the bookings already fetched are discarded.
The
pastandendedviews grow without end, so preferIteratethere and stop when you have read far enough back.A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.
Also available in
Bookings.Iterate
Stream the bookings of a view one at a time
Iterate(ctx context.Context, opts ...nextmail.RequestOption) *nextmail.IteratorReturns an iterator that yields the bookings of one view individually, in the order of that view, and requests the next page only once the current one is drained. Nothing is fetched until you consume it, and breaking out of the loop stops the requests.
Parameters
nextmail.WithViewstringWhich bookings to walk:
upcoming,pending,pastorended. Defaults toupcoming.nextmail.WithPageIDstringOnly the bookings of this booking page, by its id. Left out, the bookings of every page of the person are walked.
nextmail.WithPageIDs...stringOnly the bookings of these booking pages, at most 25 ids. Left out, every page of the person.
nextmail.WithQstringOnly the bookings whose guest name, guest email or page name contains this text, at most 200 characters. Case and accents are ignored.
nextmail.WithFromtime.TimeOnly the meetings that start at or after this instant, as a
time.Time.nextmail.WithTotime.TimeOnly the meetings that start before this instant, later than
nextmail.WithFrom.nextmail.WithLimitintPage size for each request, from 1 to 100. The server defaults to 30.
nextmail.WithCursorstringStarts the walk after this cursor instead of the first page.
nextmail.WithAPIKeystringOverrides the client API key for every page of this walk.
Returns
An *nextmail.Iterator yielding one booking per step.
Example
for booking, err := range client.Bookings.Iterate(ctx, nextmail.WithView("ended")).All() { if err != nil { return err } fmt.Println(booking.String("start"), booking.String("pageName"), booking.String("endedBy"), booking.String("endReason"))}Notes
The iterator is lazy, so an abandoned loop costs only the pages you consumed.
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.
Also available in
Bookings.Get
Read one booking by id
Get(ctx context.Context, id string, opts ...nextmail.RequestOption) (nextmail.Object, error)Looks up a single booking and returns it in the same shape as a row of List: the booking page it was made on, the guest with the time zone they booked in, what they answered to the questions of the page, where the meeting happens as the guest was told, the calendar event it is and how it ended if it did.
A booking follows its calendar event. Reading one first catches up with the calendar, so a meeting that was moved there shows its new start and end, and one that was cancelled or deleted there reads cancelled, or declined when it still waited for approval. endedBy says whether the host or the guest declined or cancelled it, and endReason holds the reason they gave. guestMailFailed is true when the last email to the guest could not be sent, and ResendEmail tries again.
Parameters
idstringRequiredBooking id such as
bkg_2b8d4f6a1c3e5079b6d8f0a2, asListreturns it.nextmail.WithAPIKeystringOverrides the client API key for this call only.
Returns
An nextmail.Object with id, pageId, pageName, status, expired, past, start, end, durationMinutes, guest, answers, location, eventId, endedBy, endReason, rescheduleCount, guestMailFailed and createdAt.
Example
booking, err := client.Bookings.Get(ctx, "bkg_2b8d4f6a1c3e5079b6d8f0a2")if err != nil { return err} guest := booking.Object("guest") fmt.Println(booking.String("status"), booking.String("start"), guest.String("name"), guest.String("email")) for _, answer := range booking.Objects("answers") { fmt.Println(answer.String("label"), answer.String("value"))}Notes
A missing booking fails with an
*nextmail.Errorthat matchesnextmail.ErrNotFoundand codebooking_not_found. A booking on a page that belongs to somebody else in the workspace is missing too.eventIdis the idCalendar.GetEventreads. It is null once the booking ended and its event was removed.Each answer carries the
id,labelandkindof its question as it was asked, and itsvalueas text. Acheckboxanswersyesorno.An API key acts as the workspace owner and reads the bookings of the owner, and a connected app reads the bookings of the person who connected it.
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.
Also available in
- API
GET /bookings/{id}- TypeScript
nextmail.bookings.get()- Python
bookings.get()- Ruby
bookings.get- PHP
bookings->get- Java
bookings().get- C#
Bookings.GetAsync- CLI
openemail bookings get
Bookings.Approve
Confirm a booking that waits for approval
Approve(ctx context.Context, id string, opts ...nextmail.RequestOption) (nextmail.Object, error)Confirms a booking that waits for approval, on a booking page whose config.approval is true. The hold on the calendar becomes a confirmed meeting, and the guest is told by email, sent from the address of the page with the calendar invitation attached. It takes no body.
The email goes out as config.fromEmail, so the call needs emails:send beside calendar:write. List with nextmail.WithView("pending") reads the bookings that wait.
Parameters
idstringRequiredBooking id such as
bkg_2b8d4f6a1c3e5079b6d8f0a2, asListreturns it.nextmail.WithAPIKeystringOverrides the client API key for this call only.
Returns
An nextmail.Object with status confirmed, and guestMailFailed saying whether the email to the guest went out.
Example
booking, err := client.Bookings.Approve(ctx, "bkg_2b8d4f6a1c3e5079b6d8f0a2")if err != nil { return err} fmt.Println(booking.String("status"), booking.String("start"), booking.Bool("guestMailFailed"))Notes
A booking that is not waiting for approval answers 409
booking_not_pending, and one whose time has passed 409booking_ended. A missing one is a 404booking_not_found.The booking is confirmed even when the email cannot be sent.
guestMailFailedis then true, andResendEmailsends it again.An API key acts as the workspace owner and reaches the bookings of the owner, and a connected app reaches the bookings of the person who connected it.
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.The SDK does not retry it, because a retry could email the guest twice. A 409
booking_not_pendingon your own second attempt after a lost response means the first one worked or the guest withdrew, andGetsays which.
Also available in
Bookings.Decline
Turn down a booking that waits for approval
Decline(ctx context.Context, id string, body nextmail.Body, opts ...nextmail.RequestOption) (nextmail.Object, error)Turns down a booking that waits for approval and frees its time, so the page offers that time again. The guest is told by email, sent from the address of the page, with reason in it when one is given. Pass nil as the body to decline without a reason.
The email goes out as config.fromEmail, so the call needs emails:send beside calendar:write.
Parameters
idstringRequiredBooking id such as
bkg_2b8d4f6a1c3e5079b6d8f0a2, asListreturns it.reasonstring | nilA sentence for the guest, trimmed, at most 500 characters, included in the email they get. Left out or null, the email gives no reason.
nextmail.WithAPIKeystringOverrides the client API key for this call only.
Returns
An nextmail.Object with status declined, endedBy host and endReason holding the reason, or null.
Example
booking, err := client.Bookings.Decline(ctx, "bkg_2b8d4f6a1c3e5079b6d8f0a2", nextmail.Body{ "reason": "I am away that week. Please pick a time after the 20th.",})if err != nil { return err} fmt.Println(booking.String("status"), booking.String("endReason"))Notes
A booking that is not waiting for approval answers 409
booking_not_pending. To call off a confirmed meeting, useCancel. A missing booking is a 404booking_not_found.A
reasonover 500 characters is 422invalid_parameter, and a key the body does not take is 422unknown_parameter.The booking is declined even when the email cannot be sent.
guestMailFailedis then true, andResendEmailsends it again.An API key acts as the workspace owner and reaches the bookings of the owner, and a connected app reaches the bookings of the person who connected it.
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.The SDK does not retry it, because a retry could email the guest twice. A 409
booking_not_pendingon your own second attempt after a lost response means the first one worked or somebody else answered, andGetsays which.
Also available in
Bookings.Cancel
Cancel a booked meeting
Cancel(ctx context.Context, id string, body nextmail.Body, opts ...nextmail.RequestOption) (nextmail.Object, error)Cancels a meeting that has not ended yet and cancels its calendar event. The guest is told by email, sent from the address of the page with the cancellation attached, and with reason in it when one is given. Pass nil as the body to cancel without a reason.
A booking that still waits for approval is declined instead, so it ends as declined, not cancelled. The email goes out as config.fromEmail, so the call needs emails:send beside calendar:write.
Parameters
idstringRequiredBooking id such as
bkg_2b8d4f6a1c3e5079b6d8f0a2, asListreturns it.reasonstring | nilA sentence for the guest, trimmed, at most 500 characters, included in the email they get. Left out or null, the email gives no reason.
nextmail.WithAPIKeystringOverrides the client API key for this call only.
Returns
An nextmail.Object with status cancelled, or declined when it still waited for approval, endedBy host and endReason holding the reason, or null.
Example
booking, err := client.Bookings.Cancel(ctx, "bkg_2b8d4f6a1c3e5079b6d8f0a2", nextmail.Body{ "reason": "Something urgent came up. Please book another time.",})if err != nil { return err} fmt.Println(booking.String("status"), booking.String("endedBy"), booking.String("endReason"))Notes
A booking that was already declined or cancelled, or whose meeting is over, answers 409
booking_ended. A missing one is a 404booking_not_found.There is no undo. The time is free again and the guest has to book once more.
A
reasonover 500 characters is 422invalid_parameter, and a key the body does not take is 422unknown_parameter.The booking is cancelled even when the email cannot be sent.
guestMailFailedis then true, andResendEmailsends it again.An API key acts as the workspace owner and reaches the bookings of the owner, and a connected app reaches the bookings of the person who connected it.
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.The SDK does not retry it, because a retry could email the guest twice. A 409
booking_endedon your own second attempt after a lost response means the first one worked or the guest cancelled, andGetsays which.
Also available in
Bookings.ResendEmail
Send the guest the email about their booking again
ResendEmail(ctx context.Context, id string, opts ...nextmail.RequestOption) (nextmail.Object, error)Sends the guest the email that matches where the booking stands now: the request while it waits for approval, the confirmation with its invitation once it is confirmed, or the notice that it was declined or cancelled, with the reason that was given. Use it when guestMailFailed is true. It takes no body and changes nothing else about the booking.
Parameters
idstringRequiredBooking id such as
bkg_2b8d4f6a1c3e5079b6d8f0a2, asListreturns it.nextmail.WithAPIKeystringOverrides the client API key for this call only.
Returns
An nextmail.Object with guestMailFailed as it is after the send: false when the email went out, true when it failed again.
Example
booking, err := client.Bookings.ResendEmail(ctx, "bkg_2b8d4f6a1c3e5079b6d8f0a2")if err != nil { return err} if booking.Bool("guestMailFailed") { fmt.Println("Still not sent to", booking.Object("guest").String("email"))}Notes
A missing booking is a 404
booking_not_found.It answers 200 whether or not the email went out, so read
guestMailFailedto know.An API key acts as the workspace owner and reaches the bookings of the owner, and a connected app reaches the bookings of the person who connected it.
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.Not retried automatically: every call sends another email, so a retry after a lost response can reach the guest twice.
Also available in
Bookings.Analytics
Read how the booking pages did over a window
Analytics(ctx context.Context, opts ...nextmail.RequestOption) (nextmail.Object, error)Returns the numbers behind the Analytics tab of Booking in one request: the bookings guests made over a window, what became of them, the pages and weekdays they went to, and the meetings still to come right now.
A booking counts in the window it was made in, whatever its meeting time. totals.booked is every booking made in the window, and confirmed, pending, expired, declined and cancelled split it by what became of each one, so they add up to booked. cancelledByGuest and cancelledByHost split cancelled, rescheduled counts the meetings moved at least once, and minutesBooked adds up the length of the confirmed meetings.
upcoming ignores the window: it counts the confirmed meetings that have not ended and the requests still waiting, and gives the start of the next meeting. series is sparse and oldest first, so a chart must fill the gaps. grain sets the bucket width and the key shape, YYYY-MM-DD, YYYY-MM-DDTHH or YYYY-MM-DDTHH:MM, and offsetMinutes shifts the boundaries and the weekdays so days break where the reader's day does. nextmail.WithPageIDs narrows everything to some pages, such as one page for its own Analytics tab.
Parameters
nextmail.WithPageIDs...stringCount only these booking pages, at most 25, such as
bkp_5c1e9a7b3d2f48e6a0b4c7d1. Every page of the person when left out.nextmail.WithDaysintHow far back to look, from 1 to 1095, defaulting to 30.
nextmail.WithMinutesintThe window in minutes, from 1 to 1576800, which wins over
dayswhen both are sent.nextmail.WithGrainstringBucket width:
minute,hourorday, defaulting today.nextmail.WithOffsetMinutesintMinutes east of UTC to cut the buckets and the weekdays in, from -840 to 840, defaulting to 0. For the local zone, pass the offset
time.Now().Zone()reports, divided by 60.nextmail.WithAPIKeystringOverrides the client's API key for this call only.
Returns
An nextmail.Object with object set to booking_analytics, pageId, pageIds, since, until, grain, offsetMinutes, totals, upcoming, series, pages and weekdays. totals has booked, confirmed, pending, expired, declined, cancelled, cancelledByGuest, cancelledByHost, rescheduled, minutesBooked and cancellationRate, upcoming is a map with confirmed, waiting and nextStart, each entry of series is a map with bucket, booked and cancelled, each entry of pages is a map with pageId, name, booked and cancelled, and weekdays holds seven maps with weekday and meetings, from Sunday (0) to Saturday (6).
Example
_, offset := time.Now().Zone() analytics, err := client.Bookings.Analytics(ctx, nextmail.WithDays(90), nextmail.WithOffsetMinutes(offset/60))if err != nil { return err} totals := analytics.Object("totals") fmt.Println(totals.Int("booked"), totals.Float("cancellationRate"), analytics.Object("upcoming").String("nextStart"))Notes
totals.cancellationRateiscancelleddivided bybooked, at most 1, and null when nothing was booked in the window.pageIdsechoes the pages counted and is empty for every page.pageIdis that page when exactly one is counted, and null otherwise. A page that is not one of the person is a 404booking_page_not_found.pageslists at most 10 pages, the ones with the most bookings first. A key limited to particular addresses is refused withcapability_unsupported, because a booking page reads the whole calendar.Read only, so the SDK retries it after a network failure like any other read.
Also available in
Bookings.Reschedule
Move a booked meeting to a new time
Reschedule(ctx context.Context, id string, body nextmail.Body, opts ...nextmail.RequestOption) (nextmail.Object, error)Moves a meeting that has not started to a new time and moves its calendar event with it. The meeting keeps its length, so only start is sent. The time has to be one the page offers for this booking: ListTimes with nextmail.WithBookingID lists them, counting the current time of the booking as free. The page may be paused, and the cut-off that limits guests does not apply to the host.
The guest is told by email, sent from the address of the page with the updated invitation attached and with reason in it when one is given, and so is everyone the guest added. The host gets a copy at the same address unless config.notifyHost is false. A booking that waited for approval is confirmed at the new time, because the host chose it. The email goes out as config.fromEmail, so the call needs emails:send beside calendar:write.
Parameters
idstringRequiredBooking id such as
bkg_2b8d4f6a1c3e5079b6d8f0a2, asListreturns it.starttime.Time | stringRequiredThe new start, as a
time.Timeor an ISO 8601 string. It has to be one of the timesListTimesreturns for the page withnextmail.WithBookingIDset to this booking.reasonstring | nilA sentence for the guest, trimmed, at most 500 characters, included in the email about the new time. Left out or null, the email gives no reason.
nextmail.WithAPIKeystringOverrides the client API key for this call only.
Returns
An nextmail.Object, the booking at its new time: start and end moved, status confirmed and rescheduleCount one higher. guestMailFailed is true when the email to the guest could not be sent.
Example
booking, err := client.Bookings.Get(ctx, "bkg_2b8d4f6a1c3e5079b6d8f0a2")if err != nil { return err} open, err := client.Bookings.ListTimes(ctx, booking.String("pageId"), nextmail.WithBookingID(booking.ID()))if err != nil { return err} times := open.Strings("times") if len(times) == 0 { fmt.Println("No free time to move the meeting to") return nil} moved, err := client.Bookings.Reschedule(ctx, booking.ID(), nextmail.Body{ "start": times[0], "reason": "Something came up, so I moved us to the next free time.",})if err != nil { return err} fmt.Println(moved.String("start"), moved.Int("rescheduleCount"))Notes
A time the page does not offer for this booking answers 409
booking_time_unavailable: it is taken, outside the hours, inside the notice or past how far ahead the page books. ReadListTimesagain and pick another.A booking that was declined or cancelled, or whose meeting has started, answers 409
booking_ended. A missing one is a 404booking_not_found.Sending the time the meeting already has changes nothing and sends no email.
The booking moves even when the email cannot be sent.
guestMailFailedis then true, andResendEmailsends it again.An API key acts as the workspace owner and reaches the bookings of the owner, and a connected app reaches the bookings of the person who connected it.
A key or an app limited to particular addresses or domains is refused with 422
capability_unsupported, because a booking page reads the whole calendar of its person.The SDK does not retry it, because a retry could email the guest twice. Read the booking with
Getafter a lost response to see where it landed.