Shifts Webhooks

Sent when shifts are added, updated, or removed.

If you need to access to shift data as soon as it is available:

  • The shifts.partially_synced webhook is sent when shifts going back a specified number of days prior (starting from the date when the account was added) have been retrieved during initial data retrieval for a newly connected account.
  • The shifts.fully_synced webhook is sent when all shifts have been retrieved during initial data retrieval for a newly connected account.

Because some accounts can contain hundreds of shifts, we recommend subscribing to the shifts.partially_synced webhook when especially time-sensitive. The shifts.fully_synced webhook will only be sent when all shift data has been retrieved, which may take up to several hours in these cases.


#Added

post/v2/webhooks

The shifts.added webhook is sent only when an account's data is refreshed (does not include initial data retrieval) and a new shift is retrieved.

Request body
  • #
    eventsarray of strings
    required

    shifts.added

  • #
    namestring
    required

    Your name for the webhook subscription.

  • #
    urlstring
    required

    Where you want to receive webhook delivery. This can be either a backend URL that you manage, or a URL provided by a webhook management service.

  • #
    secretstring
    optional

    Optional secret used to verify webhooks.

Webhook message
  • #
    eventstring

    shifts.added

  • #
    namestring

    Name used for the webhook subscription.

  • #
    dataobject

  • #
    accountstring (uuid)

    ID of the account.

  • #
    userstring (uuid)

    ID of the user.

  • #
    available_fromstring (datetime)

    Timestamp (ISO 8601) of the earliest available shift.

  • #
    available_tostring (datetime)

    Timestamp (ISO 8601) of the most recent shift.

  • #
    available_countinteger

    Number of shifts currently available for this account.

  • #
    added_countinteger

    Number of shifts retrieved during a data refresh.

  • #
    added_fromstring (datetime)

    Timestamp (ISO 8601) of the earliest shift retrieved during a data refresh.

  • #
    added_tostring (datetime)

    Timestamp (ISO 8601) of the most recent shift retrieved during a data refresh.

Example Subscription
1curl --request POST \
2     --url https://api.argyle.com/v2/webhooks \
3     --header 'accept: application/json' \
4     --header 'content-type: application/json' \
5     --data '{
6        "events": ["shifts.added"],
7        "name": "name-for-the-webhook-subscription",
8        "url": "https://your-webhook-backend.com",
9        "secret": "optional-secret"
10     }'
Example Webhook
1{
2  "event": "shifts.added",
3  "name": "name-for-the-webhook-subscription",
4  "data": {
5    "account": "0187c66e-e7e5-811c-b006-2232f00f426a",
6    "user": "018051aa-f7a9-a0db-2f38-6cfa325e9d69",
7    "available_from": "2016-04-16T05:32:41Z",
8    "available_to": "2023-03-03T00:00:00Z",
9    "available_count": 412,
10    "added_count": 6,
11    "added_from": "2023-03-02T00:00:00Z",
12    "added_to": "2023-03-03T00:00:00Z"
13  }
14}

#Updated

post/v2/webhooks

The shifts.updated webhook is sent when there is any change to a property value of the shift object.

For example, after a shift is completed the shift object's status value changes from in_progress to completed.

Request body
  • #
    eventsarray of strings
    required

    shifts.updated

  • #
    namestring
    required

    Your name for the webhook subscription.

  • #
    urlstring
    required

    Where you want to receive webhook delivery. This can be either a backend URL that you manage, or a URL provided by a webhook management service.

  • #
    secretstring
    optional

    Optional secret used to verify webhooks.

