Deploy your first workflow

Passes the current day of the week as a search term to the Wikipedia API. A list of related Wikipedia articles is returned.

Code sample

Node.js

Before trying this sample, follow the Node.js setup instructions in the Workflows quickstart using client libraries. For more information, see the Workflows Node.js API reference documentation.

To authenticate to Workflows, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.

        },
        workflowId: WORKFLOW_ID,
      });
    }
  });

  it('should execute the quickstart', async () => {
    // Execute workflow, with long test timeout
    const result = execSync(
      `node --loader ts-node/esm ./index.ts ${PROJECT_ID} ${LOCATION_ID} ${WORKFLOW_ID}`
    );

    assert.strictEqual(
      result.length > 0,
      true,
      'Quickstart must return non-empty result'
    );
  }).timeout(5000);
});

YAML

- getCurrentTime:
    call: http.get
    args:
      url: https://timeapi.io/api/Time/current/zone?timeZone=Europe/Amsterdam
    result: currentTime
- readWikipedia:
    call: http.get
    args:
      url: https://en.wikipedia.org/w/api.php
      query:
        action: opensearch
        search: ${currentTime.body.dayOfWeek}
    result: wikiResult
- returnResult:
    return: ${wikiResult.body[1]}

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.