This guide outlines how to set up a "Keep-Alive" workflow in Pabbly Connect to ensure your subscriptions (such as Microsoft Graph) remain active by sending periodic data to your main workflow.
If you need to keep multiple workflows or subscriptions active at once, you can easily do so by expanding the array in the Code (Pabbly) action. You do not need to create a separate "Heartbeat" workflow for each one; a single script can handle them all.
Step 1: Configure the Schedule Trigger
The trigger acts as a "heartbeat" that keeps the system active every two days without consuming paid tasks.- Choose App: Select Schedule (Pabbly).
- App Event: Select Schedule Workflow.
- Frequency: Set "How often do you want to run your workflow?" to At regular intervals.
- Interval Settings:
- Every: 2.
- Time Span: Days.
- Time: Select 12:00 PM (The time is based on your account time zone, such as Asia/Kolkata).
Step 2: Set up the Code (Pabbly) Action
This step uses JavaScript to send the necessary subscription data back to your main workflow's webhook.- Choose App: Select Code (Pabbly).
- App Event: Select Run JavaScript.
- JavaScript Code: Paste the following logic into the code block:
JavaScript:
const workflows = [
{
workflowId: "YOUR_WORKFLOW_ID_HERE",
subscriptionId: "YOUR_SUBSCRIPTION_ID_HERE"
}
];
async function sendToPabbly() {
for (const item of workflows) {
const url = `https://connect.pabbly.com/workflow/sendwebhookdata/${item.workflowId}`;
const payload = {
'value': [
{
'subscriptionId': item.subscriptionId
}
]
};
try {
const response = await fetch(url, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload)
});
const result = await response.text();
console.log("✅ Success:", item.workflowId, result);
} catch (err) {
console.error("❌ Error:", item.workflowId, err);
}
}
}
sendToPabbly();
Step 3: Locate Your Required IDs
To make the script work, you must replace the placeholder values in the workflows array with your actual data.Finding the workflowId
- Open your Main Workflow (the one you want to keep active) in your browser.
- Copy the ID string from the Address Bar URL. It usually appears at the end of the URL string.
Finding the subscriptionId
- This is found in the Response Received (JSON payload) of your main workflow's webhook.
- Look inside the res1 object under the value array to find the subscriptionId string.
Example JSON Path: res1 -> value [0] -> subscriptionId
If you need to keep multiple workflows or subscriptions active at once, you can easily do so by expanding the array in the Code (Pabbly) action. You do not need to create a separate "Heartbeat" workflow for each one; a single script can handle them all.
How to Add Multiple Workflows
To include more workflows, you must add additional objects within the workflows array. Each object must be separated by a comma (,).Updated JavaScript Example
Update the beginning of your code block as follows, ensuring you provide the unique IDs for each specific workflow:
JavaScript:
const workflows = [
{
workflowId: "WORKFLOW_ID_ONE",
subscriptionId: "SUBSCRIPTION_ID_ONE"
},
{
workflowId: "WORKFLOW_ID_TWO",
subscriptionId: "SUBSCRIPTION_ID_TWO"
},
{
workflowId: "WORKFLOW_ID_THREE",
subscriptionId: "SUBSCRIPTION_ID_THREE"
}
];
Summary of the Flow
- The Schedule runs every 2 days at 12:00 PM.
- The JavaScript loops through your provided Workflow IDs.
- The Fetch Request sends a POST request to the Pabbly Webhook URL to simulate activity and renew your subscription state.
Last edited:
