This topic was automatically generated from Slack. You can find the original thread here.
Tim Kracht : Hello I was wondering, I have created a few Discord workflows to generate some timed announcements. But, is there a way to join/chain/connect workflows together, so that when one workflow triggers another might start. My end goal is that every three weeks I want to do an announcement, after that announcement I want to send another announcement every 12 hours, and have it repeat that announcement 10 times.
The Task Scheduler that that example uses is the best way to achieve what you want:
Workflow is triggered by whatever process starts your chain. That kicks off the first scheduled “task” by triggering workflow #2.
Workflow #2 runs at the specific time you set the task to execute.
Workflow #2 can also schedule a new task on its own endpoint. As soon as you post the announcement, you can send another HTTP request to the task scheduler’s endpoint, scheduling that workflow to run again in three weeks, or 12 hours, etc.
The docs go into more detail on the implementation, so give those a read and let me know if you have any other questions!
Dylan Sather (Pipedream) : Yes that works. If you’re triggering the exact same announcement, you can also simply trigger a scheduled task on the same, single task scheduler source that’s tied to your original workflow. That way you execute the timed workflow in a loop: schedule, execute, then schedule again.
Tim Kracht : I was figuring that, I figure i would need to do the first trigger on the day it should start the loop. It would first start on September 2nd do the 10 steps and then wait another 21 days and do it again I wasn’t sure how to do it other than to start the procedure then while it’s running add in the last pause and set it for 21 days and then have trigger the first workflow. Or just put in the cron job to have it run every 21 days. Which way is more efficient for the system?
Dylan Sather (Pipedream) : There’s no real difference in efficiency. Technically running the workflow every 21 days would suffice if that’s simpler to manage.
Tim Kracht : Hey Dylan, I am picking this one back up again, I have the chain working good, my question is there a way to have it trigger two different chains?
Dylan Sather (Pipedream) : Yes, you can schedule multiple tasks, at any time in the future, using the same task scheduler endpoint. You can also send an HTTP request to two different task schedulers, triggering two different workflows. Does that help?