Webhook message
  • #
    eventstring

    shifts.updated

  • #
    namestring

    Name used for the webhook subscription.

  • #
    dataobject

  • #
    accountstring (uuid)

    ID of the account.

  • #
    userstring (uuid)

    ID of the user.

  • #
    available_fromstring (datetime)

    Timestamp (ISO 8601) of the account's earliest available shift.

  • #
    available_tostring (datetime)

    Timestamp (ISO 8601) of the account's most recent shift.

  • #
    available_countinteger

    Number of shifts currently available for this account.

  • #
    updated_countinteger

    Number of shifts updated.

  • #
    updated_shiftsarray of strings (uuid's)

    ID's of the updated shifts.

  • #
    updated_fromstring (datetime)

    Timestamp (ISO 8601) of the earliest updated shift.

  • #
    updated_tostring (datetime)

    Timestamp (ISO 8601) of the most recent updated shift.

Example Subscription
1curl --request POST \
2     --url https://api.argyle.com/v2/webhooks \
3     --header 'accept: application/json' \
4     --header 'content-type: application/json' \
5     --data '{
6        "events": ["shifts.updated"],
7        "name": "name-for-the-webhook-subscription",
8        "url": "https://your-webhook-backend.com",
9        "secret": "optional-secret"
10     }'
Example Webhook
1{
2  "event": "shifts.updated",
3  "name": "name-for-the-webhook-subscription",
4  "data": {
5    "account": "0187c66e-e7e5-811c-b006-2232f00f426a",
6    "user": "018051aa-f7a9-a0db-2f38-6cfa325e9d69",
7    "available_from": "2016-04-16T05:32:41Z",
8    "available_to": "2023-03-03T00:00:00Z",
9    "available_count": 412,
10    "updated_count": 2,
11    "updated_shifts": [
12      "0187b43a-35fa-56e2-1a95-f7e4232a4b3a",
13      "0187dbfa-6f5e-a33a-af26-7e12ff408fea"
14    ],
15    "updated_from": "2023-03-02T00:00:00Z",
16    "updated_to": "2023-03-03T00:00:00Z"
17  }
18}

#Removed

post/v2/webhooks

The shifts.removed webhook is sent when a shift object has been deleted after a previous shift was not found when an account's data was refreshed.

Request body
  • #
    eventsarray of strings
    required

    shifts.removed

  • #
    namestring
    required

    Your name for the webhook subscription.

  • #
    urlstring
    required

    Where you want to receive webhook delivery. This can be either a backend URL that you manage, or a URL provided by a webhook management service.

  • #
    secretstring
    optional

    Optional secret used to verify webhooks.

Webhook message
  • #
    eventstring

    shifts.removed

  • #
    namestring

    Name used for the webhook subscription.

  • #
    dataobject

  • #
    accountstring (uuid)

    ID of the account.

  • #
    userstring (uuid)

    ID of the user.

  • #
    available_fromstring (datetime)

    Timestamp (ISO 8601) of the account's earliest available shift.

  • #
    available_tostring (datetime)

    Timestamp (ISO 8601) of the account's most recent shift.

  • #
    available_countinteger

    Number of shifts currently available for this account.

  • #
    removed_countinteger

    Number of shifts removed.

  • #
    removed_shiftsarray of strings (uuid's)

    ID's of the removed shifts.

  • #
    removed_fromstring (datetime)

    Timestamp (ISO 8601) of the earliest removed shift.

  • #
    removed_tostring (datetime)

    Timestamp (ISO 8601) of the most recent removed shift.

Example Subscription
1curl --request POST \
2     --url https://api.argyle.com/v2/webhooks \
3     --header 'accept: application/json' \
4     --header 'content-type: application/json' \
5     --data '{
6        "events": ["shifts.removed"],
7        "name": "name-for-the-webhook-subscription",
8        "url": "https://your-webhook-backend.com",
9        "secret": "optional-secret"
10     }'
Example Webhook
1{
2  "event": "shifts.removed",
3  "name": "name-for-the-webhook-subscription",
4  "data": {
5    "account": "0187c66e-e7e5-811c-b006-2232f00f426a",
6    "user": "018051aa-f7a9-a0db-2f38-6cfa325e9d69",
7    "available_from": "2016-04-16T05:32:41Z",
8    "available_to": "2023-03-02T00:00:00Z",
9    "available_count": 410,
10    "removed_count": 2,
11    "removed_shifts": [
12      "0187b43a-35fa-56e2-1a95-f7e4232a4b3a",
13      "0187dbfa-6f5e-a33a-af26-7e12ff408fea"
14    ],
15    "removed_from": "2023-03-02T00:00:00Z",
16    "removed_to": "2023-03-03T00:00:00Z"
17  }
18}

#Partially synced

post/v2/webhooks

The shifts.partially_synced webhook is sent when shifts going back a specified number of days prior (starting from the date when the account was added) have been retrieved. By default, this period is set to 30 days.

You can subscribe to this webhook multiple times with different numbers of specified days.

