Sending Communications from a Workflow

Last updated: November 19, 2026

Overview

You can trigger a communication to a gaiia entity — such as an account, user, or commercial account — directly from a workflow using a custom or system communication template. When this step runs, gaiia checks the entity's communication preferences, picks the right channel (email, SMS, or both), and hands the message off for delivery automatically.

In this article, we'll be covering how to send a communication with the Send Communication node, what each input controls, and how to handle a send that fails. Sending through a gaiia GraphQL node still works too: see Use the GraphQL node instead.

 

Understand how it works

Before sending anything, gaiia performs a series of checks:

  • It looks up the entity you specified and retrieves its communication preferences, including which channels are enabled and what language it uses.

  • It finds the template you referenced and checks whether a variation exists for the entity's language.

  • It confirms that at least one enabled template variation matches a channel the entity has turned on (email or SMS).

  • It verifies that the necessary contact information (email address or phone number) is on file for the channels being used.

  • If all checks pass, gaiia passes the message to the notification service and records a delivery history entry.

A successful response means the message was accepted for delivery — not that it has been delivered yet. Whether the message ultimately reaches the recipient is tracked separately in notification history and is not reflected in the workflow step's response.

If any check fails, the step returns an error code and no message is sent. The workflow continues normally — these are expected outcomes, not failures that stop execution.

 

Use the Send Communication node

The Send Communication node sends a communication from a template in one step, with no query to write. It can also attach documents to the email and fill in your own merge tags.

  1. In the workflow editor, open the node library, go to gaiia nodes > Accounts, and add Send Communication.

  2. Set Entity ID to the Global ID of the entity receiving the communication: an account, commercial account, property group, property group manager or user. The communication goes to the entity's primary contact.

  3. Choose the template. Set either Template ID, the Global ID of a custom template, or System Template Slug, the slug of a system template. Both are listed in Settings > Templates > Communications.

    Set one of the two, not both. The node won't start if both or neither are set.

  4. Set the optional inputs you need, described below.

Input

Required

What it does

Entity ID

Yes

The Global ID of the entity receiving the communication.

Template ID

One of the two

The Global ID of a custom communication template.

System Template Slug

One of the two

The slug of a system communication template.

Importance

No

"HIGH" for prioritized delivery, "DEFAULT" for standard delivery.

Description

No

A label for the delivery record, up to 1,000 characters.

Document IDs

No

The Global IDs of up to 10 documents to attach to the email, 10 MB in total. Each must be linked to the entity receiving the communication.

Variables

No

Your own merge tags, as a JSON object such as { "planName": "Fiber 500" }. A tag here replaces a common merge tag of the same name.

When the communication is accepted for delivery, the node outputs { "success": true }.

When the node fails

If gaiia can't send the communication, the node fails with the error code of the reason, such as NO_CONTACT_INFO or ATTACHMENTS_REQUIRE_EMAIL, and nothing is sent. The codes are listed in Understand error responses. When several documents can't be attached, the error message lists each one.

This is different from the GraphQL node, which returns the error and keeps going. Use the Send Communication node's error link or a retry strategy to decide what happens next.

 

Use the GraphQL node instead

You can also send a communication with a gaiia GraphQL node. The node has two input sections: Query and Variables. Use the Query section for the mutation itself and the Variables section to pass in dynamic values from your gaiia data.

The mutation accepts the following inputs:

  1. Entity — the GlobalID of the entity receiving the communication. Supported types: Account, CommercialAccount, PropertyGroup, PropertyGroupManager, User. Archived entities are treated as not found.

  2. Template — the GlobalID of the custom communication template to use. You can use a system template instead, with fromSystemCommunicationTemplateSlug and the template's slug.

  3. Importance (optional) — delivery priority. HIGH for prioritized delivery, DEFAULT for standard. Omitting this defaults to standard. Set it inside metadata.

  4. Description (optional) — a free-text label attached to the delivery record, up to 1,000 characters. Useful for identifying what triggered the send when reviewing communication history. Set it inside metadata.

  5. Document attachments (optional) — documents to attach to the email, set inside metadata as documentAttachments. See Generate and email a document.

  6. Variables (optional) — custom merge tags to use in the template, added to the common merge tags.

 

Example

Here is a working example of how you'd send communications using the gaiia GraphQL API node, assuming the workflow has a Manual trigger on an object. 

You can copy the following into the Query and Variables sections of the node. Update the values in the Variables section to match your workflow's data.

Query

mutation SendCommunication($entityId: GlobalID!, $templateId: GlobalID!) {
  sendCommunication(
    input: {entity: {id: $entityId}, template: {fromCustomCommunicationTemplateId: {templateId: $templateId}}}
  ) {
    errors {
      message
      code
    }
  }
}

