How to synchronize the time attendance data to the third-party systems?

Yes we already did that sir. This is our company ID - 110006774. Thank you

HI @ohayo04.jd

We have checked that the reuqest interface with issues. Please check the request port. Thanks.

Server error: POST https:\/\/staging.astramc.ph\/api\/crosschex\/webhook resulted in a 500 Internal Server Error response:\n<!doctype html>\n<html class="theme-light">\n<!–\nErrorException: Array to string conversion in file /home/u982430947/doma (truncated…)\n"

I tested it and it works fine. I have uploaded the screenshot. However if the webhook is not working can you show me how to work with your api. Thank you very much.

Good day. I have not receive any response from your side sir. Please help me to work with my API. I really need it to work so I can get the records from the cloud to our system. Thanks

Good day sir. Can you please activate our webhook user interface for our company ID 110006774. Thank you very much

Hi @ohayo04.jd there is no need to activate the developer mode from our side anymore, you can do it from your account directly, at Settings tab

my colleague @Felix_Anviz will reply about your other question asap

Hello,
Can you explain what values the check_type field can take, and under what conditions?
In most of the records we receive, the check_type field has a value of 0, in a few it has a value of 1, and in a few others it has a value of 6.
Our employees normally punches in with a card, but sometimes they do it with a code.
We thought that the check_type field referred to whether the punch-in was done with a card or with a code (and this is how we would like it to work), however, looking through the records, it does not appear that the value of the check_type field is related to this, since it doesn’t match.
Thanks in advance.

HI
We have checked again with your webhooks again. We found there are some issues with your internal server.

There is a error message from our webhooks server:

POST https://staging.astramc.ph/api/crosschex/webhookresulted in a500 Internal Server Error` response:\n<!doctype html>\n<html class="theme-light">\n<!–\nErrorException: Array to string conversion in file /var/www/astramc/stag (truncated…)\n"

HI @cnrc-manager

The Check type that’s need refer to the device setting. In the device websever there is Attendance status. The value is with which you define by yourself.

Hi @Felix_Anviz

We have an Anviz C2 Pro device, and in our webserver, we have this section:

As it is something different, is there a more updated firmware?

Anyway, as I understand you, the check_type field will have the value of IN, OUT, 3, …, as set during punch-in or by configuration. Is it so?

On the other hand, is there any way to know if the punch-in was done by card or by code?

Hello! Can I ask for help how should I construct our api to use for your webhook. As of now this is the code I did. Please help us to apply the webhook in our system. I am using laravel. Thanks.

Route::post(‘/crosschex/webhook’, ‘CrosschexWebhookController@handle’);

public function handle(Request $request)
{
$payload = $request->all();

    if ($payload) {
        Timesheet::create(
            [
                'date' => Carbon::now(),
                'employee_id' => 'with payload',
                'employee_name' => implode(', ', $payload)
            ]
        );

        return response()->json(['message' => 'Payload received']);
    } else {
        Timesheet::create(
            [
                'date' => Carbon::now(),
                'employee_id' => 'no payload',
                'employee_name' => 'no payload'
            ]
        );

        return response()->json(['message' => 'Webhook received with no data']);
    }
}

Hi:

Sorry I do not good at laravel. But our webhooks do not need use any code to get the record.
The Webhooks will send the data to the server directly. Please check the our webhook page. Thanks.

Sir, am I correct? If someone punch in in the biometric the webhook will send the data to our server url. One more question sir. What is the use of the password field?

Yes, if someone punch-in in the biometric, the webhook system will send the data to your server url.
At this URL you should expect to receive the log data in json format.
This is a php code schema that you can use to receive the data:

try {
	listen_to_data();
} catch (Exception $e) {
	error_log('Error: ' . $e->getMessage());
} finally {
    header('Content-Type: application/json');
    echo json_encode(
        array(
            "code" => 200,
            "msg" => "success"
        )
    );
    http_response_code(200);
}

You must make sure that you respond with a code 200 and the content in json format:

{
"code": 200,
"msg": "success"
}

Otherwise, the webhook system will understand that there has been a reception error and will try to resend the data at another time.

In “listen_to_data()” function, you should get post data, with something like that:

$data = file_get_contents("php://input");
$json_data = json_decode($data, true);

Then, in json_data you will have the punch-in data, with the structure indicated in this thread, above.

The password field is there so that when you receive the data you can do an authorization check of the http post.
In this way, if you set the password “1234”, the webhook will send an http post to the url of your server, with the data, and in the headers, it will include a header called “HTTP_AUTHORIZE_SIGN”, with the value of the password “1234” . When you receive the message, you will check that this header exists and that the value is what you know it should be (“1234”).
As a check example:

if ( !isset($_SERVER['HTTP_AUTHORIZE_SIGN']) || ($_SERVER['HTTP_AUTHORIZE_SIGN'] !== "1234") ) {
		error_log('Access denied');
		header('HTTP/1.1 401 Unauthorized');
		exit('Access denied');
}
1 Like

Hi! Thank you for helping. It already works but however I noticed there are times that I don’t received request after every minutes. Also, I noticed that our server did not immediately get the request from the webhook after someone has punched in. Can you help me about my issue. Thank you very much