We have created a backend workflow which runs the openai api and am looking to repeat this weekly. Is this possible? Can the user input a preferred time scale?
At the moment our backend workflow is:
OpenAI Api call > create database entry > Make changes (deduct credit for result) > send email to user.
So, now I need to attempt to repeat the API call on a weekly basis and send the email but ideally I’d like the user to specify weekly or daily.
Just schedule the workflow to run again… the schedule time can be anything you like, so use a User-defined number of days.
In backend workflow?
At the end of your workflow, run ‘schedule API workflow’ for the same backend workflow and set it to run at Current date/time+days 7
Yeah, just put it into a recursive loop, using the user-defined timeframe as the time (current date/time + user defined days) as the time to schedule it for.
Yes, in the last step of the workflow, you make it recursive by adding it to call itself. you then put current date/time plus days and use a frequency number (1 or 7) set by the original run to set the next scheduled run.
You can add a field in the user’s profile to whether it should continue to run or not to set a conditional (that way it doesn’t just run in perpetuity).
Got it thanks.
Where would I define the user input for date specific?
Could do it a couple of ways. One when you are kicking off the workflow at the beginning. You can take an input (like a dropdown that says ‘daily’ or ‘weekly’) and then pass that through as a parameter (as 1 or 7 in ‘frequency’ in my example) when you first schedule the backend workflow.
Or you could just pass the user as a parameter and take the input from the dropdown and store it to the database for the user before scheduling the first backend workflow.
