Skip to content

Welcome to Workflow²

Go to APPS APPS After activating Workflow² by clicking the button, go to OPEN WORKFLOW²

Start

Build your first workflow#

For your first workflow, let's build something to take one tedious task off your plate: cleaning up a cluttered Gmail inbox.

  1. Open the Nodes Panel by clicking on the orange + sign, then search and find the Gmail node. Click on it to add it to your canvas: Add Gmail node

  2. When you add the Gmail node to the canvas, its configuration module opens automatically: Gmail configuration modal

  3. The first thing you need to do is configure your credentials so that Workflow² can communicate with your Gmail account. You'll notice that the OAuth2 method is selected by default for Authentication, so click the Credentials dropdown and select Create New. The new credentials module appears: New Credentials module

  4. Copy the OAuth Callback URL from this module, then open a new browser tab and navigate to your Google Cloud Console dashboard.

  5. From your Google Cloud Console, perform the following:

    • Navigate to APIs & Services > Credentials.
    • Click + CREATE CREDENTIALS and select OAuth client ID.
    • Select Web Application from the Application type dropdown.
    • Click +Add URI and enter the OAuth Callback URL you copied from Workflow².
    • Click Create to save your new credentials. A corresponding Client ID and Client Secret will now be available. Copy these as they will be used in Workflow².
    • Navigate to APIs & Services > Library, search for Gmail and select Enable.

    Keep in mind

    We go through a quick credential flow for Google in this example, but you can learn all about Doc² credentials for Google services here.

  6. Return to your Workflow² tab and in the new credentials module enter the Client ID and Client Secret obtained from your Google Cloud Console. A Sign in with Google button appears. Gmail Credentials modal

  7. Click the Sign in with Google button. A module appears asking you to select your Google account and Allow access.

  8. Click Save to complete your Gmail credentials setup.

  9. Configure your Gmail node as follows: Gmail node

    • Resource: Select Message as we will be looking through all messages to decide what we can clean up.
    • Operation: Select Get All since we want to fetch all messages, not any particular one.
    • Return All: Leave this enabled so that the node fetches all your messages, no matter how full your inbox is.
    • Add Field > Format: Select IDs so that we fetch only the message ID instead of its entire contents.
    • Add Field > Query: This is where we use Gmail Search Operators to find the messages we want to delete. Here we use -in:chats unsubscribe to identify all messages not in chats that contain the word "unsubscribe".
  10. Next, let's add a Split in Batches node after the Gmail node. This will break up the cleanup operation into sections so avoid hitting any API rate limits. Let's configure it to use batches of 100 messages at a time: Split in Batches node

  11. Now let's add another Gmail node to perform the delete operation: Gmail node

    • Resource: Select Message as we will be deleting any message passed to this node.
    • Operation: Select Delete.
    • Message ID: Use the gears button to enter an expression. This enables the ID of each message from the first Gmail node to be dynamically passed to this node. From the Edit Expression window, use the menu to find and select the message ID in the Output Data: Edit Expression
  12. Lastly, let's ensure your nodes are properly connected in the workflow. The final result should look like this:

Workflow

You've build your fist automation workflow and cleaned up a cluttered inbox in the process. Don't forget you can edit the query to find more messages to cleanup, and also set this workflow to run automatically using the Cron node.

What's next?#

Do you enjoy automating workflows? Here's what you can do next:

  • See all Workflow² nodes and try out new workflows. Find more examples here.