I just built a similar setup in my lab today using Workitems. Within the Workitem flow, I add a row to a contact list every 5 minutes, which serves as a log and confirmation that it actually works.
2) Workitems expire after 1 year. However, I believe this limitation can be overcome by adding a step to the Workitem flow that creates a new Workitem using a data action after a certain period.
This approach could offer customers who have purchased the Work Automation Add-On an alternative method for running scheduled workflows.
Original Message:
Sent: 12-17-2024 09:47
From: Jim Crespino
Subject: How to schedule workflow execution?
This is a great thread! I love the collaboration around coming up with a solution to the problem. Because I sometimes can't turn off my brain, I thought of yet another potential solution and wanted to post it here in case anyone was interested.
The Work Automation feature of Genesys Cloud was meant to create "tasks" that are routed to live or virtual agents to complete. These can often be long running tasks that span days/weeks/months. So given that, I feel like Work Automation could easily be used to build a task that would wake up daily, execute, and then sleep for another day. When it wakes up it could be sent to a queue that has no members so that an in-queue workflow could execute that would give someone the ability to execute the logic needed, including calling Data Actions.
Someone would have to create the initial workitem using the Work Automation APIs in the API Explorer in the Genesys Cloud Developer Center, but once created, the workitem could then exist in the system happily waking, working, and sleeping as needed.
I've only developed a small proof of concept around this where the work item would wake up every hour and do something and go back to sleep. In my case I had it call a Data Action that called the Genesys Webhook integration to post a message into a Genesys Cloud UC chat group just so that I could know that it was executing as required. However, I have not tested it running for weeks/months, so there may be time limits that would prevent this from being a valid solution.
I hope that helps prompt some ideas for folks.
------------------------------
Jim Crespino
Senior Director, Developer Evangelism
Genesys
https://developer.genesys.com
Original Message:
Sent: 12-17-2024 09:12
From: Vidmantas Zygus
Subject: How to schedule workflow execution?
I have created PowerShell script and scheduled it on Windows scheduler.
Script code generated by copilot :)
# Enforce TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# Define the URL and credentials for token retrieval
$tokenUrl = "https://login.mypurecloud.ie/oauth/token"
$clientId = "************"
$clientSecret = "**********"
# Encode the client credentials
$encodedCredentials = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("${clientId}:${clientSecret}"))
# Define the body for the token request
$tokenBody = "grant_type=client_credentials"
# Make the POST request to retrieve the token
$tokenResponse = Invoke-RestMethod -Uri $tokenUrl -Method Post -Body $tokenBody -ContentType "application/x-www-form-urlencoded" -Headers @{
Authorization = "Basic $encodedCredentials"
}
# Extract the access token
$accessToken = $tokenResponse.access_token
# Output the access token
$accessToken
# Define the URL and request body for the API call
$apiUrl = "https://api.mypurecloud.ie/api/v2/flows/executions"
$apiBody = @{
flowId = "***********"
}
# Convert the body to JSON format
$jsonApiBody = $apiBody | ConvertTo-Json
# Make the POST request to the API with the Bearer token
$apiResponse = Invoke-RestMethod -Uri $apiUrl -Method Post -Body $jsonApiBody -ContentType "application/json" -Headers @{
Authorization = "Bearer $accessToken"
}
# Output the response
$apiResponse
------------------------------
Vidmantas Zygus
Systems expert
Original Message:
Sent: 12-17-2024 09:03
From: Cameron Tomlin
Subject: How to schedule workflow execution?
This is awesome Community feedback! But @Vidmantas Zygus what route did you end up taking/best answer?
Also don't forget if you like a response al ot you can always give a nomination for community rockstar!
------------------------------
Cameron
Online Community Manager/Moderator
Original Message:
Sent: 12-13-2024 08:39
From: Vidmantas Zygus
Subject: How to schedule workflow execution?
Hi, any ideas how to schedule workflow execution?
I have created a process that schedules abandoned calls as callbacks. But every morning I need to clear yesterday's callbacks as they are outdated. I have created a workflow for that, but how to schedule this workflow to be executed every morning at a fixed time before CC opening hours?
Vidmantas
#API/Integrations
#ArchitectureandDesign
------------------------------
Vidmantas Zygus
Systems expert
------------------------------