You can't use this until you register with us!




Description

Answer unanswered emails stored in MySQL with Claude: one reply per thread, using thread history and SQL context, then mark them answered with your Post Query.


Purchasing Options



Available Actions

Respond to Emails

Answer the pending emails returned by the Pending Query, one reply per thread.


Variables

Source Parameters
db_connection required

Database the Pending, History, Context, Post and Error Queries run against.

pending_query required

SQL (Jinja) returning the messages to answer. Required columns: id, thread_id, sender, subject, body, email_date. Optional: message_id, reply_to, email_references, recipients, attachment_names, auto_submitted, precedence, list_id. Rows are grouped by thread_id and each thread gets one reply. It must not return rows the Post Query has marked, or they are answered again.

history_query

Optional SQL (Jinja) returning earlier messages of the thread, run per thread. Variables: {{ thread_id }}, {{ history_limit }}. Columns: body and reply_body (one row = message + our answer), or body and direction (inbound/outbound); email_date to order them.

history_limit

Maximum number of earlier history rows given to Claude. 0 disables history.

user_params

JSON values available as {{ name }} in every query and in the Unable to Process Reply.


AI Parameters
ai required

Claude API key used to generate replies.

model required

Claude model that writes the replies.

effort

How much reasoning Claude spends per reply. Higher is more thorough but slower and more expensive; medium suits most support email.

system_prompt required

How the assistant should answer: tone, scope, signature, policies. Used when the Context Query returns no instructions column (or it is empty).

llm_parameters

Optional model settings. Only Max Tokens is used; current Claude models reject temperature/top p/top k, so they are not sent.

context_query

Optional SQL (Jinja) run per thread. A column named instructions (first non-empty value) replaces the Default Instructions; all other columns are given to Claude as reference context. Variables: {{ sender }}, {{ sender_address }}, {{ subject }}, {{ body }}, {{ thread_id }} and the User Defined Parameters. Message values are passed as safe bind parameters: use them as a whole value ('{{ sender_address }}'), not inside a longer string (use CONCAT('%', {{ subject }}, '%')).


Reply Parameters
smtp_connection required

SMTP server used to send the replies.

from_address

Address replies are sent from. Defaults to the SMTP username. Messages from this address are never answered.

send_unable_reply

Send the Unable to Process Reply when a thread cannot be answered. If disabled, only a warning is logged and the Post Query runs with status unable.

unable_reply_template

Reply sent when a thread cannot be answered. Jinja: {{ reason }}, {{ sender }}, {{ subject }} and User Defined Parameters.

dry_run

Generate replies and log them without sending. The Post and Error Queries do not run.


Post Processing Parameters
post_query required

SQL (Jinja) that marks a message as handled, run once per pending row after its thread was answered, refused or skipped. Variables (bind parameters): {{ id }}, {{ message_id }}, {{ thread_id }}, {{ status }} (replied | unable | skipped), {{ reason }}, {{ reply_message_id }}, {{ reply_body }}, {{ reply_to }}, {{ replied_at }}, {{ is_reply_target }} (1 for the message the reply answers).

error_query

Optional SQL (Jinja) run per row when a thread fails (AI or sending error). The rows stay pending and are retried next run. Variables: {{ id }}, {{ message_id }}, {{ thread_id }}, {{ error }}.