Skip to main content
All CollectionsSettings/Configurations
Mero Webhook Integration - Shift End
Mero Webhook Integration - Shift End
Updated over a week ago

Mero supports a webhook event with the type 'shift.ended', which is triggered at the completion of a cleaner's shift. Please ensure that your organization has webhooks enabled. You may reach out to your Account Representative in order to get it activated.

Creating a Webhook Endpoint

  • Log into the Mero Control Centre at app.mero.co.

  • Once logged in, go to the "Settings" page at the bottom of the screen, and select the "Webhooks" tab.

  • Click on the "Add Endpoint" button, and add in the URL.

  • Select the 'shift.ended' event and click "Save" to create the webhook.

Managing a Webhook Endpoint

  • You can manage all created webhooks on the "Endpoints" section. You can update and delete as needed.

Webhook Payload Structure

  • Mero uses a tool called Svix. Svix sends JSON payloads in the body of POST requests to your webhook endpoint. For the event 'shift.ended', the payload has the following structure.

{
"shift_id": "uuid",
"basestation_presence_lengths": [
{
"basestation_id": "uuid",
"starts_at": "string",
"ends_at": "string",
"state": "string",
"expected_duration": int,
"reality_duration": int
}
]
}
{
"shift_id": "345g6789-g89d-34e5-c678-636877660000",
"basestation_presence_lengths": [
{
"basestation_id": "345g6789-g89d-34e5-c678-636877660000",
"starts_at": "2023-12-05T08:00:00Z",
"ends_at": "2023-12-05T08:30:00Z",
"state": "VISIT_CONFIRMED",
"expected_duration": 3600,
"reality_duration": 1188
}
]
}
  • shift_id: Identifier of the shift.

  • basestation_presence_lengths: An array containing information about the presence at base stations during the shift.

    • basestation_id: Identifier for a specific base station.

    • start_at: Timestamp indicating the start time of the presence in ISO 8601 format.

    • ends_at: Timestamp indicating the end time of the presence in ISO 8601 format.

    • state: Field format by Enum (see below)

    • expected_duration: Expected duration time in seconds

    • reality_duration: Actual duration time in seconds

enum values:

  • PENDING: The task was not yet completed, can be because the cleaner is still on shift.

  • UNCONFIRMED: The beacon was not detected in the location so Mero cannot automatically verify the location was cleaned. The supervisor should mark the location as cleaned/not cleaned after consulting the cleaner.

  • VISIT_CONFIRMED: Mero has verified that the task has been completed through Mero Beacon or was manually confirmed by the user

  • NOT_VISITED: No Beacon was detected by Mero and the area was marked as not cleaned by the supervisor

  • MANUALLY_CONFIRMED: The beacon was not detected in the location so Mero cannot automatically verify the location was cleaned. The supervisor has confirmed with the cleaner or has confirmed themselves that the task was complete and marked it as cleaned.

Testing the Endpoint

  • Within the "Endpoints" section of the "Webhooks" tab, select the endpoint and navigate to "Testing". Click on "Send Example"

  • After an example event is sent, you can click into the message to view the payload. If the response returns with a 2xx code, it is a successful delivery.

  • You can also review the log details, containing the payload. Navigate to the "Logs" section to see this.

Did this answer your question?