---
# System prepended metadata

title: Communication Configuration
tags: [Document Creation, Customisation, Communications, Scripting]

---

# Communication Configuration

This YAML document outlines the configuration for sending out communications through various channels. It specifies the communication details, permissions, scripts, and attachments associated with each channel.

## Communication Configuration Structure

The communication configuration consists of the following sections:

### Communication Information

- **Name**: The name of the communication.
- **Version**: The version of the communication.
- **Author**: The name of the person responsible for the communication.
- **Description**: A brief description of the communication.
- **PermissionRequired**: The permission required for the customer to have opted in for.
- **BusinessArea**: The business area associated with the communication.
- **BusinessProcess**: The business process associated with the communication.

### Channel Configuration

The communication configuration includes settings for different communication channels:

- **Email**: Configuration for sending emails.
  - **Subject**: The subject of the email (supports handlebar variable replacement).
  - **ContentTemplate**: The path to the template file for the email content.
  - **Attachments**: List of attachments to include in the email.
    - **Name**: The name of the attachment.
    - **DocumentPath**: Optional. Path to the document to be generated for this attachment.
    - **DocumentParameterName**: Optional. If the attachment is a base64 string from a parameter.
    - **FileName**: The name of the attached file.

- **WhatsApp**: Configuration for sending WhatsApp messages.
  - **SenderId**: WhatsApp SenderId used for sending the communication.
  - **PermissionRequired**: The permission required for sending marketing WhatsApp messages.
  - **Body**: The text to be sent to WhatsApp (supports handlebar tags).
  - **Attachments**: List of attachments to send to WhatsApp (similar to email).

- **SMS**: Configuration for sending SMS messages.
  - **SenderId**: SMS SenderId used for sending the communication.
  - **PermissionRequired**: The permission required for sending marketing SMS messages.
  - **Body**: The text to be sent to SMS (supports handlebar tags).

- **EntityStorage**: Configuration for storing the communication as an entity.
  - **Entity**: The type of entity for which the communication will be stored.
  - **PermissionRequired**: The permission required for storing the communication.
  - **Body**: The text to be stored as part of the entity (supports handlebar tags).
  - **Attachments**: List of attachments to associate with the stored entity (similar to email and WhatsApp).

### Scripts

- **AssertChannel**: Optional JavaScript script to determine the channel to be used for sending the communication.
- **PreScript**: JavaScript script to prepare information before building the communication.
- **PostScript**: JavaScript script to run after the communication has been sent.

## Sample Configuration

```yaml
Communication:
  - Name: 'Communication Name'
    Version: '0.0.1'
    Author: 'Person Name'
    Description: 'Description of the communication'
    PermissionRequired: 'MarketingComms'
    BusinessArea: ''
    BusinessProcess: ''
    AssertChannel: >
      // JavaScript which will return the channel to be used
    PreScript: >
      // Some JavaScript to prepare information for the communication
    PostScript: >
      // Some JavaScript to run after the communication has been sent
    Channels:
      - Email:
         Subject: 'Text for the subject'
         ContentTemplate: 'Path to template file'
         Attachments:
           - Name: 'Attachment Name'
             DocumentPath: 'Optional. Path to document to be generated for this'
             DocumentParameterName: 'Optional. If attachment is a base64 string from a parameter'
             FileName: 'Name of file that will be attached'
      - WhatsApp:
          SenderId: 'WhatsApp SenderId'
          PermissionRequired: 'MarketingWhatsApp'
          Body: 'Text to be sent to WhatsApp'
          Attachments:
            - Name: 'Attachment Name'
              DocumentPath: 'Optional. Path to document to be generated for this'
              DocumentParameterName: 'Optional. If attachment is a base64 string from a parameter'
              FileName: 'Name of file that will be attached'
      - SMS:
            SenderId: 'Sms SenderId'
            PermissionRequired: 'MarketingSMS'
            Body: 'Text to be sent to SMS'
      - EntityStorage:
          Entity: 'Customer'
          PermissionRequired: 'MarketingComms'
          Body: 'Text to be stored with the entity'
          Attachments:
            - Name: 'Attachment Name'
              DocumentPath: 'Optional. Path to document to be generated for this'
              DocumentParameterName: 'Optional. If attachment is a base64 string from a parameter'
              FileName: 'Name of file that will be attached'
    