We Use Cookies

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with this.

See our cookie policy.

Automation Action: Message Store Operation

Read a list of message store messages from/to & to/from two email addresses, search the message store and other operations.

ThinkAutomation stores a copy of each processed message in the Message Store. This action can be used to read an email 'conversation'. This action can also be used to drop the current message, to pause/resume message sources and to perform a message store search.

A conversation is a list of messages in date order (newest first), between two email addresses (either from/to or to/from) where the subject is the same (ignoring any 'FW:' or 'RE:' prefixes). ThinkAutomation maintains a 'conversationid' index in the Message Store which provides fast conversation lookup.

Select the Message Store Operation:

Get Current Conversation

This operation returns the conversation for the currently executing message.

Get Another Conversation

This operation returns the conversation between two specified email addresses with the same specified subject.

Specify the Between Email Address and And Email Address.

Specify the For Subject.

You can specify the Maximum Items and Maximum Age (Days).

The message store will be searched for all messages where the From and To addresses match either of the Between email addresses and have the same subject (any 'FW:' or 'RE:' subject prefixes will be ignored). Only messages processed within the same Solution will be searched.

In the Return As list select one of:

  • Markdown : A single markdown text string is returned containing all messages.

  • Json : A Json array in the following format:

    {
        "Conversation": [
        {
             "Id": "64918ec290ca1b3ae8d9286c",
            "FromName": "Test",
            "ToName": "ThinkAutomation",
            "Dated": "2023-06-20T11:34:26",
             "Message": "Hello",
            "Attachments": ""
          },
          {
             "Id": "64918ec290ca1b3ae8d9286d",
            "FromName": "ThinkAutomation",
            "ToName": "Test",
            "Dated": "2023-06-20T11:56:12",
             "Message": "Hi There!",
            "Attachments": ""
          }
        ]
    }                
  • CSV : CSV text in the following format:

    Id,FromName,ToName,Dated,Message,Attachments
    64918ec290ca1b3ae8d9286c,Test,ThinkAutomation,2023-06-20 11:34:26,Hello,
    64918ec290ca1b3ae8d9286d,ThinkAutomation,Test,2023-06-20 11:56:12,Hello There!,                
  • HTML: HTML text in the following format:

    <div style="display:flex;flex-direction:column;">
      <div style="display:flex;justify-content:flex-start;margin-bottom:5px;">
        <div style="border:1px solid #dee2e6;border-radius:6px;max-width:70%;padding:5px;">
          <p style="margin-top:0;margin-bottom:3px;font-size:11px;color:#595c5f;">Test @ 20/06/2023 11:34</p>
         Hello
        </div>
      </div>
      <div style="display:flex;justify-content:flex-end;margin-bottom:5px;">
        <div style="border:1px solid #dee2e6;border-radius:6px;max-width:70%;padding:5px;">
          <p style="margin-top:0;margin-bottom:3px;font-size:11px;color:#595c5f;">ThinkAutomation @ 20/06/2023 11:56</p>
          Hello There!
        </div>
      </div>
    </div>                

Select the variable to receive the results from the Assign To list. The result will be blank if there are no messages.

You can use this action if you need to display or send a transcript of a conversation between two email addresses with the same subject.

Getting A Conversation For Web Chat Form Messages.

Enable the Is Web Chat option if you want to read messages saved via the Web Chat message source. For messages saved via a web chat message source, the 'bot' reply is saved to the Automation Return value rather than being a separate message store message. If you enable this option the Automation Return value for each message will be added as the 'reply' message.

Drop Message

This operation will flag the currently executing message to be deleted from the message store database after the Automation completes.

Drop Current Conversation

This operation will delete all previous message store messages where the from/to or to/from email addresses and subject match the currently executing message. The current message will not be deleted. The Assign To variable will receive the number of messages deleted.

Drop Another Conversation

This operation deletes all previous message store messages between two email addresses with the same subject. Specify the Between Email Address and And Email Address. Specify the For Subject. The current message will not be deleted. The Assign To variable will receive the number of messages deleted.

Pause Or Resume Message Source

This operation can be used to pause or resume any Message Source within the same Solution. Select the Message Source from the list, this must be within the same Solution as the Automation. The Pause/Resume Message Source operations can be used to conditionally pause/resume Message Sources in addition to any Schedule assigned to the Message Source.

Get Message Source Status

This operation can be used to check the status of any Message Source within the same Solution. Select the Message Source from the list, this must be within the same Solution as the Automation. Select the variable to receive the status from the Assign Status To list. The status returned will be one of: 'Active', 'Disabled', 'Paused' or 'Missing' (if the Message Source has been deleted).

