Candidates message your bot with your booking code, see the interview times you have free, and book one themselves.

UsesGoogle CalendarTelegram

Let candidates book their own interview in Telegram

Whenever a candidate messages your Telegram bot with your booking code, they are shown the weekday interview times you actually have free, worked out from your Google Calendar. A reply giving the code, a date, a time, their name and their email books that slot, and the confirmation comes straight back in the chat.

You end up with a calendar event carrying the candidate's name in the title and their address as a guest, with an invitation on its way to them. Only the clock times you allow, on weekdays inside your booking window, can be booked, and a booking without a real name or a valid email address is refused. The slot is checked again at the moment of booking, so two candidates reading the same list cannot take the same time.

Every message that does not begin with your code is ignored in silence, so the bot can sit in a busy chat. Treat the code as a password and change it between roles.

TelegramTelegramWhen a new message is received. Save it as incomingMessage.When a new message is received. Save it as incomingMessage.
Set bookingCode to blank.Set bookingCode to blank.
Set interviewTimeZone to blank.Set interviewTimeZone to blank.
Set interviewTimes to “09:30, 11:00, 14:00, 15:30”.Set interviewTimes to “09:30, 11:00, 14:00, 15:30”.
Set interviewMinutes to 30.Set interviewMinutes to 30.
Set daysToLookAhead to 10.Set daysToLookAhead to 10.
Set slotsToOffer to 4.Set slotsToOffer to 4.
Set calendarId to “primary”.Set calendarId to “primary”.
Set interviewTitle to “Interview”.Set interviewTitle to “Interview”.
Trim bookingCode and save it as codeWord.Trim bookingCode and save it as codeWord.
Trim interviewTimeZone and save it as meetingTimeZone.Trim interviewTimeZone and save it as meetingTimeZone.
Trim calendarId and save it as calendar.Trim calendarId and save it as calendar.
Trim interviewTitle and save it as eventTitle.Trim interviewTitle and save it as eventTitle.
Trim incomingMessage.chat_id and save it as chatId.Trim incomingMessage.chat_id and save it as chatId.
If chatId is empty or chatId is “null”If chatId is empty or chatId is “null”
Yes
Stop and report a problem: This workflow runs when your Telegram bot is messaged, and this run carried no chat to reply to. Connect the bot and message it to try again.Stop and report a problem: This workflow runs when your Telegram bot is messaged, and this run carried no chat to reply to. Connect the bot and message it to try again.
No
No steps
Trim incomingMessage.text and save it as messageText.Trim incomingMessage.text and save it as messageText.
If messageText is “null”If messageText is “null”
Yes
Change messageText to blank.Change messageText to blank.
No
No steps
If messageText doesn't start with codeWord (ignoring case)If messageText doesn't start with codeWord (ignoring case)
Yes
Finish the run: The message did not start with the booking code, so it was left alone.Finish the run: The message did not start with the booking code, so it was left alone.
No
No steps
Set cleanTimes to an empty list.Set cleanTimes to an empty list.
Set allowedTimes to "Set allowedTimes to “ ”.
For each clockTime in interviewTimes split by “,”:For each clockTime in interviewTimes split by “,”:
Trim clockTime and save it as oneTime.Trim clockTime and save it as oneTime.
If oneTime is emptyIf oneTime is empty
Yes
Skip to the next item.Skip to the next item.
No
No steps
Add oneTime to the end of cleanTimes and save it as cleanTimes.Add oneTime to the end of cleanTimes and save it as cleanTimes.
Change allowedTimes to allowedTimes@oneTimeChange allowedTimes to allowedTimes@oneTime .
If cleanTimes is emptyIf cleanTimes is empty
Yes
Stop and report a problem: The 'interviewTimes' step has no times in it. List the clock times you are happy to interview at, separated by commas - for example 09:30, 11:00, 14:00 - then run it again.Stop and report a problem: The 'interviewTimes' step has no times in it. List the clock times you are happy to interview at, separated by commas - for example 09:30, 11:00, 14:00 - then run it again.
No
No steps
Set offeredTimesText to - cleanTimes joined by "Set offeredTimesText to - cleanTimes joined by “ - ”.
Set workingDays to an empty list.Set workingDays to an empty list.
Set dayOffset to 1.Set dayOffset to 1.
While dayOffset is less than or equal to daysToLookAhead multiplied by 1:While dayOffset is less than or equal to daysToLookAhead multiplied by 1:
Get the first item of today's date in meetingTimeZone shifted by dayOffset “days” split by “T” and save it as day.Get the first item of today's date in meetingTimeZone shifted by dayOffset “days” split by “T” and save it as day.
If not day is a weekendIf not day is a weekend
Yes
Add day to the end of workingDays and save it as workingDays.Add day to the end of workingDays and save it as workingDays.
No
No steps
Add 1 to dayOffset.Add 1 to dayOffset.
If workingDays is emptyIf workingDays is empty
Yes
Stop and report a problem: There are no weekdays inside the window set in the 'daysToLookAhead' step, so there is nothing to offer. Raise it to at least 3 and run it again.Stop and report a problem: There are no weekdays inside the window set in the 'daysToLookAhead' step, so there is nothing to offer. Raise it to at least 3 and run it again.
No
No steps
Split messageText by “|” and save it as parts.Split messageText by “|” and save it as parts.
If the length of parts is greater than or equal to 5If the length of parts is greater than or equal to 5
Yes
Trim parts[1] and save it as wantDate.Trim parts[1] and save it as wantDate.
Trim parts[2] and save it as wantTime.Trim parts[2] and save it as wantTime.
Trim parts[3] and save it as candidateName.Trim parts[3] and save it as candidateName.
Trim the last item of parts and save it as candidateEmail.Trim the last item of parts and save it as candidateEmail.
If candidateName is empty or candidateName is “null”If candidateName is empty or candidateName is “null”
Yes
TelegramTelegramSend a message to chat chatId.Send a message to chat chatId.I need your name too. Reply in this shape: codeWord | date | time | your name | your email
Finish the run: The booking message carried no name, so nothing was booked.Finish the run: The booking message carried no name, so nothing was booked.
No
No steps
If not candidateEmail is a valid email addressIf not candidateEmail is a valid email address
Yes
TelegramTelegramSend a message to chat chatId.Send a message to chat chatId.That does not look like an email address, so I have not booked anything. Reply in this shape: codeWord | date | time | your name | your email
Finish the run: The booking message carried no usable email address, so nothing was booked.Finish the run: The booking message carried no usable email address, so nothing was booked.
No
No steps
If workingDays doesn't contain wantDateIf workingDays doesn't contain wantDate
Yes
TelegramTelegramSend a message to chat chatId.Send a message to chat chatId.I can only book weekdays inside the booking window, and that date is outside it. Send the code on its own to see what is free. The first day I can book is the first item of workingDays.
Finish the run: The date asked for is outside the booking window, so nothing was booked.Finish the run: The date asked for is outside the booking window, so nothing was booked.
No
No steps
If allowedTimes doesn't contain wantTimeIf allowedTimes doesn't contain wantTime
Yes
TelegramTelegramSend a message to chat chatId.Send a message to chat chatId.That is not one of the interview times on offer. The times I can book are: offeredTimesText
Finish the run: The time asked for is not one of the interview times, so nothing was booked.Finish the run: The time asked for is not one of the interview times, so nothing was booked.
No
No steps
Set startsAt to “@wantDateT@wantTime”.Set startsAt to “@wantDateT@wantTime”.
Get the first item of startsAt shifted by interviewMinutes multiplied by 1 “minutes” split by “.” and save it as endsAt.Get the first item of startsAt shifted by interviewMinutes multiplied by 1 “minutes” split by “.” and save it as endsAt.
Google CalendarGoogle CalendarCheck if the calendar is free from startsAt to endsAt. Save it as availability.Check if the calendar is free from startsAt to endsAt. Save it as availability.
If availability.isAvailable isn't yesIf availability.isAvailable isn't yes
Yes
TelegramTelegramSend a message to chat chatId.Send a message to chat chatId.That time has just been taken, so I have not booked it. Send the code on its own and I will show you what is still free.
Finish the run: The time asked for was no longer free, so nothing was booked.Finish the run: The time asked for was no longer free, so nothing was booked.
No
No steps
Google CalendarGoogle CalendarCreate the event '@eventTitle - candidateName' from startsAt to endsAt. Save it as booking.Create the event '@eventTitle - candidateName' from startsAt to endsAt. Save it as booking. Calendar: calendar Time zone: meetingTimeZoneBooked from Telegram. Name given: candidateName Email given: candidateEmail
Set confirmation to “Booked. ”.Set confirmation to “Booked. ”.
Change confirmation to “@confirmationthe weekday name of wantDate wantDate at wantTime”.Change confirmation to “@confirmationthe weekday name of wantDate wantDate at wantTime”.
Change confirmation to “@confirmation (meetingTimeZone), interviewMinutes multiplied by 1 as text minutes. The invitation is on its way to candidateEmail.”.Change confirmation to “@confirmation (meetingTimeZone), interviewMinutes multiplied by 1 as text minutes. The invitation is on its way to candidateEmail.”.
TelegramTelegramSend a message to chat chatId.Send a message to chat chatId.confirmation
Show in the output: Interview booked for candidateName starting startsAt, calendar event booking.event_id.Show in the output: Interview booked for candidateName starting startsAt, calendar event booking.event_id.
No
Set openSlots to an empty list.Set openSlots to an empty list.
Set slotCount to 0.Set slotCount to 0.
For each day in workingDays:For each day in workingDays:
If slotCount is greater than or equal to slotsToOffer multiplied by 1 If slotCount is greater than or equal to slotsToOffer multiplied by 1
Yes
Stop repeating.Stop repeating.
No
No steps
For each slotTime in cleanTimes: For each slotTime in cleanTimes:
If slotCount is greater than or equal to slotsToOffer multiplied by 1 If slotCount is greater than or equal to slotsToOffer multiplied by 1
Yes
Stop repeating.Stop repeating.
No
No steps
Set slotStart to “@dayT@slotTime”. Set slotStart to “@dayT@slotTime”.
Get the first item of slotStart shifted by interviewMinutes multiplied by 1 “minutes” split by “.” and save it as slotEnd. Get the first item of slotStart shifted by interviewMinutes multiplied by 1 “minutes” split by “.” and save it as slotEnd.
If a step below fails, save the error as slotError If a step below fails, save the error as slotError
Try
Google CalendarGoogle CalendarCheck if the calendar is free from slotStart to slotEnd. Save it as slotCheck.Check if the calendar is free from slotStart to slotEnd. Save it as slotCheck.
If slotCheck.isAvailable is yesIf slotCheck.isAvailable is yes
Yes
Add - the weekday name of day day at slotTime to the end of openSlots and save it as openSlots.Add - the weekday name of day day at slotTime to the end of openSlots and save it as openSlots.
Add 1 to slotCount.Add 1 to slotCount.
No
No steps
On error
Show in the output: Could not check slotStart: slotError as text.Show in the output: Could not check slotStart: slotError as text.
If slotCount is 0If slotCount is 0
Yes
TelegramTelegramSend a message to chat chatId.Send a message to chat chatId.Thanks for getting in touch. Nothing is free in the booking window at the moment - reply here and we will find a time by hand.
Finish the run: No free interview times to offer, so the chat was told so.Finish the run: No free interview times to offer, so the chat was told so.
No
No steps
Set offerText to:Set offerText to:Here are the interview times that are free:
Change offerText to offerText plus openSlots joined by a new line.Change offerText to offerText plus openSlots joined by a new line.
Change offerText to offerTextChange offerText to offerText To book one, reply in exactly this shape: codeWord | date | time | your name | your email For example: .
Change offerText to “@offerText@codeWord | the first item of workingDays | the first item of cleanTimes | Alex Green | alex@example.com”.Change offerText to “@offerText@codeWord | the first item of workingDays | the first item of cleanTimes | Alex Green | alex@example.com”.
TelegramTelegramSend a message to chat chatId.Send a message to chat chatId.offerText
Finish the run: Open interview times were sent to the chat.Finish the run: Open interview times were sent to the chat.