Watches Freshdesk for resolved tickets, emails each requester a CSAT survey from Gmail, and writes the score and the verbatim back onto the ticket, every call on the support rep's own delegated OAuth.
This agent runs every Freshdesk call through Scalekit Agent Auth with a delegated user token — no helpdesk API key in env. Classification uses the Google ADK framework with Gemini. Wire up SCALEKIT_ENV_URL, SCALEKIT_CLIENT_ID, SCALEKIT_CLIENT_SECRET, FRESHDESK_IDENTIFIER, and GOOGLE_ADK_API_KEY in .env and run.
import json, os
STATE_FILE = "processed_tickets.json"
def load_state() -> set:
try:
if os.path.exists(STATE_FILE):
data = json.load(open(STATE_FILE))
return set(data) if isinstance(data, list) else set()
except (OSError, json.JSONDecodeError):
log.warning("State file unreadable, starting fresh")
return set()
processed = load_state()
def _sk_exec(tool_name, params):
result = sk.actions.execute_tool(
tool_input=params,
tool_name=tool_name,
identifier=FRESHDESK_IDENTIFIER,
connection_name=FRESHDESK_CONNECTION,
)
data = result.data or {}
return data["array"] if isinstance(data, dict) and "array" in data else dataTwo things you'd otherwise build: a Freshdesk polling loop and a Gemini decision agent. The sample wires them together with a local state file so re-runs are idempotent. Works with Google ADK out of the box.
You have the Scalekit authstack plugin installed (AgentKit + SaaSKit skills and MCP auth). Before coding, auto-load the AgentKit skills relevant to connectors (Freshdesk) and use the Scalekit MCP server to validate tool calls instead of hand-written API logic.
Poll Freshdesk for resolved tickets, fetch each ticket's CSAT survey, and classify the feedback with an LLM. Based on the decision, either thank the customer and close the ticket or apologize and reopen it via the appropriate AgentKit connector tool (idempotent — skip already-processed tickets). Ask before using write tools (replying to or updating any ticket); polling and classifying run without asking.
Each one runs on delegated identity, scoped per user.