Source
id: ai-add-tasks-deepseek
namespace: company.team
inputs:
- id: prompt
type: STRING
displayName: What would you like to add to your task list?
description: List out all the things you need to get done
defaults: I need to get my prescription on Friday afternoon and go shopping
afterwards
tasks:
- id: create_task_fields
type: io.kestra.plugin.deepseek.ChatCompletion
apiKey: '{{ kv("DEEPSEEK_API_KEY") }}'
modelName: deepseek-chat
messages:
- type: SYSTEM
content: You are going to help to write a todo list inside of Todoist. I need
you to return any user messages as tasks in JSON format only. There
might be multiple tasks. The current time is '{{ now() }}'
- type: USER
content: "{{ inputs.prompt }}"
jsonResponseSchema: |
{
type: "object",
"properties": {
"tasks": {
"type": "array",
"items": {
"type": "object",
"properties": {
"title": "string",
"description": "string",
"due_date": {
"type": "string",
"format": "date-time"
"description": "Due date of the task (as a RFC 3339 timestamp).",
}
}
}
}
}
}
- id: create_tasks
type: io.kestra.plugin.core.flow.ForEach
values: "{{ outputs.create_task_fields.response | jq('.tasks') | first }}"
tasks:
- id: create_task
type: io.kestra.plugin.core.http.Request
uri: https://api.todoist.com/rest/v2/tasks
method: POST
contentType: application/json
headers:
Authorization: "Bearer {{ kv('TODOIST_API_TOKEN') }}"
body: |
{
"content": "{{ taskrun.value | jq('.title') | first }}",
"description": "{{ taskrun.value | jq('.description') | first }}",
"due_datetime": "{{ taskrun.value | jq('.due_date') | first }}"
}
About this blueprint
AI API Kestra SaaS
This flow uses the Deepseek AI plugin to transform unstructured, conversational text inputs into a precise JSON format for task creation in Todoist.
The core logic relies on Deepseek's ability to adhere to a strict jsonResponseSchema
, enabling it to accurately parse complex task details like titles, descriptions, and due dates (e.g., "Friday afternoon") into the required RFC 3339 timestamp format.
The flow then iterates over the resulting structured JSON array using a ForEach task and securely posts each individual task to the Todoist REST API using the generic HTTP plugin.
Configuration:
- Provide a key-value pair for the Deepseek API key (
DEEPSEEK_API_KEY
). - Provide a key-value pair for your Todoist Personal API Token (
TODOIST_API_TOKEN
). - The task details are provided by the
prompt
flow input.
This blueprint showcases converting any free-text data into structured outputs for system integration (e.g., creating Jira issues, logging database records, or sending formatted alerts).