This tool lets you automatically log working time to your personio Attendance table and getting a feedback by Slack when the entry to the Attendance table has been successfully posted. It consists in two parts, the client and the server.
Written in Python3. It does a login into the Personio site and post the autogenerated working time values.
- Python3
A config.py
file needs to be created out from config_sample.py
file with your own credentials and configuration.
Example configuration:
#Personio credentials
EMAIL = 'name.surname@rindus.de'
PASSWORD = 'myStrong!Password'
PROFILE_ID = '0000000' # This can be found in your personio profile URL
#Slack credentials
SLACK_MESSAGE = False
SLACK_SECRET = 'aaaaaaa'
SLACK_BOT_URL = 'URL-TO-BOT'
#App configuration
STARTING_HOUR = "08:00" # Hour you usually start working in the morning
BREAK_HOUR = "13:00" # Hour you usually take your lunch break
WORKING_HOURS = 9 # Including break time
BREAK_TIME_MINUTES = 30
#Personio credentials EMAIL = 'name.surname@rindus.de' PASSWORD = r'myStrong!Password' PROFILE_ID = '0000000' # This can be found in your personio profile URL
Change the access right to that file to user-read-only:
chmod 400 config.py
The generated time will always be less than the WORKING_HOURS
in order not to exceed the maximum allowed by the law as it will be treated as overtime work
$ path/to/personio-timelogger.py 2019-06-07
A cron job can be created to run this automatically every working day (from Monday to Friday). For example, the following cron entry will be triggered at 17:00 every working day
0 17 * * 1-5 ~/bin/personio-timelogger.py $(date +%Y-%m-%d) >/dev/null 2>&1
You will probably need to scape the %
character this way:
0 17 * * 1-5 ~/bin/personio-timelogger.py $(date +\%Y-\%m-\%d) >/dev/null 2>&1
If you use a Mac, Cron
is deprecated in MacOS. Instead it uses LaunchAgents
. To configure a launchAgent follow the following guide:
- Create a file called
runner.sh
besideclient/personio-timelogger.py
- Put this inside the file, with this repository path in your machine and save it
#!/bin/bash
/ABSOLUTE-PATH-TO-THIS-REPO/client/personio-timelogger.py $(date "+%Y-%m-%d")
- Give it execution permission
chmod +x runner.sh
- Go to:
~/Library/LaunchAgents
- Create a
.plist
, iede.personio.cron.plist
file in there with this content. You can modify to your liking in terms of hours. Save the file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>de.personio.cron</string>
<key>Program</key>
<string>/bin/sh</string>
<key>ProgramArguments</key>
<array>
<string>-c</string>
<string>/ABSOLUTE-PATH-TO-THIS-REPO/client/runner.sh</string>
</array>
<key>StartCalendarInterval</key>
<array>
<dict>
<key>Hour</key>
<integer>17</integer>
<key>Minute</key>
<integer>45</integer>
<key>Weekday</key>
<integer>1</integer>
</dict>
<dict>
<key>Hour</key>
<integer>17</integer>
<key>Minute</key>
<integer>55</integer>
<key>Weekday</key>
<integer>2</integer>
</dict>
<dict>
<key>Hour</key>
<integer>17</integer>
<key>Minute</key>
<integer>38</integer>
<key>Weekday</key>
<integer>3</integer>
</dict>
<dict>
<key>Hour</key>
<integer>17</integer>
<key>Minute</key>
<integer>43</integer>
<key>Weekday</key>
<integer>4</integer>
</dict>
<dict>
<key>Hour</key>
<integer>17</integer>
<key>Minute</key>
<integer>47</integer>
<key>Weekday</key>
<integer>5</integer>
</dict>
</array>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
</dict>
</dict>
</plist>
- Run
launchctl load de.personio.cron.plist
- Improve the times of the week
Written in Javascript. It is a bot for slack which will handle the feedback from the client and will inform the user which information has been posted to personio when the client runs.
- NodeJS
- npm (or yarn)
- Run
$ npm i
- Create .env file with the following content
// Server Config
PORT=3000
// Found under Basic Information in Slack
SLACK_CLIENT_ID=
SLACK_CLIENT_SECRET=
SLACK_VERIFICATION_TOKEN=
// Found under OAuth & Permissions in Slack (the bot token)
SLACK_AUTH_TOKEN=xoxb-...
- Run the server
$ node server.js
The bot will personally send you feedback when a new post to personio has been successfully done. You need to register into the bot to be able to receive incoming messages from it. Follow the following instructions:
- Open Rindus Slack
- Go to
slackbot
conversation below Direct messages - Run
/timelogger
- You will receive a secret key from the bot. This secret key is the one you have to store in the client
config.py
file asSLACK_SECRET