KosmoKrator

email

Amazon SES Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the Amazon SES KosmoKrator integration.

6 functions 4 read 2 write Bearer token auth

Lua Namespace

Agents call this integration through app.integrations.amazon_ses.*. Use lua_read_doc("integrations.amazon-ses") inside KosmoKrator to discover the same reference at runtime.

Agent-Facing Lua Docs

This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.

Amazon SES — Lua API Reference

send_email

Send an email via Amazon SES. Supports simple emails and template-based emails.

Parameters

NameTypeRequiredDescription
from_email_addressstringyesSender email address (must be verified in SES)
destinationobjectyesRecipient addresses: { ToAddresses: {}, CcAddresses: {}, BccAddresses: {} }
subjectstringno*Email subject line. Required unless using a template.
html_bodystringnoHTML content of the email body
text_bodystringnoPlain text content of the email body
template_namestringno*SES template name. If provided, subject/html_body/text_body are ignored.
template_dataobjectnoKey-value pairs for template variable substitution
reply_to_addressesarraynoReply-to email addresses
configuration_set_namestringnoSES configuration set for tracking and analytics

* Either subject or template_name must be provided.

Examples

Send a simple email

local result = app.integrations["amazon-ses"].send_email({
  from_email_address = "[email protected]",
  destination = {
    ToAddresses = { "[email protected]" }
  },
  subject = "Welcome!",
  html_body = "<h1>Welcome to our service</h1><p>Thanks for signing up!</p>",
  text_body = "Welcome to our service. Thanks for signing up!"
})

print("Message ID: " .. result.message_id)

Send a template-based email

local result = app.integrations["amazon-ses"].send_email({
  from_email_address = "[email protected]",
  destination = {
    ToAddresses = { "[email protected]" }
  },
  template_name = "welcome-email",
  template_data = { name = "John", company = "Acme" }
})

print("Message ID: " .. result.message_id)

get_template

Retrieve an email template by name.

Parameters

NameTypeRequiredDescription
namestringyesThe template name

Example

local result = app.integrations["amazon-ses"].get_template({
  name = "welcome-email"
})

print("Subject: " .. result.TemplateContent.Subject)
print("HTML: " .. result.TemplateContent.Html)

list_templates

List all email templates in Amazon SES.

Parameters

NameTypeRequiredDescription
page_sizeintegernoMax templates per page (default: 10, max: 100)
next_tokenstringnoPagination token from a previous response

Example

local result = app.integrations["amazon-ses"].list_templates({
  page_size = 20
})

for _, tmpl in ipairs(result.TemplatesMetadata) do
  print(tmpl.TemplateName .. " (created: " .. tmpl.CreatedTimestamp .. ")")
end

create_template

Create a new email template with optional substitution variables.

Parameters

NameTypeRequiredDescription
template_namestringyesUnique name for the template
subjectstringyesSubject line (supports {{variable}} syntax)
html_contentstringnoHTML body (supports {{variable}} syntax)
text_contentstringnoPlain text body (supports {{variable}} syntax)

Example

local result = app.integrations["amazon-ses"].create_template({
  template_name = "order-confirmation",
  subject = "Your order #{{order_id}} is confirmed",
  html_content = "<h1>Hi {{name}}</h1><p>Order #{{order_id}} confirmed.</p>",
  text_content = "Hi {{name}}, Order #{{order_id}} confirmed."
})

print(result.message)

list_suppressions

List email addresses on the suppression list for a configuration set.

Parameters

NameTypeRequiredDescription
configuration_setstringyesConfiguration set name
page_sizeintegernoMax results per page
next_tokenstringnoPagination token from a previous response

Example

local result = app.integrations["amazon-ses"].list_suppressions({
  configuration_set = "my-config-set",
  page_size = 50
})

for _, sup in ipairs(result.SuppressionSummaries) do
  print(sup.EmailAddress .. " — reason: " .. sup.Reason)
end

get_current_user

Get the currently authenticated user. Useful for verifying credentials.

Parameters

None.

Example

local result = app.integrations["amazon-ses"].get_current_user({})

print("User: " .. (result.username or "unknown"))

