# Messaging

## CreateMsgDocument

Creates an MSG document based on the provided email parameters.

The generated document represents an email message and may include attachments and inline attachments.

#### **Syntax**

CreateMsgDocument ( From , SentOn , To , CC , BCC , Subject , Body , Attachments , InlineAttachments )

***

#### **Parameters**

**From** *(optional)*\
Sender of the email.\
Type: String

**SentOn** *(optional)*\
Sent date of the email.\
Type: DateTime

**To** *(optional)*\
Recipients of the email.\
Type: String

**CC** *(optional)*\
Carbon copy recipients of the email.\
Type: String

**BCC** *(optional)*\
Blind carbon copy recipients of the email.\
Type: String

**Subject** *(optional)*\
Subject of the email.\
This value is also used as the document name.\
Type: String

**Body** *(optional)*\
Body content of the email.\
Type: String

**Attachments** *(optional)*\
Attachments of the email.\
Type: List\<Document>

**InlineAttachments** *(optional)*\
Inline attachments of the email.

The **FileName** of each Document is used as the content ID.\
A body containing elements that support inline attachments (for example `<img>`) can reference these using the same content ID.

The FileName of each Document must:

* Contain only letters and digits.
* May include the following special characters:\
  `! # $ % & ' * + - / = ? ^ _ { | } ~`
* Dots are allowed, but:
  * Not at the start or end.
  * Not doubled.

Type: List\<Document>

***

#### **Return Type**

Document

## CreateMsgDocumentFromWord

Create MSG-Document based on the parameter From, To, Subject and Body as MHTML (convert from a Word Document).

#### Syntax <a href="#pragma-line-6612" id="pragma-line-6612"></a>

```
Document CreateMsgDocumentFromWord(
    String [From],
    DateTime [SentOn],
    String [To],
    String [CC],
    String [BCC],
    String Subject,
    Document Document,
    List<Document> [Attachments]
)
```

#### Parameters <a href="#pragma-line-6618" id="pragma-line-6618"></a>

***From*** (optional)\
&#x20;Sender of the mail.\
&#x20;*Type: String*

***SentOn*** (optional)\
&#x20;Sent date of the mail.\
&#x20;T*ype: DateTime*

***To*** (optional)\
&#x20;Recipients of the mail.\
&#x20;*Type: String*

***CC*** (optional)\
&#x20;CC of the mail.\
&#x20;*Type: String*

***BCC*** (optional)\
&#x20;BCC of the mail.\
&#x20;*Type: String*

***Subject***\
&#x20;Subject of the mail (also used as the Document name).\
&#x20;*Type: String*

***Document***\
&#x20;The Word Document used as the Body.\
&#x20;*Type: Document*

***Attachments*** (optional)\
&#x20;Attachments of the mail.\
&#x20;*Type: List\<Document>*

**Return Type**\
Document

## GetMailInstance

Get E-Mail object based on the MSG-Document.

#### Syntax <a href="#pragma-line-6658" id="pragma-line-6658"></a>

```
GetMailInstance ( Document )
```

#### Parameters <a href="#pragma-line-6664" id="pragma-line-6664"></a>

***Document***\
&#x20;The MSG-Document.\
&#x20;Type: Document

#### Return Type <a href="#pragma-line-6671" id="pragma-line-6671"></a>

Object

## GetMsgProperties

Reads the properties of the MSG file passed in the Document parameter.

#### Syntax <a href="#pragma-line-6680" id="pragma-line-6680"></a>

```
GetMsgProperties ( Document )
```

#### Parameters <a href="#pragma-line-6686" id="pragma-line-6686"></a>

***Document***\
&#x20;Document object containing an MSG file.\
&#x20;Type: Document

#### Return Type <a href="#pragma-line-6693" id="pragma-line-6693"></a>

Dictionary\<Any,Any>

## MergeMsgDocuments

Merges MSG files to create a document preserving embedded images.

