Blueprints

Getting started with Kestra — a Microservices and APIs workflow example

Source

yaml
id: microservices-and-apis
namespace: tutorial
description: Microservices and APIs

inputs:
  - id: server_uri
    type: URI
    defaults: https://kestra.io

  - id: slack_webhook_uri
    type: URI
    defaults: https://kestra.io/api/mock

tasks:
  - id: http_request
    type: io.kestra.plugin.core.http.Request
    uri: "{{ inputs.server_uri }}"
    options:
      allowFailed: true

  - id: check_status
    type: io.kestra.plugin.core.flow.If
    condition: "{{ outputs.http_request.code != 200 }}"
    then:
      - id: server_unreachable_alert
        type: io.kestra.plugin.notifications.slack.SlackIncomingWebhook
        url: "{{ inputs.slack_webhook_uri }}"
        payload: |
          {
            "channel": "#alerts",
            "text": "The server {{ inputs.server_uri }} is down!"
          }
    else:
      - id: healthy
        type: io.kestra.plugin.core.log.Log
        message: Everything is fine!

triggers:
  - id: daily
    type: io.kestra.plugin.core.trigger.Schedule
    disabled: true
    cron: 0 9 * * *

About this blueprint

Getting Started Notifications API DevOps Kestra

This flow is a simple example of a microservices and APIs use case. It checks the health of a server and sends a Slack alert if the server is down.

The flow also has a trigger that runs the flow daily at 9:00 AM to check the server's health regularly.

Request

If

Slack Incoming Webhook

Log

Schedule

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra