Work Market Developer Portal

WorkMarket Developer Portal

We are building the modern work market,
a frictionless exchange between businesses and workers.
See API Docs

    

Relay Scheduler

You can think of the Relay Scheduler as your own Work Market digital assistant. If you want the Relay to check the status of an assignment at a certain time, the Scheduler would be used. If you want to check routing results after a certain period of time to make sure you're within your SLA, then the Scheduler would be used. The goal is to free you up from manual interventions and checks within the system so you can focus on more strategic tasks.

Contact Us

Feel free to reach out to Work Market's Solutions Engineering team at solutions@workmarket.com. Someone from the team will contact you within 48 hours.

How does it work?

In some cases, it’s necessary to wait a certain period of time before performing a task, hence “delayInSeconds”. The following Rules Engine rule chain will send the assignment to group 8765, then wait 30 minutes and send it to group 4455.

Event: On create
POST https://relay.assignmentportal.com/co/112233/relay
Content-type: application/json

[{
    "action": "wm_sendAssignment",
    "relayId": "84336834",
    "relayAccessToken": "ion54jkdFE3nsFAFk",
    "wmAssignmentId": "${assignment_id}",
    "groupId": "8765"
},{
    "action": "wm_sendAssignment",
    "delayInSeconds": "1800",
    "relayId": "27234573",
    "relayAccessToken": "arDe3cHB093nffZ3fd",
    "wmAssignmentId": "${assignment_id}",
    "groupId": "4455"
}]

Note: delayInSeconds will spin the rule off asychronously. So switching these two rules (as below) would have nearly the same effect. The first rule (send to group 4455) would get scheduled for 30 minutes in the future and the send to group 8765 would go ahead and happen immediately.

Event: On create
POST https://relay.assignmentportal.com/co/112233/relay
Content-type: application/json

[{
    "action": "wm_sendAssignment",
    "actionCondition": "status==draft",
    "delayInSeconds": "1800",
    "relayId": "27234573",
    "relayAccessToken": "arDe3cHB093nffZ3fd",
    "wmAssignmentId": "${assignment_id}",
    "groupId": "4455"
},{
    "action": "wm_sendAssignment",
    "actionCondition": "status==sent",
    "delayInSeconds": "1800",
    "relayId": "27234573",
    "relayAccessToken": "arDe3cHB093nffZ3fd",
    "wmAssignmentId": "${assignment_id}",
    "groupId": "4455"
}]

Note an actionCondition can check any property of an assignment object. For example, the following rule will check the assignment’s zip code:

[{
    "action": "wm_sendAssignment",
    "actionCondition": "location.zip==40502",
    "relayId": "27234573",
    "relayAccessToken": "arDe3cHB093nffZ3fd",
    "wmAssignmentId": "${assignment_id}",
    "groupId": "4455"
}]

Or you can pass in a webhook variable with incomingValue. Here, if the resource is from Texas, we send them a friendly email:

Event: On accepted
POST https://relay.assignmentportal.com/co/112233/relay
Content-type: application/json

[{
    "action": "sendEmails",
    "actionCondition": "incomingValue==TX",
    "incomingValue": "${resource_state}",
    "relayId": "56219467",
    "relayAccessToken": "G34Sfa35sa6vjdg4TB",
    "emails": [“${resource_email}”],
    "subject": "HOWDY!",
    "body": "Messing with you is probably a bad idea",
    "bodyHtml": "<blink>Messing with you is probably a bad idea</blink>",
    "wmAssignmentId": "${assignment_id}"
}]

Timestamp conversions

This example updates Autotask ticket 12345’s User Defined Field (UDF) called “Worker Checked In On” with a timestamp in the specified format. Any valid Java timestamp format will work.

[{
    "action": "at_updateUDF",
    "relayId": "1380751",
    "relayAccessToken": "oFUN3547MjGYXRI",
    "externalSystemTicketId": "${custom_field_12345}",
    "wmAssignmentId": "${assignment_id}",
    "cfName": "Worker Checked In On",
    "cfValue": "${checked_in_on}",
    "cfTargetDateFormat":"yyyy.MM.dd G HH:mm:ss z"
}]