#### Syntax

```
MergeMsgDocuments ( [Prepend] , Target [, Append] )
```

#### Parameters

***Prepend*** (optional)\
The MSG-Document to prepend to the target.\
Type: Document

**Target** \
The MSG-Document that another MSG-Documents is appended and/ or prepended to.\
Type: Document

***Append*** (optional)\
The MSG-Document to append to the target.\
Type: Document

**Return Type**\
Document

## Notify

Notifies an User with a Subject and a text.

#### Syntax <a href="#pragma-line-6702" id="pragma-line-6702"></a>

```
Notify ( To , Subject , Body )
```

#### Parameters <a href="#pragma-line-6708" id="pragma-line-6708"></a>

**To**\
&#x20;ID of the user which will be notified.\
&#x20;Type: Guid

**Subject**\
&#x20;Title of the notification.\
&#x20;Type: String

**Body**\
&#x20;Content text of the notification.\
&#x20;Type: String

**Return Type**\
Void

## SendMessage

Sends a message with a title Subject and content Body to a person To from a person From.

#### Syntax <a href="#pragma-line-6732" id="pragma-line-6732"></a>

```
SendMessage ( From , To , Subject , Body )
```

#### Parameters <a href="#pragma-line-6738" id="pragma-line-6738"></a>

**From**\
&#x20;Email address of the sender.\
&#x20;Type: String

**To**\
&#x20;Email addresses of the receivers.\
&#x20;Type: String

**Subject**\
&#x20;Title of the message.\
&#x20;Type: String

**Body**\
&#x20;Content text of the message.\
&#x20;Type: String

**Return Type**\
Void

## SendMsgDocument

Send an E-Mail using the platform account based on the MSG-Document

#### Syntax <a href="#pragma-line-6766" id="pragma-line-6766"></a>

```
SendMsgDocument ( Document )
```

#### Parameters <a href="#pragma-line-6772" id="pragma-line-6772"></a>

**Document**\
&#x20;The E-Mail to send.\
&#x20;Type: Document

**Return Type**\
Object

## SetMsgProperties

Copies the MSG-Document and set the properties of the new MSG-File to the values specified in the parameter MsgProperties.

#### Syntax <a href="#pragma-line-6788" id="pragma-line-6788"></a>

```
SetMsgProperties ( Document , MsgValues )
```

#### Parameters <a href="#pragma-line-6794" id="pragma-line-6794"></a>

***Document***\
&#x20;Document containing an MSG file.\
&#x20;Type: Document

***MsgValues***\
&#x20;The values to set.\
&#x20;Type: Dictionary\<Any,Any>

**Return Type**\
Document

## SharedLinkInstance

Creates an URL link for an instance.

#### Syntax <a href="#pragma-line-6814" id="pragma-line-6814"></a>

```
SharedLinkInstance ( Object )
```

#### Parameters <a href="#pragma-line-6820" id="pragma-line-6820"></a>

***Object***\
&#x20;Object which is used as basis of the link.\
&#x20;Type: Object

#### Return Type <a href="#pragma-line-6827" id="pragma-line-6827"></a>

String

## TransformMsgDocument

Build an MSG-Document representing a Reply, ReplyAll or Forward-Message to the MSG-Document passed as a parameter.

#### Syntax <a href="#pragma-line-6836" id="pragma-line-6836"></a>

```
TransformMsgDocument ( Document [, TransformationType] )
```

#### Parameters <a href="#pragma-line-6842" id="pragma-line-6842"></a>

***Document***\
&#x20;The Document to transform.\
&#x20;Type: Document

***TransformationType*** (optional)\
&#x20;Type of the transformation: Reply, ReplyAll or Forward.\
&#x20;Type: String

#### Return Type <a href="#pragma-line-6857" id="pragma-line-6857"></a>

Document


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tivity.one/building-an-application/execution/scripting/functions/messaging.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
