Transactional Messages API

These are the Transactional Messages endpoints of the Keila API. For Keila Cloud, the base URL is https://app.keila.io.

All endpoints, unless stated differently, require Bearer authentication.

Transactional Messages are sent to a single recipient and used for things like receipts, account confirmations, or password resets.

post /api/v1/messages

Send a transactional message

Sends a one-off transactional email.

You can use an existing contact as the recipient by supplying the contact_id or external_contact_id field.

Alternatively, you can specify recipient_email to send the message to a recipient who might not be in your contact list. If there is a matching contact in your project, the message will be linked to that contact and contact data will be available in the message.

The message body must either come from the referenced template (via template_id) or be supplied in the request (e.g. mjml_body, html_body, or text_body depending on type).

Request body

  • data object
    • assigns object

      Values made available to Liquid interpolation in the subject and body.

      Example: {"magic_link":"https://example.com/..."}

    • bcc string | string[]

      BCC recipients as an RFC 5322 address list (see cc).

      Example: "jane@example.com"

    • cc string | string[]

      CC recipients as an RFC 5322 address list, e.g. Jane <jane@example.com>, john@example.com. May also be given as a JSON array of such strings.

      Example: "Jane <jane@example.com>, john@example.com"

    • contact_id string

      Example: "nc_12345"

    • external_contact_id string

      Example: "customer-1234"

    • html_body string

      Example: "<p>Hi {{ contact.first_name }}, thanks for your order.</p>"

    • html_content object

      Map of named content slots for HTML templates that declare slots.

      Example: {"main":"<p>Hi {{ contact.first_name }}!</p>"}

    • mjml_body string

      Example: "<mjml><mj-body><mj-section><mj-column><mj-text>Hi!</mj-text></mj-column></mj-section></mj-body></mjml>"

    • mjml_content object

      Map of named content slots for MJML templates that declare slots.

      Example: {"main":"<mj-section><mj-column><mj-text>Hi {{ contact.first_name }}!</mj-text></mj-column></mj-section>"}

    • recipient_email string

      Example: "jane.doe@example.com"

    • recipient_name string

      Example: "Jane Doe"

    • sender_id string required

      Example: "ms_12345"

    • subject string

      Example: "Your order is confirmed"

    • template_id string

      Example: "ntpl_12345"

    • text_body string

      Example: "Hi {{ contact.first_name }}, thanks for your order."

    • text_content object

      Map of named content slots for text templates that declare slots.

      Example: {"main":"Hi {{ contact.first_name }}!"}

    • type "text" | "html" | "mjml" required

      Example: "html"

Responses

200 Message response

  • data object
    • id string

      Message ID

      Example: "nmr_12345"

    • recipient_email string

      Example: "jane.doe@example.com"

    • subject string

      Example: "Your order is confirmed"

post /api/v1/messages/actions/render

Render a transactional message

Renders a transactional message without sending it and returns the rendered subject, html_body, and text_body.

Takes the same parameters as the endpoint for sending a message.

Request body

  • data object
    • assigns object

      Values made available to Liquid interpolation in the subject and body.

      Example: {"magic_link":"https://example.com/..."}

    • bcc string | string[]

      BCC recipients as an RFC 5322 address list (see cc).

      Example: "jane@example.com"

    • cc string | string[]

      CC recipients as an RFC 5322 address list, e.g. Jane <jane@example.com>, john@example.com. May also be given as a JSON array of such strings.

      Example: "Jane <jane@example.com>, john@example.com"

    • contact_id string

      Example: "nc_12345"

    • external_contact_id string

      Example: "customer-1234"

    • html_body string

      Example: "<p>Hi {{ contact.first_name }}, thanks for your order.</p>"

    • html_content object

      Map of named content slots for HTML templates that declare slots.

      Example: {"main":"<p>Hi {{ contact.first_name }}!</p>"}

    • mjml_body string

      Example: "<mjml><mj-body><mj-section><mj-column><mj-text>Hi!</mj-text></mj-column></mj-section></mj-body></mjml>"

    • mjml_content object

      Map of named content slots for MJML templates that declare slots.

      Example: {"main":"<mj-section><mj-column><mj-text>Hi {{ contact.first_name }}!</mj-text></mj-column></mj-section>"}

    • recipient_email string

      Example: "jane.doe@example.com"

    • recipient_name string

      Example: "Jane Doe"

    • sender_id string required

      Example: "ms_12345"

    • subject string

      Example: "Your order is confirmed"

    • template_id string

      Example: "ntpl_12345"

    • text_body string

      Example: "Hi {{ contact.first_name }}, thanks for your order."

    • text_content object

      Map of named content slots for text templates that declare slots.

      Example: {"main":"Hi {{ contact.first_name }}!"}

    • type "text" | "html" | "mjml" required

      Example: "html"

Responses

200 Renderer output

  • data object
    • html_body string

      Example: "<p>Hi {{ contact.first_name }}, thanks for your order.</p>"

    • subject string

      Example: "Your order is confirmed"

    • text_body string

      Example: "Hi {{ contact.first_name }}, thanks for your order."