Variables

const inputFunction: NodeStateFunction = ({ secrets, state, utils, variables }) => {
  return {
    entityId: state.objectId,
    templateId: 'custom_communication_template_vRe9UrXSw5Yj6v6jsAc5VG'
  };
};

A successful response returns an empty errors array, indicating the message was accepted for delivery. If a pre-flight check fails, one error object is returned with a code and message — and no message is sent.

 

Generate and email a document

A workflow can turn one of your custom document templates into a PDF and email it to the account in two steps. Use two gaiia GraphQL nodes, one after the other.

A. Generate the document

The createDocumentFromTemplate mutation renders a custom document template as a PDF, adds it to the entity's Documents tab and returns the new document's ID.

  • Entity: the GlobalID of an Account, CommercialAccount or PropertyGroup.

  • Template ID: the GlobalID of a custom document template, shown in the template's side panel. The document is rendered in the entity's language, or in your default language when the template has no version in the entity's language.

  • Name (optional): the document's name, up to 255 characters. It defaults to the file name set on the template, and .pdf is added when missing.

  • Variables (optional): custom merge tags to use in the document.

mutation CreateDocument($entityId: GlobalID!, $templateId: GlobalID!) {
  createDocumentFromTemplate(input: {entity: {id: $entityId}, templateId: $templateId}) {
    documentId
    errors {
      message
      code
    }
  }
}

The mutation can return these error codes: ENTITY_NOT_FOUND, TEMPLATE_NOT_FOUND (the template doesn't exist or isn't a document template), NO_TEMPLATE_VARIATION_FOR_LANGUAGE, TEMPLATE_RENDER_FAILED and DOCUMENT_CREATION_FAILED.

B. Email the document

With the Send Communication node, put the returned documentId in its Document IDs input instead of writing the mutation below.

In the next node, pass the returned documentId to sendCommunication in metadata.documentAttachments. If the first node is named create-document, the ID is available as state.steps['create-document'].output.createDocumentFromTemplate.documentId.

mutation SendCommunication($entityId: GlobalID!, $templateId: GlobalID!, $documentId: GlobalID!) {
  sendCommunication(
    input: {entity: {id: $entityId}, template: {fromCustomCommunicationTemplateId: {templateId: $templateId}}, metadata: {documentAttachments: [{documentId: $documentId}]}}
  ) {
    errors {
      message
      code
    }
  }
}

Attachments follow these rules:

  • You can attach up to 10 documents, totaling at most 10 MB.

  • Each document must be linked to the entity receiving the communication.

  • Attachments are sent by email only. A communication that goes out by email and SMS attaches the documents to the email. A communication that would only go out by SMS is refused with ATTACHMENTS_REQUIRE_EMAIL, and nothing is sent.

 

Understand error responses

When a pre-flight check fails, the response includes one of the following error codes. With the GraphQL node, these do not throw an exception or stop workflow execution — the step resolves normally and returns the error in the errors field.

  • ENTITY_NOT_FOUND — The entity GlobalID doesn't match any active record, or the entity has been archived.

  • TEMPLATE_NOT_FOUND — The template GlobalID doesn't match any custom template available in that environment.

  • NO_TEMPLATE_VARIATION_ENABLED — The template exists, but no enabled variation is available for the entity's language. Check that a variation has been created and enabled for that language in your template configuration.

  • NO_MATCHING_ENTITY_PREFERENCE_FOR_CHANNELS — The entity has disabled all channels (email and SMS) that have an enabled template variation. At least one of the entity's enabled channels must match an available variation.

  • NO_CONTACT_INFO — The entity has a channel enabled, but no corresponding contact information on file (no email address for email, no phone number for SMS).

  • DOCUMENT_NOT_FOUND — A document in documentAttachments doesn't exist.

  • DOCUMENT_NOT_LINKED_TO_ENTITY — A document in documentAttachments isn't linked to the entity receiving the communication.

  • ATTACHMENTS_REQUIRE_EMAIL — Documents were attached, but the communication wouldn't be sent by email.

  • ATTACHMENTS_TOO_LARGE — The attached documents total more than 10 MB.

  • EMAIL_TOO_LARGE — The email is too large, usually because its template embeds images instead of hosting them.

  • TEMPLATE_RENDER_FAILED — The template couldn't be rendered, usually because of an invalid merge tag.

We recommend reading the errors field in your workflow output to handle these cases explicitly — for example, by branching to a fallback step using a Condition node when an error code is present.