Of note:

  • This webhook is sent only during initial data retrieval (not ongoing refresh).
  • If the number of shifts for an account is small and captured completely with only one data pull, this webhook will not be sent. Instead the shifts.fully_synced webhook will be sent.
Request body
  • #
    eventsarray of strings
    required

    shifts.partially_synced

  • #
    namestring
    required

    Your name for the webhook subscription.

  • #
    urlstring
    required

    Where you want to receive webhook delivery. This can be either a backend URL that you manage, or a URL provided by a webhook management service.

  • #
    secretstring
    optional

    Optional secret used to verify webhooks.

  • #
    configobject
    optional

    "days_synced": <Integer> specifies how many days of synced shifts (starting from the date of the most recent shift) are needed to trigger the webhook.

Webhook message
  • #
    eventstring

    shifts.partially_synced

  • #
    namestring

    Name used for the webhook subscription.

  • #
    dataobject

  • #
    accountstring (uuid)

    ID of the account.

  • #
    userstring (uuid)

    ID of the user.

  • #
    available_fromstring (datetime)

    Timestamp (ISO 8601) of the account's earliest available shift from the synced time period.

  • #
    available_tostring (datetime)

    Timestamp (ISO 8601) of the account's most recent shift from the synced time period.

  • #
    available_countinteger

    Number of shifts currently available for this account at the time this webhook is sent.

  • #
    days_syncedinteger

    Number of days of synced shift events.

Example Subscription
1curl --request POST \
2     --url https://api.argyle.com/v2/webhooks \
3     --header 'accept: application/json' \
4     --header 'content-type: application/json' \
5     --data '{
6        "events": ["shifts.partially_synced"],
7        "name": "name-for-the-webhook-subscription",
8        "url": "https://your-webhook-backend.com",
9        "secret": "optional-secret",
10        "config": { "days_synced": 60 }
11     }'
Example Webhook
1{
2  "event": "shifts.partially_synced",
3  "name": "name-for-the-webhook-subscription",
4  "data": {
5    "account": "0187c66e-e7e5-811c-b006-2232f00f426a",
6    "user": "018051aa-f7a9-a0db-2f38-6cfa325e9d69",
7    "available_from": "2023-01-02T0:000:00Z",
8    "available_to": "2023-03-03T0:000:00Z",
9    "available_count": 97,
10    "days_synced": 60
11  }
12}

#Fully synced

post/v2/webhooks

The shifts.fully_synced webhook is sent when all shifts have been retrieved from a newly connected payroll account.

Request body
  • #
    eventsarray of strings
    required

    shifts.fully_synced

  • #
    namestring
    required

    Your name for the webhook subscription.

  • #
    urlstring
    required

    Where you want to receive webhook delivery. This can be either a backend URL that you manage, or a URL provided by a webhook management service.

  • #
    secretstring
    optional

    Optional secret used to verify webhooks.

Webhook message
  • #
    eventstring

    shifts.fully_synced

  • #
    namestring

    Name used for the webhook subscription.

  • #
    dataobject

  • #
    accountstring (uuid)

    ID of the account.

  • #
    userstring (uuid)

    ID of the user.

  • #
    available_fromstring (datetime)

    Timestamp (ISO 8601) of the account's earliest available shift.

  • #
    available_tostring (datetime)

    Timestamp (ISO 8601) of the account's most recent shift.

  • #
    available_countinteger

    Number of shifts currently available for this account.

Example Subscription
1curl --request POST \
2     --url https://api.argyle.com/v2/webhooks \
3     --header 'accept: application/json' \
4     --header 'content-type: application/json' \
5     --data '{
6        "events": ["shifts.fully_synced"],
7        "name": "name-for-the-webhook-subscription",
8        "url": "https://your-webhook-backend.com",
9        "secret": "optional-secret"
10     }'
Example Webhook
1{
2  "event": "shifts.fully_synced",
3  "name": "name-for-the-webhook-subscription",
4  "data": {
5    "account": "0187c66e-e7e5-811c-b006-2232f00f426a",
6    "user": "018051aa-f7a9-a0db-2f38-6cfa325e9d69",
7    "available_from": "2016-04-16T05:32:41Z",
8    "available_to": "2023-03-02T00:00:00Z",
9    "available_count": 412
10  }
11}
Updating Argyle status...
© 2024 Argyle Systems Inc.argyle.com