Shiftly (démo)
La promesse. Un SaaS de planning fictif : chacun voit les équipes de son périmètre, et un responsable connecté approuve les feuilles d'heures qu'il choisit, après confirmation.
La source. L'API publique de la démo, shiftly.convoy-ai.com (sa spec :
/openapi.json, ses pages : /docs) : équipes, feuilles d'heures, rapport d'heures
supplémentaires, approbation, et connexion par code. C'est un des deux modèles de la Console.
Avant de publier : sa clé
Shiftly délivre des clés d'API comme un vrai SaaS. Sur shiftly.convoy-ai.com, obtenez une clé en tant qu'Anta ou Camille : la page envoie un code à leur adresse, que vous lisez sur shiftly.convoy-ai.com/demo/inbox. Collez la clé sur la page des clés de la station dans la Console. Une première publication sans la clé est refusée et le dit ; une fois la clé enregistrée, la même publication démarre la station.
Pour essayer la station, connectez-vous comme [email protected] (deux équipes) ou
[email protected] (la responsable : toutes les équipes), avec les codes de
shiftly.convoy-ai.com/demo/inbox.
Le parcours
teamsliste les équipes, pour que la personne dise laquelle ;timesheetsmontre les feuilles d'heures d'une équipe pour un mois ; la personne choisit celles à approuver, et sa confirmation dépose l'approbation (submit) ;overtime-reportrépond directement : le total et la semaine la plus chargée.
Deux accès, aucun n'est au modèle : la clé de la station (key_env), qui ouvre l'annuaire des
équipes et la connexion, et le jeton de la personne (auth.person), délivré par Shiftly à sa
connexion : Shiftly répond alors pour elle (Camille voit ses deux équipes, Anta les quatre).
Ses politiques
| politique | état | ce qu'elle fait |
|---|---|---|
| profils | actifs | seule une personne connectée lit les feuilles et le rapport, et approuve |
overtime-threshold | active | une feuille de plus de 8 heures supplémentaires ne s'approuve pas depuis la conversation |
submitted_by: owner | actif | seul le propriétaire connecté de la room approuve |
still-waiting | en commentaire | n'approuver que les feuilles encore en attente |
approvals-per-day | en commentaire | au plus 20 approbations par jour et par personne (un budget scope: identity) |
Sa config
# Shiftly: your own HR station on Shiftly's demo API: sign-in, each person's own scope, and
# timesheet approvals only a signed-in manager makes.
#
# Shiftly is a fictional shift-planning SaaS whose API is public for you to build on:
# https://shiftly.convoy-ai.com (its OpenAPI: /openapi.json, its pages: /docs). It has teams,
# timesheets, an overtime report, the approval of timesheets, and a sign-in by one-time code.
#
# BEFORE YOU PUBLISH, get a key. Shiftly issues API keys like any SaaS: on
# https://shiftly.convoy-ai.com, get a key as Anta or Camille (the page sends a code to their
# address; read it at https://shiftly.convoy-ai.com/demo/inbox). Then paste it on the station's key
# page in the Console. Your first publication may be refused for the missing key: the refusal says
# so, and the same publication starts the station once the key is saved.
# To try the station, sign in as [email protected] (two teams) or [email protected] (the manager:
# every team), with the codes shown at https://shiftly.convoy-ai.com/demo/inbox.
#
# What it does:
# · `teams` lists the teams, so the person can say which one they mean;
# · `timesheets` shows a team's timesheets for a month; the person chooses the ones to approve,
# and their confirm files the approval on Shiftly (`submit`);
# · `overtime-report` answers outright (nothing to choose): the total and the busiest week.
# It speaks French and English: the person's own language when it is one of them.
#
# Then try its POLICIES: the rules Convoy applies whatever the model says. Who approves and an
# overtime threshold are on; more are below as comments, each ready to enable: remove the « # » of
# the lines it says, check, publish, and see it on the station's Policies tab. A new version each
# time: roll back from the Versions tab, watch the effect in Analytics.
station:
id: my-hr # Convoy sets this to your station's name when you publish
name: Shiftly
# Signing in: a one-time code to the person's e-mail, sent and checked by Shiftly's own operations.
# Shiftly's check answers with the person's token (`access_token`), which Convoy keeps sealed with
# their sign-in and sends on their calls. The assistant never holds it.
identity:
providers:
email:
mechanism: otp
verifies: email
type: email
via: tenant
send: sendVerificationCode
check: checkVerificationCode
credential: access_token
global:
language: fr # the default, when the person speaks neither of the station's languages
languages: [fr, en]
locale: fr-FR
domain:
domain_type: saas
entity_name: timesheet
entity_name_plural: timesheets
voice:
tone: professional
persona: "an HR analyst who speaks in figures, briefly"
rules:
- "Never give an hour that was not measured: every figure comes from the report."
- "If a team is refused, repeat the server's sentence as it is, without rewording it."
- "Never approve a timesheet the person has not chosen."
emoji: false
# Shiftly's API. Two credentials, and neither is the model's:
# · the station's KEY (`key_env`): the one you get on Shiftly's page and paste on the key page.
# Convoy reads it from the name `SHIFTLY_API_KEY` and sends it as `X-Shiftly-Key`. It opens the
# team directory and the sign-in, and identifies no one;
# · the PERSON's token (`person`): Shiftly issues it when someone signs in, and Convoy sends it on
# their calls. Shiftly then answers for THAT person: Camille sees her two teams, Anta all four.
apis:
- name: shiftly
openapi_url: "https://shiftly.convoy-ai.com/openapi.json"
base_url: "https://shiftly.convoy-ai.com"
operations:
- {id: listTeams, access: read}
- {id: getTimesheets, access: read}
- {id: getOvertimeReport, access: read}
- {id: approveTimesheet, access: write}
- {id: sendVerificationCode, access: write}
- {id: checkVerificationCode, access: write}
auth:
type: api_key
key_name: X-Shiftly-Key
key_location: header
key_env: SHIFTLY_API_KEY
person: {provider: email}
# Who may call what. Closed by default: an operation no profile grants is called for no one.
# ON: only a signed-in person reads timesheets and the report, and approves. Called before that,
# Convoy asks them to sign in, then runs the call. Which teams they may approve is Shiftly's
# decision, made from their token: a manager approves their teams' timesheets, no one else's.
profiles:
anonymous:
when: "$identity.authenticated == false"
grants:
- shiftly.listTeams
signed-in:
when: "$identity.authenticated"
grants:
- shiftly.listTeams
- shiftly.getTimesheets
- shiftly.getOvertimeReport
- shiftly.approveTimesheet
# Reusable policies: written once here, cited by name where they apply (here, the `timesheets`
# skill's `select.guards`). A policy nobody cites is refused when the config loads.
policies:
# ON. An overtime threshold: a timesheet with more than 8 hours of overtime is not approved from
# the conversation. Try `mode: observe`: it refuses nothing and writes in the journal what it
# would have refused.
overtime-threshold:
require: "$item.fields.overtime_hours <= 8"
reason: "more than 8 hours of overtime: approve this timesheet in Shiftly itself"
# OFF. Only timesheets still waiting are approved (Shiftly marks them `submitted`). To enable it,
# with its citation in the `timesheets` skill below, uncomment the next 3 lines.
# still-waiting:
# require: "$item.fields.status == 'submitted'"
# reason: "this timesheet is no longer waiting for approval"
# OFF. A budget: each signed-in person approves at most 20 timesheets a day (`scope: identity`
# counts per person; `count: true` counts each timesheet once). To enable it, with its citation
# in the `timesheets` skill below, uncomment the next 3 lines.
# approvals-per-day:
# budget: {count: true, per: day, scope: identity, max: 20}
# reason: "20 approvals a day from the conversation; the rest in Shiftly itself"
skills:
- name: teams
invoke: {method: listTeams}
cognitive:
objective: "list the company's teams so the person can pick the one they mean"
- name: timesheets
cognitive:
objective: "show a team's timesheets for a month, with their status and overtime, for the person to choose the ones to approve"
diagnose: [the team, the month]
params:
team: {type: text, set_by: [llm]}
month: {type: text, set_by: [llm], required: false}
status: {type: text, set_by: [llm], required: false}
invoke:
method: getTimesheets
args: {team: "$params.team", month: "$params.month", status: "$params.status"}
kinds: {timesheet: {}}
# No price: this station sells nothing. `overtime_hours` and `status` are what the policies read.
present:
fields:
name: {from: name, type: text, role: title}
overtime_hours: {from: overtime_hours, type: number}
status: {from: status, type: text}
select:
quantity: {max: 1} # a timesheet is approved once: "3 × the week of Camille" is not a thing
guards:
- {policy: overtime-threshold}
# OFF. To enable `still-waiting` (with its policy above), uncomment the line below.
# - {policy: still-waiting}
# OFF. To enable `approvals-per-day` (with its policy above), uncomment the line below.
# - {policy: approvals-per-day}
# The approval, filed on the person's confirm: the chosen timesheets as one list of ids.
submit:
- name: approve
mode: request
tool: approveTimesheet
line: "$line.ref"
args:
body.timesheet_ids: "$selection[kind=timesheet]"
# One key per approval: a retry reuses it, so nothing is approved twice.
body.idempotency_key: "$action.key"
render: {component: cards}
# No kinds, nothing to choose: a capability that answers. `report` says which of Shiftly's fields
# is the headline and which are the series, the way `present` says which is the name.
- name: overtime-report
cognitive:
objective: "answer about a team's overtime for a month, and its busiest week"
params:
team: {type: text, set_by: [llm]}
month: {type: text, set_by: [llm], required: false}
invoke:
method: getOvertimeReport
args: {team: "$params.team", month: "$params.month"}
render:
component: report
report:
headline: total_overtime_hours
headline_label: "overtime hours"
unit: h
series: weeks
point_label: week_starting
point_value: overtime_hours
highlight: worst_week
# Who submits. ON: the person confirms (`confirm`), and only the room's owner, SIGNED IN, may
# (`submitted_by`): holding the conversation's code is not enough to approve anyone's hours.
submit_guard:
confirm: true
submitted_by: [{who: owner}]