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

TelegramTelegramWhen a new message is received. Save it as incomingMessage.When a new message is received. Save it as incomingMessage.
ValuesSet bookingCode to blank.Set bookingCode to blank.
ValuesSet interviewTimeZone to blank.Set interviewTimeZone to blank.
ValuesSet interviewTimes to 09:30, 11:00, 14:00, 15:30.Set interviewTimes to 09:30, 11:00, 14:00, 15:30.
ValuesSet interviewMinutes to 30.Set interviewMinutes to 30.
ValuesSet daysToLookAhead to 10.Set daysToLookAhead to 10.
ValuesSet slotsToOffer to 4.Set slotsToOffer to 4.
ValuesSet calendarId to primary.Set calendarId to primary.
ValuesSet interviewTitle to Interview.Set interviewTitle to Interview.
TextTrim bookingCode and save it as codeWord.Trim bookingCode and save it as codeWord.
TextTrim interviewTimeZone and save it as meetingTimeZone.Trim interviewTimeZone and save it as meetingTimeZone.
TextTrim calendarId and save it as calendar.Trim calendarId and save it as calendar.
TextTrim interviewTitle and save it as eventTitle.Trim interviewTitle and save it as eventTitle.
TextTrim incomingMessage.chat_id and save it as chatId.Trim incomingMessage.chat_id and save it as chatId.
Decisions & LoopsIf chatId is empty or chatId is nullIf chatId is empty or chatId is null
Yes
Decisions & LoopsStop 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
TextTrim incomingMessage.text and save it as messageText.Trim incomingMessage.text and save it as messageText.
Decisions & LoopsIf messageText is nullIf messageText is null
Yes
ValuesChange messageText to blank.Change messageText to blank.
No
No steps
Decisions & LoopsIf messageText doesn't start with codeWord (ignoring case)If messageText doesn't start with codeWord (ignoring case)
Yes
Decisions & LoopsFinish 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
ValuesSet cleanTimes to an empty list.Set cleanTimes to an empty list.
ValuesSet allowedTimes to "Set allowedTimes to .
Decisions & LoopsFor each clockTime in interviewTimes split by ,:For each clockTime in interviewTimes split by ,:
TextTrim clockTime and save it as oneTime.Trim clockTime and save it as oneTime.
Decisions & LoopsIf oneTime is emptyIf oneTime is empty
Yes
Decisions & LoopsSkip to the next item.Skip to the next item.
No
No steps
ListsAdd oneTime to the end of cleanTimes and save it as cleanTimes.Add oneTime to the end of cleanTimes and save it as cleanTimes.
ValuesChange allowedTimes to allowedTimes@oneTimeChange allowedTimes to allowedTimes@oneTime .
Decisions & LoopsIf cleanTimes is emptyIf cleanTimes is empty
Yes
Decisions & LoopsStop 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
ValuesSet offeredTimesText to - cleanTimes joined by "Set offeredTimesText to - cleanTimes joined by - .
ValuesSet workingDays to an empty list.Set workingDays to an empty list.
ValuesSet dayOffset to 1.Set dayOffset to 1.
Decisions & LoopsWhile dayOffset is less than or equal to daysToLookAhead multiplied by 1:While dayOffset is less than or equal to daysToLookAhead multiplied by 1:
ListsGet 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.
Decisions & LoopsIf not day is a weekendIf not day is a weekend
Yes
ListsAdd 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
ValuesAdd 1 to dayOffset.Add 1 to dayOffset.
Decisions & LoopsIf workingDays is emptyIf workingDays is empty
Yes
Decisions & LoopsStop 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
TextSplit messageText by | and save it as parts.Split messageText by | and save it as parts.
Decisions & LoopsIf the length of parts is greater than or equal to 5If the length of parts is greater than or equal to 5
Yes
TextTrim parts[1] and save it as wantDate.Trim parts[1] and save it as wantDate.
TextTrim parts[2] and save it as wantTime.Trim parts[2] and save it as wantTime.
TextTrim parts[3] and save it as candidateName.Trim parts[3] and save it as candidateName.
TextTrim the last item of parts and save it as candidateEmail.Trim the last item of parts and save it as candidateEmail.
Decisions & LoopsIf candidateName is empty or candidateName is nullIf 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
Decisions & LoopsFinish 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
Decisions & LoopsIf 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
Decisions & LoopsFinish 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
Decisions & LoopsIf 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.
Decisions & LoopsFinish 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
Decisions & LoopsIf 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
Decisions & LoopsFinish 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
ValuesSet startsAt to wantDateT@wantTime.Set startsAt to wantDateT@wantTime.
ListsGet 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.
Decisions & LoopsIf 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.
Decisions & LoopsFinish 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
ValuesSet confirmation to Booked. .Set confirmation to Booked. .
ValuesChange confirmation to confirmationthe weekday name of wantDate wantDate at wantTime.Change confirmation to confirmationthe weekday name of wantDate wantDate at wantTime.
ValuesChange 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
ValuesShow 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
ValuesSet openSlots to an empty list.Set openSlots to an empty list.
ValuesSet slotCount to 0.Set slotCount to 0.
Decisions & LoopsFor each day in workingDays:For each day in workingDays:
Decisions & Loops 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
Decisions & LoopsStop repeating.Stop repeating.
No
No steps
Decisions & Loops For each slotTime in cleanTimes: For each slotTime in cleanTimes:
Decisions & Loops 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
Decisions & LoopsStop repeating.Stop repeating.
No
No steps
Values Set slotStart to dayT@slotTime. Set slotStart to dayT@slotTime.
Lists 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.
Decisions & Loops 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.
Decisions & LoopsIf slotCheck.isAvailable is yesIf slotCheck.isAvailable is yes
Yes
ListsAdd - 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.
ValuesAdd 1 to slotCount.Add 1 to slotCount.
No
No steps
On error
ValuesShow in the output: Could not check slotStart: slotError as text.Show in the output: Could not check slotStart: slotError as text.
Decisions & LoopsIf 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.
Decisions & LoopsFinish 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
ValuesSet offerText to:Set offerText to:Here are the interview times that are free:
MathChange offerText to offerText plus openSlots joined by a new line.Change offerText to offerText plus openSlots joined by a new line.
ValuesChange offerText to offerTextChange offerText to offerText To book one, reply in exactly this shape: codeWord | date | time | your name | your email For example: .
ValuesChange 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
Decisions & LoopsFinish the run: Open interview times were sent to the chat.Finish the run: Open interview times were sent to the chat.