Multi-Account Usage

If you have multiple Amazon SES accounts configured, use account-specific namespaces:

-- Default account (always works)
app.integrations["amazon-ses"].send_email({...})

-- Explicit default (portable across setups)
app.integrations["amazon-ses"].default.send_email({...})

-- Named accounts
app.integrations["amazon-ses"].production.send_email({...})
app.integrations["amazon-ses"].marketing.send_email({...})

All functions are identical across accounts — only the credentials differ.

Raw agent markdown
# Amazon SES — Lua API Reference

## send_email

Send an email via Amazon SES. Supports simple emails and template-based emails.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `from_email_address` | string | yes | Sender email address (must be verified in SES) |
| `destination` | object | yes | Recipient addresses: `{ ToAddresses: {}, CcAddresses: {}, BccAddresses: {} }` |
| `subject` | string | no* | Email subject line. Required unless using a template. |
| `html_body` | string | no | HTML content of the email body |
| `text_body` | string | no | Plain text content of the email body |
| `template_name` | string | no* | SES template name. If provided, subject/html_body/text_body are ignored. |
| `template_data` | object | no | Key-value pairs for template variable substitution |
| `reply_to_addresses` | array | no | Reply-to email addresses |
| `configuration_set_name` | string | no | SES configuration set for tracking and analytics |

\* Either `subject` or `template_name` must be provided.

### Examples

#### Send a simple email

```lua
local result = app.integrations["amazon-ses"].send_email({
  from_email_address = "[email protected]",
  destination = {
    ToAddresses = { "[email protected]" }
  },
  subject = "Welcome!",
  html_body = "<h1>Welcome to our service</h1><p>Thanks for signing up!</p>",
  text_body = "Welcome to our service. Thanks for signing up!"
})

print("Message ID: " .. result.message_id)
```

#### Send a template-based email

```lua
local result = app.integrations["amazon-ses"].send_email({
  from_email_address = "[email protected]",
  destination = {
    ToAddresses = { "[email protected]" }
  },
  template_name = "welcome-email",
  template_data = { name = "John", company = "Acme" }
})

print("Message ID: " .. result.message_id)
```

---

## get_template

Retrieve an email template by name.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `name` | string | yes | The template name |

### Example

```lua
local result = app.integrations["amazon-ses"].get_template({
  name = "welcome-email"
})

print("Subject: " .. result.TemplateContent.Subject)
print("HTML: " .. result.TemplateContent.Html)
```

---

## list_templates

List all email templates in Amazon SES.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page_size` | integer | no | Max templates per page (default: 10, max: 100) |
| `next_token` | string | no | Pagination token from a previous response |

### Example

```lua
local result = app.integrations["amazon-ses"].list_templates({
  page_size = 20
})

for _, tmpl in ipairs(result.TemplatesMetadata) do
  print(tmpl.TemplateName .. " (created: " .. tmpl.CreatedTimestamp .. ")")
end
```

---

## create_template

Create a new email template with optional substitution variables.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `template_name` | string | yes | Unique name for the template |
| `subject` | string | yes | Subject line (supports `{{variable}}` syntax) |
| `html_content` | string | no | HTML body (supports `{{variable}}` syntax) |
| `text_content` | string | no | Plain text body (supports `{{variable}}` syntax) |

### Example

```lua
local result = app.integrations["amazon-ses"].create_template({
  template_name = "order-confirmation",
  subject = "Your order #{{order_id}} is confirmed",
  html_content = "<h1>Hi {{name}}</h1><p>Order #{{order_id}} confirmed.</p>",
  text_content = "Hi {{name}}, Order #{{order_id}} confirmed."
})

print(result.message)
```

---

## list_suppressions

List email addresses on the suppression list for a configuration set.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `configuration_set` | string | yes | Configuration set name |
| `page_size` | integer | no | Max results per page |
| `next_token` | string | no | Pagination token from a previous response |

### Example

```lua
local result = app.integrations["amazon-ses"].list_suppressions({
  configuration_set = "my-config-set",
  page_size = 50
})

