New to Kestra?
Use blueprints to kickstart your first workflows.
Webhook-driven ServiceNow triage that reads the newest incident, grounds Gemini in your ops playbook with RAG, and updates the incident comments.
Give every ServiceNow incident a knowledge-base-grounded first response before an engineer even opens it. This Kestra blueprint reacts to a webhook, reads the newest record from the ServiceNow incident table, embeds your operations playbook into the built-in Kestra KV vector store, and asks Google Gemini for triage steps through retrieval-augmented generation. If the model finds relevant playbook guidance, the proposal is written back to the incident comments; if the ticket is out of scope, the model answers 'N/A' and ServiceNow is left untouched, a simple but effective hallucination guardrail.
incident_trigger (io.kestra.plugin.core.trigger.Webhook) is called by a ServiceNow business rule or outbound REST message, secured by SERVICENOW_WEBHOOK_KEY.get_incidents task (io.kestra.plugin.servicenow.Get) queries the incident table using credentials supplied once via pluginDefaults.last_incident task (io.kestra.plugin.core.debug.Return) sorts by incident number with jq and keeps only sys_id, number, priority, and the descriptions.build_kb_rag task (io.kestra.plugin.ai.rag.IngestDocument) embeds the inline playbook stub with gemini-embedding-001 into io.kestra.plugin.ai.embeddings.KestraKVStore, dropping the old index each run.ask_ai task (io.kestra.plugin.ai.rag.ChatCompletion) retrieves matching playbook sections and asks gemini-3.5-flash-lite for a summary, work notes, and proposed resolution with mandatory Risk, Steps, and Verification sections.if_suggestion task (io.kestra.plugin.core.flow.If) checks the answer is not 'N/A', and only then update_servicenow (io.kestra.plugin.servicenow.Update) patches the incident's comments field by sys_id.Building this inside ServiceNow means scripted REST calls, credential juggling, and no visibility into what the model was actually asked. Kestra gives you the ServiceNow plugin (Get, Update) and the AI plugin (IngestDocument, ChatCompletion) as declarative tasks, pluginDefaults so instance credentials are declared once, secrets kept out of the flow body, conditional branching with If, and per-task logs that capture the retrieved context and model output for every incident. Changing the model provider or vector store is a two-line edit, not a re-integration.
incident table.SERVICENOW_DOMAIN: your instance domain, for example dev12345.service-now.com.SERVICENOW_USERNAME, SERVICENOW_PASSWORD: service account credentials for the ServiceNow plugin.GEMINI_API_KEY: Google Gemini API key for embeddings and chat.SERVICENOW_WEBHOOK_KEY: shared secret guarding the Webhook trigger.build_kb_rag with your real playbooks.sys_id in the webhook body and fetch that exact record instead of the newest one.priority: page on-call through PagerDuty for P1, comment only for lower priorities.Pause approval step before writing back so humans vet AI suggestions during rollout.KestraKVStore for pgvector or Weaviate when the playbook grows.