Search Message Store

This operation can be used to search the Message Store for any messages within the same Solution. A list of matching messages will be returned. The search results can be returned as a HTML table, allowing you to setup a message archive search system in conjunction with a Web Form.

You can then specify one or more search values. All search values can contain %variable% replacements.

You can search any or all of the following (if multiple search values are used then ALL must match):

  • Subject, From Address, To Address, Keywords Or Attachment Names Containing - specify a value to search against subject, from/to addresses or attachment names (leave blank for all). You can use space or the + operator to search for multiple terms (eg: sales+order would return items containing 'sales' AND 'order'). If a search term itself contains a + character then you should enclose it in double quotes. This parameter can be used to use a single search term for subject, keywords, from/to, attachment names.
  • Subject Containing - specify a value to search against the subject (leave blank for all).
  • From Address Containing - specify a value to search against the 'from' address (leave blank for all).
  • To Address Containing - specify a value to search against the 'to' address (leave blank for all).
  • Automation Return Value Containing - specify a value to search against the automation return value (leave blank for all).
  • OR Message Ids In - specify a %variable% containing a list of Message Ids. This can be used in conjunction with the Full Text Search action in order to perform a full text search on message body text. You would update a full text search collection using the incoming email body on a separate automation.

The message store will be searched for all messages matching the above. Only messages processed within the same Solution will be searched.

You can also optionally specify the From Date and To Date. These can also be %variable% replacements. If no dates are specified then all messages are searched.

If the Distinct option is enabled, then only messages with unique From/To/Subject and size are returned.

You can specify a Message Source - if you only want to search messages received by a specific Message Source. If no Message Source is specified in the all messages within the Solution will be searched (except the Message Source of the search Automation itself).

You can specify the Maximum Items and Maximum Age (Days).

The URL returned in the results is a link to view the full message in a browser. Enable the Always Use Local Links option to return local links. If this option is not enabled then the message links will be public (served via the API Gateway).

In the Return As list select one of:

  • Markdown : A single markdown text string is returned containing all messages.

  • Json : A Json array in the following format:

    {
      "Items": [
        {
          "Id": "66de9057c937df0bf66395ae",
          "From": "someone@test.com",
          "To": "myname@mydomain.com",
          "Dated": "2024-09-09T06:06:15",
          "Importance": "N",
          "Subject": "Test Message",
          "Size": 6345,
          "Attachments": "Document.pdf",
          "ReturnValue": "test",
          "Url": "https://api.thinkautomation.com/xxx/viewmessage?id=xxx"
        },
        {
          "Id": "66de9025c937df0bf6639583",
          "From": "someone@test.com",
          "To": "myname@mydomain.com",
          "Dated": "2024-09-09T06:05:25",
          "Importance": "N",
          "Subject": "Another Test Message",
          "Size": 3435,
          "Attachments": "",
          "ReturnValue": "test",
          "Url": "https://api.thinkautomation.com/xxx/viewmessage?id=xxx"
        }
      ]
    }                
  • CSV : CSV text in the following format:

    Id,From,To,Dated,Importance,Subject,Size,Attachments,ReturnValue,Url
                    
  • HTML Table: HTML text in the following format:

    <table id='taMessages'>
      <thead>
        <tr>
          <th id='taMC1'>View</th>
          <th id='taMC2'>&#x1f4ce;</th> <!--attachment icon-->
          <th id='taMC3'>From</th>
          <th id='taMC4'>To</th>
          <th id='taMC5'>Date</th>
          <th id='taMC6'>&#x2757;</th>  <!--important icon-->
          <th id='taMC7'>Size</th>
          <th id='taMC8'>Subject</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td><a href='https://api.thinkautomation.com/xxx/viewmessage?id=xxx' target='_blank' rel='nofollow'>View</a></td>
          <td>&#x1f4ce;</td>
          <td>from@test.com</td>
          <td>to@test.com</td>
          <td>09/09/2024 07:06</td>
          <td></td>
          <td>10.9KB</td>
          <td>Test Subject/td>
        </tr>
      </tbody>
    </table>                
  • HTML Table (Bootstrap) : Same as the HTML Table option but with Bootstrap styles added.

Select the variable to receive the results from the Assign To list. The result will be blank if there are no messages.

You can use this action if you need to process or display the results of a Message Store search. The Url property of the returned results is a link to view the message detail (body).