Prompt add-ons
If you have connected sharepa as a connector, your chat already knows these rules. If you upload the code by hand, add the matching block to your prompt.
Form#
For contact, sign-ups, surveys and booking requests. For real bookings, use the bookings block.
Technical requirements for the form (the page is hosted on sharepa):
- The form sends to the relative path /__sharepa/formular. Do not use any other service or address, and do not invent one.
- HTML: <form action="/__sharepa/formular" method="post">, with a real submit button (type="submit"). Normally no JavaScript that prevents the submit: the visitor then lands on a thank-you page.
- If the page should stay put on submit (newsletter field, waiting list): intercept the submit and send with fetch to the same path, with the header accept: application/json and the body new URLSearchParams(new FormData(form)). On r.ok replace the form with your own thank-you message, otherwise show an error message and enable the button again. Keep action and method on the form so that it also works without JavaScript.
- React: either a native form with exactly this action and method and WITHOUT preventDefault, or on submit fetch("/__sharepa/formular", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(data) }) with a flat object (only text, numbers, lists of text). If the response is ok, show your own thank-you message, otherwise an error message. Never keep entries only in component state.
- Every field has a name attribute in plain lowercase words (name, email, phone, message). The names become the column titles in my table.
- A multi-step form is ONE form whose steps are shown and hidden. It is submitted once, at the end, with all fields.
- Add a hidden field against bots: <input type="text" name="_honig" tabindex="-1" autocomplete="off" aria-hidden="true" style="position:absolute;left:-9999px">
- Optional: <input type="hidden" name="_formular" value="Sign-up"> names the form. <input type="hidden" name="_weiter" value="/thanks"> redirects to a path on the same page after submitting, instead of the default thank-you page.
- No fields for passwords, credit card or other payment data, and no health data. Such entries are rejected.
- No file uploads, they are discarded.
- The page must not send data to other servers: no form service, no external API, no fetch to another address. Such requests are blocked on sharepa.
- Below the form, add a short sentence that the details are only used for this purpose, with a link to my privacy policy. No mandatory checkbox.
- Real bookings, where visitors pick a free time from my calendar, do not go through this form but through window.sharepaTermine. Details: https://sharepa.ai/en/docs/bookingsWaitlist and newsletter#
For a single email field where the page stays put after sending.
Technical requirements for the sign-up field (the page is hosted on sharepa):
- The form has action="/__sharepa/formular" and method="post" and a real submit button (type="submit"). That way it also works without JavaScript.
- With JavaScript the page stays put: intercept the submit (preventDefault) and send with fetch(form.action, { method: "POST", headers: { accept: "application/json" }, body: new URLSearchParams(new FormData(form)) }). Do not use any other service or address.
- If the response is ok (r.ok), replace the form with a thank-you message (role="status"). Otherwise show a short error message (role="alert") and enable the button again.
- Disable the button while sending so that nobody submits twice.
- The field is called name="email" and has type="email" and required. The field names become the column titles in my table.
- Add a hidden field against bots: <input type="text" name="_honig" tabindex="-1" autocomplete="off" aria-hidden="true" style="position:absolute;left:-9999px">
- Optional: <input type="hidden" name="_formular" value="Waiting list"> names the form.
- Below the field, add a short sentence saying what I use the address for, with a link to my privacy policy. No mandatory checkbox.Bookings#
For pages where visitors book a free time from your calendar. Connect Google Calendar and create a booking type in the app first.
Technical requirements for bookings (the page is hosted on sharepa):
- sharepa adds a script to the published page that provides window.sharepaTermine. Do not include a script of your own for it, and do not use an external booking service, an iframe or a form posting to /__sharepa/formular. Details: https://sharepa.ai/en/docs/reference/bookings
- The script may load after your code. Before the first call, check whether window.sharepaTermine exists, otherwise wait for the event "sharepaTermine" on document.
- sharepaTermine.typen() returns { types: [{ id, name, description, duration, locations }], timezone }. locations contains "meet", "telefon" (phone), "vorort" (on site) or "link".
- sharepaTermine.zeiten(type, from, to) returns { slots: [...] } with free start times in UTC. from and to are dates in the format YYYY-MM-DD, at most 31 days apart.
- Always show times with Intl.DateTimeFormat in the visitor's time zone, never convert them yourself.
- sharepaTermine.buchen({ type, start, name, email, location, phone, answers }) books. start is exactly one value from slots. location must be in the type's locations. phone only with location "telefon". answers is a flat object with the page's own questions (field names in lower case, not starting with an underscore).
- When booking, a short security check by sharepa appears. Do not build anything for it.
- Errors have a field code: "termine.belegt" (time taken, reload the times), "termine.turnstile" (check failed, try again), "formular.heikel" (answers look like passwords or payment data). For all others, show a general error message.
- If window.sharepaTermine is still missing after 5 seconds, or typen() fails with "termine.aus", show “Bookings are not set up for this page yet.” instead of loading forever.
- No questions about passwords, credit card or other payment data, and no health data.
- After booking, show "Booked" and say that the confirmation comes by email.You will not see free times in the chat itself. The script is only added on the published page.
Last updated