API HR Talenta for ClockIn and ClockOut, so you don't need to open the app and clockin/clockout
- npm
- nodejs (version 18 or higher - required for native fetch and FormData support)
- yarn
Just run yarn install or npm install
NEW: The application now features automatic location detection! You only need to configure the Cookie value, as latitude and longitude will be automatically detected from your device location.
At minimum you need to specify the Cookie variable. For fallback purposes, you should also configure Latitude and Longitude.
You could copy from config.js.tmpl to config.js then change it according your value.
Then you could run using script defined in package.json
If you're experiencing 403 signature errors, you can test the fix with:
npm run test-fix
or
yarn test-fix
This will help diagnose any remaining authentication issues and verify the signature fix is working.
OPTION 1: Automatic (Recommended)
Use the new fetchCookies function to automatically get cookies:
const talenta = require('talenta-api');
const cookies = await talenta.fetchCookies('[email protected]', 'yourpassword');OPTION 2: Manual
- you need to login with this url
https://account.mekari.com/users/sign_in?app_referer=Talentaand sign in - after login on the browser press
F12 - the new window/new window on bottom screen will popup and switch to
Applicationtab, pickCookie->https://hr.talenta.coand then scroll down until get the Cookie with namePHPSESSIDor_identity - copy the value
- prepare the value for program with
PHPSESSID=<value>or_identity=<value> - open the file
config.js(copy fromconfig.js.tmpl) and change the variablecookiesTalentatoPHPSESSID=<value>or_identity=<value> - and good news the cookie will last forever
NEW FEATURE: The application now automatically detects your location using your device's geolocation capabilities! This means you no longer need to manually configure latitude and longitude in most cases.
How it works:
- When you run clockin/clockout, the app will automatically try to detect your current location
- If location detection succeeds, it will use your actual coordinates
- If location detection fails (e.g., no browser access, permission denied), it will fallback to the configured coordinates in
config.js
Benefits:
- No manual coordinate configuration needed
- More accurate location based on your actual device location
- Automatic fallback ensures the app always works
Note: With the new auto-location detection, you may not need to manually configure coordinates. However, you should still set fallback coordinates in case auto-detection fails.
- its easy, just go to google map
- right click on the location
- and select the first menu, your latitude and longitude will be copied and separated with "
," like this
-6.861928521923624, 107.63578698474662
Latitude , Longitude
- open the file
config.js(copy fromconfig.js.tmpl) and change the variablelatitudeandlongitudefollowing with the value copied from google map
after everything complete you just need to run this to clockin
yarn run clockin
or
yarn run clockout
to clockout
It is just by adding timeClockIn and timeClockOut within config.js file. The time format is hh:mm.
It is important to note, that you have to define both variables, otherwise, the scheduler won't work.
To start the scheduler, simply run
yarn scheduler:start
And to stop the scheduler, run,
yarn scheduler:stop
If you want to change the time for your clockIn and clockOut, you have to stop and restart the scheduler.
Functions: clockIn and clockOut
Parameters
{ lat: '-6.000', long: '107.000', cookies: 'PHPSESSID=<value>', desc: 'message' }
NEW FEATURE: You can now automatically fetch cookies using your Talenta credentials!
Function: fetchCookies
Parameters
fetchCookies(email, password)
Example usage:
const talenta = require('talenta-api');
// Fetch cookies automatically
const cookies = await talenta.fetchCookies('[email protected]', 'yourpassword');
// Use the cookies with clockIn/clockOut
await talenta.clockIn({
lat: '-6.000',
long: '107.000',
cookies: cookies,
desc: 'Hello I am In'
});Benefits:
- No more manual cookie extraction from browser
- Automated authentication flow
- Fresh cookies every time
- Simplifies the setup process
Testing the feature:
npm run test-fetch-cookies
or
yarn test-fetch-cookies