for _, sup in ipairs(result.SuppressionSummaries) do
  print(sup.EmailAddress .. " — reason: " .. sup.Reason)
end
```

---

## get_current_user

Get the currently authenticated user. Useful for verifying credentials.

### Parameters

None.

### Example

```lua
local result = app.integrations["amazon-ses"].get_current_user({})

print("User: " .. (result.username or "unknown"))
```

---

## Multi-Account Usage

If you have multiple Amazon SES accounts configured, use account-specific namespaces:

```lua
-- Default account (always works)
app.integrations["amazon-ses"].send_email({...})

-- Explicit default (portable across setups)
app.integrations["amazon-ses"].default.send_email({...})

-- Named accounts
app.integrations["amazon-ses"].production.send_email({...})
app.integrations["amazon-ses"].marketing.send_email({...})
```

All functions are identical across accounts — only the credentials differ.

Metadata-Derived Lua Example

local result = app.integrations.amazon_ses.amazonses_send_email({
  from_email_address = "example_from_email_address",
  destination = "example_destination",
  subject = "example_subject",
  html_body = "example_html_body",
  text_body = "example_text_body",
  template_name = "example_template_name",
  template_data = "example_template_data",
  reply_to_addresses = "example_reply_to_addresses"
})
print(result)

Functions

amazonses_send_email

Send an email via Amazon SES. Specify the sender, recipient(s), subject, and body (HTML and/or plain text). Optionally reference a template or add reply-to addresses.

Operation
Write write
Full name
amazon-ses.amazonses_send_email
ParameterTypeRequiredDescription
from_email_address string yes The sender email address (must be verified in SES). e.g., "[email protected]" or "Sender Name <[email protected]>".
destination object yes Recipient addresses. Object with "ToAddresses" (array), "CcAddresses" (array, optional), and "BccAddresses" (array, optional).
subject string no The email subject line. Required unless using a template.
html_body string no HTML content of the email body.
text_body string no Plain text content of the email body.
template_name string no Name of an existing SES email template to use. If provided, subject/html_body/text_body are ignored.
template_data object no Key-value pairs to substitute into the template placeholders.
reply_to_addresses array no List of email addresses for reply-to.
configuration_set_name string no The SES configuration set to associate with this email for tracking and analytics.

amazonses_get_template

Retrieve an email template from Amazon SES by its name. Returns the template subject, HTML body, and text body.

Operation
Read read
Full name
amazon-ses.amazonses_get_template
ParameterTypeRequiredDescription
name string yes The name of the email template to retrieve.

amazonses_list_templates

List all email templates in Amazon SES. Returns template names and creation timestamps. Supports pagination.

Operation
Read read
Full name
amazon-ses.amazonses_list_templates
ParameterTypeRequiredDescription
page_size integer no Maximum number of templates to return per page (default: 10, max: 100).
next_token string no Pagination token from a previous response to fetch the next page of results.

amazonses_create_template

Create a new email template in Amazon SES. Templates can include HTML and plain text content with optional substitution variables (e.g., {{name}}).

Operation
Write write
Full name
amazon-ses.amazonses_create_template
ParameterTypeRequiredDescription
template_name string yes A unique name for the template.
subject string yes The email subject line. Supports substitution variables (e.g., "Welcome, {{name}}!").
html_content string no HTML body of the template. Supports substitution variables using {{variable}} syntax.
text_content string no Plain text body of the template. Supports substitution variables using {{variable}} syntax.

amazonses_list_suppressions

List email addresses on the suppression list for a specific configuration set in Amazon SES. Suppressed addresses will not receive emails.

Operation
Read read
Full name
amazon-ses.amazonses_list_suppressions
ParameterTypeRequiredDescription
configuration_set string yes The configuration set name to retrieve suppressions for.
page_size integer no Maximum number of suppressed addresses to return per page.
next_token string no Pagination token from a previous response to fetch the next page of results.

amazonses_get_current_user

Get the currently authenticated user for the Amazon SES integration. Useful for verifying credentials and account information.

Operation
Read read
Full name
amazon-ses.amazonses_get_current_user
ParameterTypeRequiredDescription
No parameters.