ThinkAutomation is a workflow automation solution designed to streamline and automate on-premises and cloud-based business processes that are triggered by specific events or messages from different sources. Events can be trigged by incoming email, database changes, webhooks, web form & chat bot submissions, incoming SMS & Teams messages, documents & local file changes and other message sources.
When a message is received ThinkAutomation executes one or more workflow Automations. Automations are created using an easy to use drag-and-drop, low-code interface to automate simple or complex processes. Automations can perform many Actions that use data parsed and extracted from the incoming message. Actions include updating databases, CRM systems and cloud services, sending outgoing emails, Teams & SMS messages, document processing, custom scripting, AI integration and much more. Over 130 built-in actions are included, plus ThinkAutomation can be extended with Custom Actions that you can create yourself or download from our on-line library.
ThinkAutomation stores each processed message in the Message Store. The Message Store contains a copy of each message processed along with a log of Automation actions.
The ThinkAutomation Studio is used to setup your Message Sources, to design and test your Automations and to view the Message Store & logs. Multiple Message Sources and Automations can be grouped into a Solution. Any number of Solutions can be created. Once you have configured your Message Sources and Automations the ThinkAutomation Studio can be closed. Messages are processed in the background by the ThinkAutomation Services.
ThinkAutomation is a self-managed solution, which means it can be deployed either on-premises or on a private-cloud virtual machine of your choice. This gives you control over the hosting environment, reduces running costs, and enables the processing of private and sensitive data.
Visit: www.ThinkAutomation.com for more information.
On-premises Or Private-Cloud Installation
ThinkAutomation is a self-managed application that runs in your own environment. Access and update on-premises data. This is useful for businesses with sensitive data, such as government agencies, financial, healthcare or other regulated industry.
Deployment Flexibility
Install ThinkAutomation on a computer within your own environment (on-premises) or install it on a cloud hosted virtual machine on any cloud provider of your choice.
Connect To The Cloud
Connect Automations to public web forms. Connect to and update cloud services. Provide a secure gateway to on-premises data.
AI Functionality
Create ChatGPT or OptimaGPT powered chat bots and automated email responders that can use AI along with a local private knowledge store. Also use AI to classify, summarize, anonymize, translate and analyze data in your Automations.
Low Cost
Create any number of Automations. Save time & costs by automating business processes. With simple fixed pricing, process unlimited messages without additional costs. With many other Automation platforms pricing increases based on usage. With ThinkAutomation you are only limited by the processing power of the host PC.
Extensible
Extend the product with your own custom automation actions. Custom actions include a UI builder for setting action properties and a C# or VB.NET code editor for the automation action execution code. Custom actions can be reused on any of your Automations.
Public Endpoints To On-Premises Automations
Create publicly accessible API, Web Form and Web Chat endpoints that execute Automations on your private on-premises ThinkAutomation instance. Public requests are routed via the ThinkAutomation gateway, which provides a secure tunnel from public endpoints to your ThinkAutomation server. Your ThinkAutomation server does not need to be Internet facing.
ThinkAutomation is available in the following editions: Basic, Standard, Professional & Enterprise:
Basic | Standard | Professional | Enterprise | |
---|---|---|---|---|
Max Message Sources | 5 | Unlimited ± | Unlimited ± | Unlimited ± |
Max Automations | 100 | Unlimited ± | Unlimited ± | Unlimited ± |
Max Messages Processed Per Day | 500 | Unlimited ± | Unlimited ± | Unlimited ± |
Max Web API Messages Received Per Day | 500 | 1000 | 5000 * | Unlimited ± |
Max Studio & Desktop Connector Users | 1 | 2 | 10 ** | 10 ** |
Use Studio & Desktop Connector On Remote Computers | No | Yes | Yes | Yes |
Custom Action Designer & Execute Script Action | No | No | Yes | Yes |
Supports Distributed Setup | No | No | Yes | Yes |
Supports Failover Server Option | No | No | Yes | Yes |
Supports Self-Hosted Web API Gateway Server | No | No | Yes | Yes |
Remove Branding from Web Forms and Web Chat forms | No | No | Yes | Yes |
Process data on behalf of external organizations | No | No | No | Yes |
± Limited by available memory and processor capacity only. See: Local Server Limitations.
* Can be increased at additional cost or you can use your own self-hosted instance of the ThinkAutomation Gateway Server which has no message limits. ** Can be increased at additional cost if required.
The Evaluation Edition includes all features of the Professional Edition. The Evaluation Edition is free and will operate for 30 days. You can register an existing Evaluation Edition with a purchased serial number and retain your configuration settings.
A Developer Edition is also available. This is a free edition aimed at developers who want to create solutions for other businesses. The Developer Edition is not licensed for commercial or production use and has a limit of 200 processed messages per day. Solutions created with the Developer Edition can be deployed to other ThinkAutomation instances.
For AI-powered features, ThinkAutomation can use either OpenAI’s ChatGPT or Parker Software's OptimaGPT - an on-premises or private cloud-hosted AI server. OptimaGPT offers localized AI processing, ideal for companies needing to avoid external data transfer due to privacy regulations. OptimaGPT allows organizations in regulated sectors to deploy AI securely while meeting data protection and compliance needs.
For more details on OptimaGPT, see OptimaGPT.
Parker Software provides professional services to assist with configuring your Automations, creating Custom Actions and for product training. Please see: www.thinkautomation.com/professionalservices for more information.
All ThinkAutomation subscriptions include access to support resources, free product updates and access to the Custom Action Library for the life of your subscription.
Support is available via our online forum at https://helpdesk.parkersoftware.com. We also offer premium support with direct access to support technicians via email, live chat and telephone.
Parker Software offers reseller pricing, training & support for partners who want to provide ThinkAutomation based business process automation solutions to their customers. Please contact us for details.
Run the ThinkAutomation.exe setup to install. Once installed, use the ThinkAutomation Studio to complete the setup. You will be asked to register the product, to provide a password for the ThinkAutomation Administrator user and to create the Message Store database.
ThinkAutomation requires Windows 10/11 (64bit) or Windows Server 2022, 2019 or 2016 (build 1709 or higher) with 1GB of free disk space and 2GB minimum ram (8GB or higher is recommended). It can run on on-premises or on a cloud hosted virtual machine.
ThinkAutomation requires .NET Framework 4.8. This is installed by default on Windows 10/11 & Windows Server 2019/2022.
ThinkAutomation stores each processed message in the Message Store database. The Message Store contains a copy of each message processed along with a log of Automation actions. You can view the Message Store using the ThinkAutomation Studio. The Message Store will be created when ThinkAutomation is run for the first time.
You can use the built-in SQLite database for the Message Store, or an external Microsoft SQL Server, MySQL, PostgreSQL or MongoDB database.
The built-in SQLite database provides the simplest configuration and will work on any computer without any additional software. Using an external database may provide better performance.
Type | Details |
---|---|
SQL Server | Use Microsoft SQL Server 2012 or higher. Any edition (including Express) can be used. Note: SQL Server Express edition has a limit of 10GB per database. |
MongoDB | Use a local or remote MongoDB instance. MongoDB will provide high performance but requires more memory. Should not be used on machines with 8GB or less ram when using a local instance. |
MySQL | Use MySQL version 5.7 or higher (or Maria DB). |
PostgreSQL | Use PostgreSQL version 8 or higher. |
SQLite | Use the built-in SQLite database. Requires no additional components. |
ThinkAutomation installs three Windows services along with the ThinkAutomation Studio.
Service | Details |
---|---|
ThinkAutomationServer | Maintains the message queue, message store database & metadata and serves data to the other services and Studio users. |
ThinkAutomationMessageReader | Reads messages from the Message Sources and sends new messages to the server queue. |
ThinkAutomationMessageProcessor | Executes Automations for each message received from the server queue. |
Each ThinkAutomation Service can run on the same computer, or separate computers in a distributed configuration (Professional Edition). All communication between the services are secure.
The ThinkAutomation Studio is used to configure your Message Sources and to build and test your Automations. It can also be used to view the Message Store of processed messages and to configure Custom Actions. The ThinkAutomation Studio can be run on the same computer running the ThinkAutomation Server or on any remote computer that can connect to it.
The ThinkAutomation Studio does not need to be left running for messages to be processed.
When you run the ThinkAutomation Studio for the first time you will be asked to register your license (or start an evaluation), setup your System Administrator login password and configure the Message Store database.
A default user with username 'Admin' will be created with your specified password. Use the 'Admin' user to login. You can create additional users if required using the Server Settings.
A default Solution will be created using the company name used during registration. You can create a new Solution using the New Solution button.
The ThinkAutomation Desktop Connector is a stand-alone application that you can optionally install on multiple computers on your network.
Users can use the ThinkAutomation Desktop Connector to manually execute Automations by sending messages or by dragging and dropping files, attachments and Outlook Messages. For example, you may have an Automation that generates a quotation PDF, sends the quotation to the customer and records it in your CRM system. The ThinkAutomation Desktop Connector could be installed on all the sales team computers. Sales team members can then simply drag and drop quote request emails on to the relevant Automation. Automations are executed immediately by the ThinkAutomation server and the results displayed.
The ThinkAutomation Desktop Connector cannot be used to edit Automations or make any other configuration changes.
See: The ThinkAutomation Desktop Connector Application for more information.
Message Sources and Automations are grouped into a Solution. You can create multiple Solutions. A default Solution will be created when you run the ThinkAutomation Studio for the first time. The name of the default Solution will be set to the company name you used when you registered ThinkAutomation. The currently selected Solution can be changed by clicking the Select Solution button on the right-hand side of the Studio ribbon. You can create a new Solution by clicking the New Solution button.
Solutions can be deployed to another ThinkAutomation instance. This allows you to develop a Solution on one ThinkAutomation instance and then deploy it to another. Solution Access rights can be configured for separate users. If you have multiple Studio or Desktop Connector users you can restrict access to specific Solutions.
A Message Source defines how ThinkAutomation will receive messages to process. You can create multiple Message Sources to receive messages from various sources. Each Message Source is connected to an Automation. When a message is received the message content is passed to the assigned Automation for processing. Individual Message Sources can be enabled/disabled or paused. You can also manually execute any Automation by sending it a message directly via the Studio or Desktop Connector.
To create a Message Source click the New Message Source button on the ThinkAutomation Studio ribbon. A Solution must have at least one Message Source.
Enter the Message Source Name and click Next to choose and configure the message source type:
ThinkAutomation can receive and automate messages from the following Message Source Types:
Source | Details |
---|---|
Email - Office 365 | Read emails from an Office 365 or online Outlook account email folder. |
Email - Exchange | Read emails from a Microsoft Exchange account email folder. |
Email - Gmail | Read email items from a Gmail account. |
Email - IMAP | Read emails from an IMAP enabled email account. |
Email - POP3 | Read emails from a POP3 enabled email account. |
Email - SendGrid | Receive new emails received via SendGrid. |
Email - SMTP | Receive emails via the built-in SMTP mail server. |
Web Form | Create a local or publicly accessible web form and receive form submissions for processing. |
Web Chat | Create a local or publicly accessible web form with a conversation-style 'chat' UI. |
Teams | Respond to @mentions from Microsoft Teams channels. |
Database | Monitor a SQL database for new or updated records. |
MongoDB | Monitor a MongoDB collection for new documents. |
File Pickup | Monitor a local folder for new or updated files. |
CSV & Excel Pickup | Monitor an Excel or CSV file for new rows. |
HTTP Get | Monitor a web resource for changes. |
Azure Queue | Monitor an Azure Queue. |
Twilio | Receive incoming SMS messages from Twilio. |
Monitor a Twitter feed for new Tweets. | |
API | A HTTP API for receiving messages from custom sources and external webhooks. |
Web Forms - Custom | Post any of your existing web forms to ThinkAutomation for processing. |
Web Requests | Execute an Automation whenever the Web API URL is requested. |
Microsoft Graph Change | Monitor changes to various entity types in Microsoft Graph (Office 365). |
Static Scheduled | Execute an Automation with a default message at preset times. |
Reads emails from an Office 365 or an online Outlook mailbox folder. Click the Sign In button to sign in to an Office 365 or Outlook account.
Select the Folder to read emails from.
Enable the Delete Processed Messages option to remove emails from the Office 365 folder once they have been processed by ThinkAutomation (optional).
You can also select the Move To Folder option to move processed items to a different folder (optional). You can conditionally move processed messages to a different folder inside an Automation. See: Move Incoming Message action.
The Only Messages Since date entry allows you to specify a date. Any messages with a received date prior to this date will be ignored. The Only Messages From Address entry allows you to specify one or more from addresses. Leave this entry blank to include emails from all senders. You can specify multiple addresses separated by semi-colons. You can also use wildcards (eg: *@somedomain.com).
Access Shared Mailbox
You can optionally read messages from a shared mailbox. Enter the shared mailbox username in the Access Shared Mailbox entry. Click the Get Folders button to read the folders for the shared mailbox. If the Shared Mailbox entry is blank then folders will be displayed for the signed-in user.
Re-Sign In
Depending on your security configuration you may need to re-sign in periodically. In these cases ThinkAutomation will pause the Message Source and send a notification to the ThinkAutomation Studio informing you to sign in again. Open the Message Source using the ThinkAutomation Studio and click the Sign In button again and then Resume the Message Source.
Sync-Status
The Office 365 Message Source works by synchronizing changes since the last time the mailbox was checked (depending on the Schedule you have configured). Only new messages since the last synchronization are downloaded. All messages will be downloaded when the mailbox is accessed for the first time. During Automation development it may be necessary to re-download and reprocess all messages again. To do this, first delete all existing messages from the ThinkAutomation Message Store. Then click the Reset Sync State button on the Message Source properties page. The Reset Sync State button clears the synchronization status for the the message source causing all messages to be re-downloaded. See: Reprocessing Existing Messages.
Note: If the mailbox contains many thousands of messages it may take some time for the first sync to complete.
See Also: Microsoft Logins if you want to use your own App Registration for connecting to Office 365.
Reads emails using Microsoft Exchange Server Web Services (EWS). This works with any on-premises or hosted Exchange Server. Enter your Exchange User Name and Password and the URL and click Connect. If you do not know your Exchange URL, enter the User Name & Password and click Discover. This will attempt to find the URL from the user credentials.
Select the Folder to read emails from. Enable the Delete Processed Messages option to remove emails from the Office 365 folder once they have been processed by ThinkAutomation (optional).
You can also select the Move To Folder option to move processed items to a different folder (optional).
The Only Messages Since date entry allows you to specify a date. Any messages with a received date prior to this date will be ignored. The Only Messages From Address entry allows you to specify one or more from addresses. Leave this entry blank to include emails from all senders. You can specify multiple addresses separated by semi-colons. You can also use wildcards (eg: *@somedomain.com).
This Message Source type is designed for legacy on-premises or hosted Exchange Servers that still support basic auth. If you use Office 365 you should use the Office 365 Message Source which uses modern authentication.
Sync-Status
The Exchange Message Source works by synchronizing changes since the last time the mailbox was checked (depending on the Schedule you have configured). Only new messages since the last synchronization are downloaded. All messages will be downloaded when the mailbox is accessed for the first time. During Automation development it may be necessary to re-download and reprocess all messages again. To do this, first delete all existing messages from the ThinkAutomation Message Store. Then click the Reset Sync State button on the Message Source properties page. The Reset Sync State button clears the synchronization status for the the message source causing all messages to be re-downloaded. See: Reprocessing Existing Messages.
Reads emails from any Gmail mailbox. Click the Sign In button to sign in to Gmail. Select the Folder to download messages from.
Enable the Move Processed Messages To Folder option if you want to move emails to a different Gmail folder (optional). You can conditionally move processed messages to a different folder inside an Automation. See: Move Incoming Message action.
Enable the Delete Processed Messages option to delete emails once they have been processed by ThinkAutomation (optional). If the Permanently Delete option is enabled then emails will deleted permanently, otherwise they will be moved to the Trash folder.
The Only Messages Since date entry allows you to specify a date. Any messages with a received date prior to this date will be ignored. The Only Messages From Address entry allows you to specify one or more from addresses. Leave this entry blank to include emails from all senders. You can specify multiple addresses separated by semi-colons. You can also use wildcards (eg: *@somedomain.com).
Sync-Status
The Gmail Message Source works by synchronizing changes since the last time the mailbox was checked (depending on the Schedule you have configured). Only new messages since the last synchronization are downloaded. All messages will be downloaded when the mailbox is accessed for the first time. During Automation development it may be necessary to re-download and reprocess all messages again. To do this, first delete all existing messages from the ThinkAutomation Message Store. Then click the Reset Sync State button on the Message Source properties page. The Reset Sync State button clears the synchronization status for the the message source causing all messages to be re-downloaded. See: Reprocessing Existing Messages.
Reads emails from a mail server using the IMAP protocol. Enter the IMAP Server address, port, user name & password. Click the Connect button to connect and then select the Folder to read messages from.
You can select to Move or Delete processed messages (optional). You can conditionally move processed messages to a different folder inside an Automation. See: Move Incoming Message action.
If the Mark Processed Messages As Seen option is enabled, ThinkAutomation will set the 'seen' flag on the IMAP server for each processed message. It will also only download 'unseen' messages. This can improve performance, however you should ensure no other user is connecting to the same mailbox with the same credentials and marking messages as seen separately.
The Only Messages Since date entry allows you to specify a date. Any messages with a received date prior to this date will be ignored. The Only Messages From Address entry allows you to specify one or more from addresses. Leave this entry blank to include emails from all senders. You can specify multiple addresses separated by semi-colons. You can also use wildcards (eg: *@somedomain.com).
Sync-Status
The IMAP Source works by synchronizing changes since the last time the mailbox was checked (depending on the Schedule you have configured). Only new messages since the last synchronization are downloaded. All messages will be downloaded when the mailbox is accessed for the first time. During Automation development it may be necessary to re-download and reprocess all messages again. To do this, first delete all existing messages from the ThinkAutomation Message Store. Then click the Reset Sync State button on the Message Source properties page. The Reset Sync State button clears the synchronization status for the the message source causing all messages to be re-downloaded. See: Reprocessing Existing Messages.
Reads emails from a mail server using the POP3 protocol. Enter the POP3 Server address, port, user name & password. Click the Test Connection button to verify the connection. You should only use POP3 if IMAP is not available.
POP3 is an older and slower protocol than IMAP and does not provide an option to only download new messages since the last download. To ensure fast access you should enable the Delete Processed Messages option so that messages are removed from the POP3 account once they have been processed by ThinkAutomation.
The SendGrid message source type receives email messages sent to any of your SendGrid domains.
SendGrid is a cloud based message delivery platform. When used with ThinkAutomation it enables ThinkAutomation to receive email messages sent to any recipients for any of your SendGrid email domains. SendGrid is a worldwide platform and the cost is based on usage. See: https://www.sendgrid.com
You need to create a SendGrid Account if you want to be able to process SendGrid received email messages using ThinkAutomation.
You then need to login to your SendGrid account and setup the Inbound Parse feature. See: https://sendgrid.com/docs/for-developers/parsing-email/setting-up-the-inbound-parse-webhook/
Set the Inbound Parse Webhook URL in your SendGrid account to the SendGrid Inbound Parse URL shown in the ThinkAutomation Message Source. As emails are received by SendGrid they will then be forwarded to ThinkAutomation for processing. This does not affect your regular SendGrid email flow - it simply sends a copy to ThinkAutomation as emails are received.
The SMTP message source type receives email messages via the built-in SMTP mail server. The ThinkAutomation server can be configured as a mail server to receive email directly.
In the Accept Incoming SMTP Emails For Addresses entry, enter one or more email addresses for this message source. Any incoming SMTP emails with a To, CC or BCC address matching one of these emails will be received and processed.
You can add multiple email addresses separated by semi-colons (;). Wild cards can be used (eg: sales*).
Multiple message sources can be configured to process different Automations depending on the To, CC or BCC addresses. If no Message Source is found for an incoming email then the email will be ignored.
Any email client, script or PowerShell can then be used to send email to ThinkAutomation for processing.
The SMTP Server option must be enabled in the Server settings. See: Server Settings - SMTP Server API
The Web Form message source type enables you to create a local and publicly accessible web form with multiple input fields. Web forms are responsive and mobile friendly. Each web form has a unique secure public URL hosted on Azure as part of the ThinkAutomation Web API and a local URL served directly from your ThinkAutomation Server. You can embed the public web form inside your own website or send a link to the form in outgoing emails. When a web user completes the form, the results are sent to your ThinkAutomation Server for immediate processing. The Web Form can optionally display the Automation return value after the form is submitted.
Click here to view a sample webform.
Title
Enter an optional title. This will appear in bold above the header.
This is the text that is displayed above the form itself. You can use Markdown if required. The Markdown will be converted to HTML when the form is rendered. The Title & Header are optional. You can also adjust the text for the Submit Button.
The footer text defaults to 'Processed By ThinkAutomation'. If you have the ThinkAutomation Professional Edition you can change the Footer text. Set this to blank to remove the footer. The footer can contain HTML.
Enter the Confirmation Message. This is the text that is displayed after the form is submitted. If the Display In Modal Popup option is enabled then instead of the form content being replaced with the confirmation message, a popup window will show. When the user closes the popup window the form resets ready for new values.
If the Do Not Hide Form After Confirmation option is enabled, then the form will not be hidden after it is submitted. The confirmation message will be displayed and the submit button re-enabled. This allows the form to be submitted again without refreshing.
You can show custom content on the left or right side of the form. On the side pane tab, enable the Show Side Pane option. Select Right Of Form to show on the right-hand side of the form, otherwise it will show on the left. You can specify the number of Columns for the side pane. The total width is 12, so specifying 6 columns would mean the side pane is the same width as the form. The web form uses responsive layout, so if the side pane cannot fit on smaller devices, then it will automatically move below the form.
Any any text, Mark or HTML to display in the side pane area.
The Header, Footer, Confirmation and Side Pane message can use plain text, Markdown or HTML. Markdown will be converted to HTML. You can also use HTML directly. Web forms use Bootstrap 5, so any of the standard Bootstrap 5 classes can be used.
You can create any number of Form Fields. Click Add to add a field.
Enter a Name and Label Text. You can also optionally specify Help Text that will display in a smaller font below the input field.
The Field Type can be:
Text
Number (numeric only)
Date
Boolean (check box)
HTML Editor (a full featured HTML editor - returns HTML)
Email (only a valid email address allowed)
URL (only a valid URL allowed)
Telephone
Password
Decimal
Currency
Time
Range
Label (displays the label text only - does not return a value)
Rating (user can select a rating by clicking Star icons)
File (user can select a file to include with the form as an attachment)
For text field types you can specify the Max Length. The Max Lines option allows you to define the maximum lines.
You can arrange the order of fields on the form using the Up & Down buttons.
You can add input fields of type File. This allows the user to select one or more files to upload. Uploaded files will be added to the incoming message as attachments. You can limit the allowed file types by specifying a comma separated list of allowed file extensions (or mime types) in the File Types entry.
For example:
.doc,.docx,text/plain
In the above example, the file upload will accept Word Documents and plain text files.
The value used in the file types entry will be used for the accept value of the file input type on the web form. If the File Types is blank then files of any type will be allowed.
You can also specify the maximum file size in bytes. If the Multiple option is enabled then the user will be able to upload multiple files in the same input. Enable the Required option if a file must be selected before the form can be submitted.
The Attributes tab allows you to specify a default value, change case & validation rules. Enable the Validate option. When the web user completes the form they will not be able to submit it until all of the fields pass validation.
If you want the user to select possible values from a list, select the Must Be In List option and then enter the Choices. For example to show a list box showing 'Yes', 'No' & 'Not Sure', set the Field Type to 'Text', enable the Validate option, select the Must Be In List option and add Choices of 'Yes', 'No' and 'Not Sure'. The default value of the select list will be set to the Default Value entry. The list can be displayed as a select list, a button group or a radio button group. Select the display type from the Of Type entry.
The Visibility tab allows you to define visibility rules for the current field. Disable the Visible On Form Load option if you do not want this field visible by default.
In the Change Visibility Of This Field grid you define a condition to show or hide this field. The condition can be based on values of other input fields.
Then from the If Condition Is True Make This Field entry select Visible or Hidden.
As a user completes the form all of the visibility conditions will be evaluated when any input value is changed.
In addition the the Default Value that you can set for each field you can also pre-populate field values via the form URL. Adding &x-{fieldname}=value
to the form URL will set its default value on form load. For example: If you have field name Company you could pre-populate its value by adding x-Company=Test%20Customer
to the form URL. Pre-populating field values can still be done if the field is hidden.
The web form uses Bootstrap for its responsive layout. Select the Bordered option to show the form inside a bordered card. Use the Scheme list to select a color scheme for the card. You can also change the Background & Foreground colors. The Foreground color can only be changed if not using a bordered card. Specify a Header Image URL to display an image above the title.
You can also specify a Custom Style Sheet Link URL. You can use this to override the default Bootstrap styles. If a custom style sheet is used then the Background/Foreground colors are ignored.
Click the Preview button to display a local preview of how the form will look.
You can optionally specify a Redirect URL. This is a URL the web user will be redirected to on completion of the form. If a redirect URL is specified then the Confirmation Message will not be displayed to the user. If you want to conditionally redirect after the confirmation message is show use the Create Web Form Redirect action.
WhosOn is Parker Software's live chat and visitor tracking solution. See: https://www.whoson.com. If you are a WhosOn user you can add the WhosOn page tag to your form so that visitors to the form show in real time in your WhosOn Client. You can optionally Show Chat Button on your form. Your WhosOn Server & Domain details are specified in the ThinkAutomation Server Settings.
You can add a Google reCAPTCHA box to your forms to ensure human only responses. Go to reCAPTCHA (google.com). Use the Admin Console to create a reCAPTCHA. Set the type to reCAPTCHA v2. In the domain enter api.thinkautomation.com. Select the reCAPTCHA keys section and enter your Site Key and Secret Key. You can also change the text that will be displayed if a user submits a form without first completing the Captcha.
You can optionally add any custom HTML on the Custom tab. This can contain JavaScript enclosed in <Script>
tags. Any custom HTML is rendered just before the closing </body>
tag. This can be used to set custom default values for form fields. For example, assume we have 'FromDate' and 'ToDate' input fields, and we want to set the default from date to two years before today and the to date to today:
<script>
const today = new Date();
const twoYearsAgo = new Date(today.getFullYear() - 2, today.getMonth(), today.getDate());
document.getElementById("FromDate").value = twoYearsAgo.toISOString().split('T')[0];
document.getElementById("ToDate").value = today.toISOString().split('T')[0];
</script>
This entry shows the unique public URL for the web form. You can link to this from your website, send it in outgoing emails or embed it into your web site pages using an iframe tag. Whenever a web visitor completes the form the Automation assigned to the Message Source will be executed with the form contents.
This entry shows the unique local URL for the web form. This URL connects directly to your ThinkAutomation Server and can be used on your local network. The local web form looks and operates the same as the Public web form except that the form contents are posted directly to your ThinkAutomation Server - bypassing the Public API.
By default the URL path for the web form will be /form followed by ?taid={uniquekey}. You can change this to a more friendly path, such as /mycompany/customers/addform. The path must be unique. ThinkAutomation will check that the path is valid and unique before saving.
Enable the Wait For & Include Automation Return Value With The Confirmation Message option if you want the Automation Return Value included in the confirmation message. If this option is enabled then the form response will wait for the Automation to complete. You should then configure your Automation to return the text, markdown, html or a file that you want displayed in the form confirmation. The max wait time is 60 seconds, so if your Automation may be long running then the Wait For option may not be applicable.
You can also include a redirect in the Return value if you want another Web Form or URL shown after the form is submitted. See the Create Web Form Redirect action.
If the Wait For & Include Automation Return Value With The Confirmation Message option is enabled and the Automation Return value is a single local file path (or a variable containing a file path) then the file content will be read and returned. You can return whole html pages, images, PDF files etc. The response Content-Type will be set according to the file extension. The web form will redirect to a new page showing the file content.
If you are using the Embedded Files Store action to save files to the Embedded Files Store database, you can return file content directly from the Embedded File Store. Use the Embedded Files Store action with the Get Info operation. Assign the results of the Get Info operation to your Automation Return value. The ThinkAutomation Server will then read the file content directly from the database and return the content.
The Web API has a limit of 5mb for the content returned from an Automation.
If your Automation is long running, or you want to provide a static link to the Automation results that a user can access later, you can use the %Msg_ResultsUrl% variable. Your Automation could include this variable in an outgoing email. A user can click the link to view the Automation results at a later date. The %Msg_ResultsUrl% URL is unique for each processed message and contains a secure hash. The link will work for as long as the Message is stored in the Message Store. You do not need to enable the Wait For & Include Automation Return Value In The Confirmation Message option to use the %Msg_ResultsUrl%.
When you save the Message Source your ThinkAutomation Server uploads the form details to the ThinkAutomation Web API Gateway server. The Web API Gateway acts as a secure tunnel between the public web form and your on-premises ThinkAutomation instance. Your ThinkAutomation server makes an outbound connection to the Web API Gateway server. Once saved, the web form can be used immediately. Any changes you make will be updated. See: Using The Web API for more information.
When a web user completes the form, the ThinkAutomation Web API sends the results to your ThinkAutomation Server. The message body will be Json containing the form fields. For example:
xxxxxxxxxx
{
"fname": "Alice",
"lname": "Bamber"
}
You can then use Extract Field actions to extract the data from the message and perform any other Automation actions. If your ThinkAutomation Server is not active when a web form is submitted it will be queued by the ThinkAutomation Web API for up to 48 hours. Any uploaded files will be added to the message as attachments.
Additional Headers
The following headers will be added to the ThinkAutomation message headers:
Header | Details |
---|---|
RemoteHost | The IP address of the web user submitting the form. |
User-Agent | The browser user-agent of the web user submitting the form. |
Origin | The origin header of the web user submitting the form. |
You can access these values in your Automations (using the Set Variable action with the Extract Header Value operation). The RemoteHost is available using the built-in variable %Msg_FromIp%. For example, you could use the GeoIP Lookup action to lookup the country for the user's IP address, or use the Get Browser Info action to get the browser name.
Security
Each web form URL is unique to your ThinkAutomation instance and Message Source and contains a secure hash. The web form is hosted on Microsoft Azure and is served via HTTPS only - meaning all form submissions are encrypted. The ThinkAutomation Web API sends completed forms to your ThinkAutomation Server over a secure WebSocket connection. The Web API gateway server does not keep copies of submitted forms. If your ThinkAutomation Server is not active then any form data is stored in a queue for up to 48 hours and sent when your ThinkAutomation Server becomes active. This storage queue is encrypted.
Embedding The Form In Your Website
You can add the form to any of your web pages using an iframe tag. For example:
xxxxxxxxxx
<div class="container-sm pt-4">
<div class="row">
<div class="col-7 mx-auto">
<div class="card">
<iframe style="height:900px;border:0;padding:0;margin:0;" title="Reseller Form" src="https://api.thinkautomation.com/form?taid=5033f425cf79df15d03275fa6220954590ca1c720cc0959dAIXShPj1fv5f0Vnr9dFg2Zlc%2bQgXEi%2fS"></iframe>
</div>
</div>
</div>
</div>
Once the form is embedded any changes you make to Message Source Web Form properties will be updated on the form on your site. If you delete the Message Source from your ThinkAutomation settings you will need to remove the embedded link from your site.
You can also post your own existing web forms to ThinkAutomation for processing. See: Web Forms-Custom.
The Web Chat message source type enables you to create a local and publicly accessible web chat form. Each web chat form has a unique secure public URL hosted on Azure as part of the ThinkAutomation Web API and a local URL served directly from your ThinkAutomation Server. You can link to, or embed the public web chat form inside your own website or send a link to the form in outgoing emails. When a web user sends a chat message, the results are sent to your ThinkAutomation Server for immediate processing and the Automation Return Value is returned to the chat. The user can continue sending messages and receiving responses in a conversation-style UI. Any number of separate Web Chat Form message sources can be created.
Specify the name for your 'bot'. When ThinkAutomation sends back a response the Bot Name shows above the response text in the chat. You can use an email address in the form Bot Name <email>
. The bot name shown in the chat form will just be the name part. The Bot Name is also used for the 'To' address of messages sent from the Web Chat form to your ThinkAutomation server and available in your Automation in the %Msg_To% variable.
Before a user starts a chat session you can optionally require that the user enters their Name, Email Address and/or a Subject. These values will be passed to your Automation with each chat message in the %Msg_FromName%, %Msg_FromEmail% and %Msg_Subject% variables.
You can configure the input fields for Name, Email & Subject (such as Prompt text, Required etc.). For the Subject field, if you want to provide a list of possible values instead of free-text, set the Attributes of the Field to Validate - Must Be In List - and then provide the Choices.
You can also pre-populate the Name, Email & Subject field values via the chat form URL. Adding &x-Name=value
, x-Email=value
and x-Subject=value
to the chat form URL will set the values on form load.
You can change the Start Chat Header text. This is any text that appears above the Start Chat input fields. You can also change the Start Chat Button Text.
Send Token On Chat Start
If this option is enabled then your Automation will receive a message with the %Msg_Body% set to [webchatstart]
after a user has completed the Start Chat form to initiate a new chat session. Your Automation could check for this token and return details about what your bot can offer and any other opening remarks. You can also use this to record user details in a database etc. Your Automation should return blank Return Value if you do not want any response returned to the chat after receiving this message.
After the user completes the Start Chat form and starts a new chat session an Initial Message can be added to the chat. This would normally be a Welcome! How can we help you today? style message. You can use Markdown or HTML if required. Set to blank for no initial message.
Enable the Allow File Upload option if you want to allow the user to upload files during the chat. The uploaded file will be added as an attachment to the incoming message. The Allowed File Extensions entry allows you to specify the allowed file types. Specify a comma separated list of allowed file extensions (eg: pdf,doc,docx). You can also specify the Maximum File Size in bytes.
You can change the Header text and the Message Text Placeholder. The header is displayed above the chat form.
The footer text defaults to 'Processed By ThinkAutomation'. If you have the ThinkAutomation Professional Edition you can change the Footer text. Set this to blank to remove the footer. The footer can contain HTML.
Specify a Light, Dark or one of the color themes. You can also optionally specify a Header Image URL. This is the URL to a image that will show in the chat header. This should be a small image (32/32 pixels).
Click the Preview button to display a local preview of how the chat form will look.
Note: Parker Software Professional Services can create bespoke web chat forms with custom styling. Please contact us for more information.
This entry shows the unique public URL for the web chat form. You can link to this from your website, send it in outgoing emails or embed it into your web site pages using an iframe tag.
This entry shows the unique local URL for the web chat form. This URL connects directly to your ThinkAutomation Server and can be used on your local network. The local web form looks and operates the same as the Public web chat form except that the form contents are posted directly to your ThinkAutomation Server - bypassing the Public API.
By default the URL path for the web chat form will be /form followed by ?taid={uniquekey}. You can change this to a more friendly path, such as /mycompany/customers/chat. The path must be unique. ThinkAutomation will check that the path is valid and unique before saving.
When you save the Message Source your ThinkAutomation Server uploads the chat form details to the ThinkAutomation Web API Gateway server. The Web API Gateway acts as a secure tunnel between the public web form and your on-premises ThinkAutomation instance. Your ThinkAutomation server makes an outbound connection to the Web API Gateway server. Once saved, the web chat form can be used immediately. Any changes you make will be updated.
When a web user sends a chat message, the ThinkAutomation Web API sends a new message to your ThinkAutomation Server. Your Automation will execute for each chat message received. The message body %Msg_Body% variable will contain the user entered message text.
Web Chat forms will automatically wait for your Automation to execute. The Automation Return Value will be displayed in the chat as a response to the message received. You should configure your Automation to return the text, markdown or HTML you want displayed in the chat in response to the message received.
You can also include a redirect in the Return Value if you want the chat session to end and be redirected to another Web Form, Chat Form or URL. See the Create Web Form Redirect action.
Sending '[end]' as the Automation Return Value will end the current chat session for the user.
In addition to returning text in the Automation Return Value, you can send 'Chat Input Request' forms. This is a pre-defined list of buttons or inputs that the user can complete to send back specific information.
For example, you could ask the user 'Which product do you use?' and then include buttons for each of your products. The user can simply click one of the buttons instead of typing the product name. See: Create Chat Input Request action.
The Automation executed when a chat message is received can perform any actions you choose. You could return on-premises or company data based on the message text received. You can also call ChatGPT or OptimaGPT using the ChatGPT action. Using the ChatGPT action enables you to very quickly create website chat bots - especially when combined with the Embedded Knowledge Store action to provide context.
A simple ChatGPT enabled Chat Bot Automation example:
In this example, we have loaded all of the ThinkAutomation help documentation into the Embedded Knowledge Store collection called 'ThinkAutomationKB'. When a user asks a question in the chat, the Automation searches the Knowledge Base using the user's question to find the 5 most relevant articles. Those are then added to the conversation as context. This enables ChatGPT to answer the question - even if it has no knowledge itself.
When you create a new Web Chat Message Source, the New Message Source wizard will ask you if you want to use ChatGPT with a Knowledge Store. If this option is enabled, a new Automation will be automatically created and your bot will be ready. You can then edit the Automation if you need to make adjustments.
The integration of ThinkAutomation with ChatGPT or OptimaGPT offers a powerful workflow automation solution that enhances the capabilities of ChatGPT through on-premises operation and context enrichment from a local knowledge store. This approach enables accurate, context-aware responses without the need for model training, ensuring cost-effectiveness and the ability to keep private data secure. It allows organizations to quickly create working bots, maintain up-to-date information, and harness the full potential of AI while maintaining control over their data and data privacy.
The Teams message source type receives outgoing webhook requests from Microsoft Teams. Users of Teams can use @mentions to trigger a request. Your Automation return value is then sent back to the conversation as a response.
For each Teams Message source you supply a Name. This is the text that users will type in Teams (preceded by an @ sign). For example: You could have a Teams Message Source with the name 'FindCustomer'. In Teams users would type @FindCustomer followed by some more text. When the user hits enter the text will be sent to ThinkAutomation and your Automation will execute. The Return value of the Automation will then be sent back to Teams and show as a response in the conversation.
You can create any number of Teams Message Sources with different 'names' and then attach these to any of your Teams.
In Microsoft Teams select the appropriate team and choose Manage team from the (•••) drop-down menu.
Select Manage Team
Choose the Apps tab from the navigation bar.
Select Create an outgoing webhook.
Note: This option will only be available if you are the Owner of the team.
Specify the Name - users can then enter @{name} to send to ThinkAutomation.
Paste the Microsoft Teams Outgoing Webhook Callback URL into the Callback URL entry.
Paste the Security Token shown after the Teams webhook is created into the Security Token entry in ThinkAutomation.
See: Add custom bots to Microsoft Teams with outgoing webhooks - Teams | Microsoft Docs for more information.
When you create a new Teams message source, ThinkAutomation will automatically add Extract Field actions to the Automation to extract the message text.
Use the Return action to send back the text you want to respond with. The response text can be plain text, HTML or Markdown.
An Example: You could create a Teams outgoing webhook with the name "GetAccount". Whenever a Teams user types '@GetAccount Test Customer' - your Automation will execute. The %MessagePlainText% Extracted field will be set to 'GetAccount Test Customer'. The %MessageTextAfterName% Extracted Field will be set to 'Test Customer'. You could then lookup customer details from a database or perform other actions and return a response - which will be returned back to the Teams conversation.
You could also use the ChatGPT action with a local knowledge store. This would allow teams users to send questions to your 'bot'.
You can also return an Adaptive Card. This is Json text that will be rendered in Teams. You can design Adaptive Cards here: https://adaptivecards.io . Once you have designed your Adaptive card click the Copy card payload button to copy the Json text. Use this as the Automation Return value. You can adjust the Json to include Automation %variables% before returning it using the Create Json action.
The Automation you execute should not be long running. Microsoft Teams will wait for up to 5 seconds for a response.
The Microsoft Teams message source type uses the ThinkAutomation Web API to forward messages from Teams to your ThinkAutomation Server. The ThinkAutomation Web API sends messages to your ThinkAutomation Server over a secure WebSocket connection. The Web API server does not keep copies of forwarded messages.
The Database message source type can be used to monitor a database for new or updated records. Rows returned from a database query will be passed to an Automation for processing. Select the Database Type (Microsoft SQL Server, MySQL, SQLite, Oracle, PostgreSQL, DB2, Firebird or OLDBC/OLEDB). Enter the Connection String or click the ...
button to build and test the connection. See: Database Connection Notes for more details about supported databases.
Enter the SQL Statement to query against the database to retrieve rows. For example:
xxxxxxxxxx
SELECT * FROM Person WHERE PersonId > @Id ORDER BY PersonId
The SQL Statement can contain Parameters. You should then complete the Parameters table to provide each parameter type and value.
The query should include at least one column that provides a unique value. Enter this column name in the Unique Id Column box. ThinkAutomation will ensure that the same record is not processed more than once based on the Unique Id Column value. If no Unique Id Column is used then the same records could be processed multiple times if they are not filtered out using the WHERE clause (or deleted).
ThinkAutomation automatically caches the last Unique Id Column value each time it requests data from the database. You can use this cached value as a Parameter value by setting a parameter value to %LastDatabaseId%.
In the above example the Unique Column Name is PersonId. We set the @Id parameter value to %LastDatabaseId%. This means that each time ThinkAutomation requests data from the database it only requests records with a higher PersonId since the last request (making the query much faster).
Test & Create Automation
You should test your query before saving the Message Source. Click the Test button. When you use the Test option on a new Message Source, ThinkAutomation will ask if you want to create a new Automation to process the records. It will then create a new Automation with Extract Field actions that match the columns returned by the query.
Creating The ThinkAutomation Message
Each row returned from the database query will be passed to the Automation for processing. You can choose to pass all columns to the Automation or a single column. Set the Assign All Columns To Message Body to send all columns returned by the query.
The database row will be passed to the Automation in the following format:
xxxxxxxxxx
{
"PersonId": 1,
"PersonType": "EM",
"NameStyle": false,
"Title": "",
"FirstName": "Ken",
"MiddleName": "J",
"LastName": "Sánchez",
"Suffix": "",
"EmailPromotion": 0,
"AdditionalContactInfo": "",
"ModifiedDate": "2009-01-07 09:00:00"
}
If you used the Test option then Extract Field actions will have been created automatically to extract each column value.
You can optionally set the message Subject, From Address and Date. The Subject will default to '%TableName% (%LastDatabaseId%)' - where %TableName% will be the table name extracted from the SQL statement used for the query. You can change this and include text and column values for the current row. To use column values, use %ColumnName% replacements. For example:
Record Id %LastDatabaseId% For %FirstName% %LastName%
would set the subject to 'Record Id 1 For Ken Sánchez'.
The Message Date will default to the current date & time. You can optionally set it to a column value. For example, %ModifiedDate%.
The MongoDB message source type can be used to monitor a MongoDB database collection for new or updated documents. Each document found will then be passed to an Automation for processing. You can connect to a local MongoDB or a cloud based MongoDB compatible document database such as MongoDB Atlas, Amazon DocumentDB or Azure Cosmos DB.
Enter the MongoDB Connection String, Database Name and Collection Name. Enter the Query json and optionally the Projection and Sort json. Click the Test button to test the connection and query.
ThinkAutomation automatically caches the last document _id value between requests in the %LastDatabaseId% variable. This can be used in the Query json. For example:
xxxxxxxxxx
{ "_id": { "$gt": "%LastDatabaseId%" } }
This Query will retrieve all documents where the _id value is greater than then last requested _id.
Each document returned from the query will be passed to the Automation for processing in its Json format. You can then create Extracted Fields on your Automation to extract each value that you need in your Automation. Extracted Fields have an Extract Json option for easy extraction of Json data.
The File Pickup message source type can be used to monitor a local folder on the ThinkAutomation computer. Each new or updated file found in the folder will be passed to the Automation for processing. The Subject of the message will be set to the file path.
Select the From Folder and File Name or Mask.
Enable the Add File Contents option if you want ThinkAutomation to add the file contents to the message passed to ThinkAutomation for processing. Text based files will be added as the plain text body. HTML files will be added as the HTML body. Any other files will be passed as an Attachment - which you can then process in the Automation. The Add File Contents option applies only to files less than 50MB in size. For files greater than 50MB the file details will be passed (see below).
Add File Contents - Email Messages
Files with extensions .eml and .msg (Outlook Messages) will be added as regular email messages (with Body, Subject, From, To, Headers etc set.).
No File Contents
If Add File Contents is not enabled (or the file size > 50MB) then only the file details will be passed to the Automation. The file details are passed as Json in the Message Body, in the following format:
xxxxxxxxxx
{
"Path": "D:\\Setup Files\\ThinkAutomation.exe",
"Name": "ThinkAutomation.exe",
"Extension": "exe",
"Size": 167815264,
"Created": "2020-11-20 14:58:02",
"Modified": "2020-11-20 14:58:05",
"Description": "ThinkAutomation Installer",
"CompanyName": "Parker Software",
"Version": "5.0.261.2",
"Product": "ThinkAutomation"
}
The Subject will be set to the file path.
In an Automation you can then access the file path using %Msg.Subject% and extract other file information using Extract Field actions. The default Automation created when you create the Message Source will automatically contain Extract Field actions to extract the above fields. You can then use the %Path% variable on Automation actions (such as Convert Document, Print etc).
Delete After Pickup
Enable the Delete After Pickup option if you want ThinkAutomation to delete files once they have been processed.
Enable Folder Monitoring
If the Enable Folder Monitoring option is enabled then ThinkAutomation will monitor the selected Folder for new or changed files (after the initial scan). New and changed files will be processed immediately. If this option is not enabled then you can set a Schedule (for example: Every 2 minutes). The folder will scanned depending on the schedule - and any new files will be processed. Folder monitoring is enabled by default - you can disable it if you only want to scan a folder at pre-set times.
When using the File Pickup message source type, CSV and Excel files can be treated differently. Instead of the complete file, ThinkAutomation can select any new Rows added to the CSV or Excel file and send these as single messages to the Automation for processing.
For Example, consider the following CSV file:
Product | Name | Quantity | Value |
---|---|---|---|
Item 1 | Item 1 description | 100 | 1.20 |
Item 2 | Item 2 description | 200 | 1.30 |
When ThinkAutomation reads this CSV file (or Excel file) it will create 2 messages in the following format:
Message 1:
xxxxxxxxxx
{
"xName": "items.csv",
"xRow": 1,
"Product": "Item 1",
"Name": "Item 1 description",
"Quantity": 100,
"Value": 1.20
}
Message 2:
xxxxxxxxxx
{
"xName": "items.csv",
"xRow": 2,
"Product": "Item 2",
"Name": "Item 2 description",
"Quantity": 200,
"Value": 1.30
}
The subject of the message will be: [filename] Row x
Enable the For CSV & Excel Files Create Single Messages For Each New Row option to enable single row message processing. For Excel files you can also optionally specify the Worksheet name to use and the Headers Row number containing header values.
For CSV files, if the CSV file has no header row, enable the CSV Has No Header Row option.
By default all columns in the CSV or Excel file will be passed to the Automation. If you only need certain column values enable the Read Values From Specific Columns option and then specify a list of Column Headers or Column Numbers.
Creating Extracted Fields For CSV & Excel Files
When using single row processing ThinkAutomation can create the Extract Field actions for you. Click the Create Extracted Fields button. ThinkAutomation will then read the CSV or Excel file specified in the File Name entry and create an Extract Field action for each column.
Resetting The Last Row Pointer
Each time ThinkAutomation reads the CSV or Excel file for new rows, it stores the last row number in the Message Store database, so only new rows since the last scan are processed. During testing you may need to reset this to allow a new full scan. To reset the pointer, click the Reset Last Rows button.
The HTTP Get message source type reads the response from any URL. If the response content has changed the content will be passed to an Automation for processing.
Specify the Get URL
If the web page requires a login specify the credentials in the Authentication section.
If the URL returns HTML the HTML content can be converted to plaintext or XML. The converted text will then become the message body of the message passed to the Automation. Json responses will be passed unchanged.
Any other content-types will be passed as an Attachment.
If the HTTP Get fails you have the option to:
No Action.
Set the Message content passed to the Automation to the HTTP status (eg: 404 File Not Found).
Pause the Message Source
Each time the HTTP content is read ThinkAutomation will compare the response to the last received response. If the response has changed a new message will be added for processing.
Some websites prevent automated tools from reading web content, so this Message Source type may not work in all cases. Its primary use is for monitoring HTTP API's or web resources that allow automated access.
The Azure Queue message source type can be used to monitor a Microsoft Azure queue for new messages.
Enter your Azure Queue Account Name & Access Key.
Enter the Queue Name.
Click the Verify button to verify that ThinkAutomation can read from the queue.
ThinkAutomation will read each message from the queue and use the message contents as the message body. You can then parse the contents and perform Automation actions.
Enable the Delete Messages option to remove messages from the Azure queue after being read by ThinkAutomation.
If you do not delete messages, then you should specify the Visibility Timeout value. This is the number of seconds that the message should be invisible to other clients after it has been read. It is then assumed another client will delete the messages at a later date.
The Twilio message source type receives SMS text messages sent from any mobile phone to any of your Twilio phone numbers.
Twilio is a cloud communications platform. It enables developers to programmatically make phone calls and to send & receive text messages using its web API's. When used with ThinkAutomation, it enables ThinkAutomation to receive SMS messages. Twilio is a worldwide platform and the cost is based on usage.
You need to create a Twilio Account if you want to be able to process received SMS text messages using ThinkAutomation. In Twilio, create a Twilio Phone Number to receive messages. In the Twilio Phone Number Properties set the Messaging - A Message Comes In - Webhook URL to the Set Your Twilio Messaging 'A Message Comes In' Webhook URL To shown in the ThinkAutomation Message Source properties.
Once assigned, any SMS messages sent to your Twilio number will be sent to ThinkAutomation for processing. You can create different ThinkAutomation Message Sources and assign each Webhook URL to each of your Twilio Phone numbers, or you can use a single ThinkAutomation Message Source and assign the same URL to all of your Twilio Phone Numbers and then parse the 'To' number out of the received message.
When a SMS message is received ThinkAutomation will create a new message that can be processed by your Automations. The message will be in the following format:
xxxxxxxxxx
{
"from": "+447799123456",
"fromCountry": "GB",
"fromCity": "",
"fromState": "",
"fromZip": "",
"to": "+447779678901",
"toCountry": "GB",
"toCity": "",
"toState": "",
"toZip": "",
"smsStatus": "received",
"body": "Test SMS Message Received",
"numMedia": "0",
"numSegments": "1",
"messageSid": "SMe0000000000000000000000000000000",
"accountSid": "AC00000000000000000000000000000000",
"apiVersion": "2010-04-01"
}
You can then parse this message and perform Automation Actions, such as sending an outgoing SMS replies or recording the message details in a database.
When you create a Twilio Message Source using the New Message Source Wizard an Automation will be automatically created with Extract Field Actions setup to extract the above data.
You can reply to the incoming SMS using the Twilio Send SMS Message action and setting the To value to the %from% extracted field value. The %body% extracted field value will contain the incoming message text.
The Twitter message source type reads tweets from a Timeline, @mentions feed or for any search term. This Message Source is useful for monitoring your own (or another business) Twitter feed and performing actions if certain words appear in Tweets.
Requires a paid Twitter Basic or Pro level developer account. See: Twitter Developer Portal
From the Read Tweets For list select one of:
Type | Details |
---|---|
User Timeline | Reads new tweets for any Twitter user. Enter the Twitter Handle (you don't need to enter the @ sign). The Twitter handle can be found by opening a Twitter users feed. |
User Mentions | Reads new tweets that mention the specified Twitter Handle. |
Search Term | Reads new tweets that match the specified Search Term. |
For Search Term queries you can select to Exclude Replies and/or Retweets.
When a new Tweet message is received ThinkAutomation will create a new message that can be processed by your Automations. The message will be in the following format:
xxxxxxxxxx
{
"author_id": "1629799226",
"created_at": "2021-11-24T09:21:05+00:00",
"id": "1463437507513798656",
"text": "Test tweet",
"lang": "en",
"name": "Parker Software",
"username": "ParkerSoftware"
}
You can then parse this message and perform Automation Actions.
When you create a Twitter Message Source using the New Message Source Wizard an Automation will be automatically created with Extract Field Actions setup to extract the above data.
When a new Twitter Message Source is created, ThinkAutomation will read the most recent 200 Tweets. From then on it will read new Tweets as they are added. You can reset the Sync status by clicking the Reset Sync State button. The most recent 200 tweets will then be processed again (provided they have been removed from the Message Store).
Note: You will need to create your own Twitter Developer account with Basic or Pro level access. The free tier cannot be used.
The API Message Source type allows you to receive messages to process via local or public HTTP POST or GET requests. You can also use this Message Source type if you only want to manually execute Automations, without any specific source.
Messages can be posted to ThinkAutomation via a local API URL. Each Message Source has a unique local API URL. You can use this endpoint to post messages within your local network.
See Also: Using The Local API
Messages can also be posted to ThinkAutomation via a public API URL. The Web API provides a secure web public endpoint allowing messages to be posted to ThinkAutomation from your own or 3rd party webhooks. Each Message Source has a unique public API URL. The public Web API Gateway acts as a secure tunnel between web resources and your on-premises or self-hosted ThinkAutomation instance. This allows your ThinkAutomation Server to receive public HTTP requests without being publicly accessible itself.
See Also: Using The Web API
If you will be receiving Json via HTTP POST or GET requests you can quickly create the required Extract Field actions. Click the Create Fields button and paste a sample of the Json you will be receiving. The required Extract Field actions will then be created in your Automation.
These settings are optional.
Allowed Methods
By default the API Message Source will accept both HTTP POST and GET requests. You can limit to POST or GET only.
Require Authentication
By default, callers to the API endpoint do not need to supply any authentication. You can require the caller to provide authentication. This can be an API Key, a Bearer Key or Basic Authentication.
For API Key authentication you specify the header name and value. The caller must add the required header to their requests.
For Bearer Key authentication the caller must add an 'Auth' header with the value Bearer: {value}.
For Basic authentication the caller must add an 'Auth' header with the value Basic: {base64encoded username:password}.
Any request with invalid authentication will be refused with a 401 Unauthorized response.
Allowed Origins
For the public API you have the option of specifying Allowed Origins. Specify a comma separated list of allowed URL's that can post to the public API endpoint. If this entry is blank then the endpoint can be posted to from anywhere. Full URL's should be specified, eg: https://www.mysite.com
- without any path or page name.
Disable
You can explicitly disable the Message Source from receiving public API requests by enabling this option. Any requests to the Public API endpoint will then receive a 404 response.
By default the URL path for the Message Source will be /addmessage followed by ?taid={uniquekey}. You can change this to a more friendly path, such as /mycompany/customers/add. The path must be unique. ThinkAutomation will check that the path is valid and unique before saving.
The ThinkAutomation Web API can accept HTTP POST requests from your own web forms. Simply set the form action to the public API URL. For example:
xxxxxxxxxx
<html>
<body>
<form action="https://api.thinkautomation.com/addmessage?taid=5f7b421a6e1f408c38488397179ab14c6e1f405c7cbf955cd9%2fwxO9qltjQwt0pU7d4GRErBl5njQP%2f" method="post">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
You can add a &redirect={URL} parameter to the API URL query string if you want the server to respond with a 303 Redirect once the message has been accepted.
When the form is posted to ThinkAutomation a new message will be sent to your Automation in Json format. For example:
xxxxxxxxxx
{
"fname": "Alice",
"lname": "Bamber"
}
The RemoteHost, User-Agent & Origin headers will also be added to the ThinkAutomation message headers. The RemoteHost can be accessed using the built-in variable %Msg_FromIp%. You can access these values in your Automation using the Set Variable action with the Extract Header Value operation.
You can then use Extract Field actions to extract the data from the message and perform any other Automation actions. If your ThinkAutomation Server is not active when a web form is submitted it will be queued by the ThinkAutomation API for up to 48 hours.
By default API POST requests will respond with a 202 Accepted status as soon as the message has been queued (unless a &redirect parameter is specified). You can optionally wait for the Automation results by adding &wait=true or &results=true query string parameter to the URL.
If &wait=true is used the API will return the results of the Automation in the MessageResultDetail object of the Json response along with a 200 OK status. The response will include the Automation return value.
If the &results=true parameter is used then only the Automation Return Value content (or an error message) will be returned along with a 200 OK status. Depending on the content of the Automation Return value, the result will be served as plain text (text/plain), HTML (text/html) or Json (application/json). If the Return Value contains Markdown text it will be converted to HTML first. If the Return Value is already HTML it will be returned as HTML. If the Return Value is Json it will be returned as Json.
If your Automation is long running, or you want to provide a static link to the Automation results that a user can access later, you can use the %Msg_ResultsUrl% variable. Your Automation could include this variable in an outgoing email. A user can click the link to view the Automation results at a later date. The %Msg_ResultsUrl% URL is unique for each processed message and contains a secure hash. The link will work for as long as the Message is stored in the Message Store.
For additional security, ensure the Allowed Origins entry on the Message Source API properties contains the URL for the site containing the forms you will be posting to ThinkAutomation. This will ensure that form posts will only be accepted from your own website.
The ThinkAutomation public API URL also accepts HTTP GET requests. You can specify the message content as part of the URL. Whenever the URL is requested a new ThinkAutomation message will be created and processed.
The body, subject, from & to addresses can be specified on the query string:
xxxxxxxxxx
https://api.thinkautomation.com/addmessage?taid=5f7b421a6e1f408c38488397179ab14c6e1f405c7cbf955cd9%2fwxO9qltjQwt0pU7d4GRErBl5njQP%2f
&from=alice%40test.com
&subject=unsubscribe
&body=testmessage
The body, subject, from and to query string parameters are optional.
You can add a &redirect={URL} parameter to the API URL query string if you want the server to respond with a 303 Redirect once the message has been accepted.
Passing Field/Value Pairs
You can also pass specific field values using x-fieldname=value
. In this case the message passed to ThinkAutomation will be in Json format with each field value (excluding the 'x-').
For example:
xxxxxxxxxx
https://api.thinkautomation.com/addmessage?taid=5f7b421a6e1f408c38488397179ab14c6e1f405c7cbf955cd9%2fwxO9qltjQwt0pU7d4GRErBl5njQP%2f
&from=alice%40test.com
&subject=unsubscribe
&x-name=Alice+Bamber
&x-email=alice%40test.com
The message body which would be sent to ThinkAutomation as:
xxxxxxxxxx
{
"name": "Alice Bamber",
"email": "alice@test.com"
}
If you do not want to use field=value pairs you can pass the raw body text using the &body=
query string parameter. The ThinkAutomation message body will be set to the contents of the body parameter with no conversion.
The RemoteHost, User-Agent & Origin headers will also be added to the ThinkAutomation message headers. You can access these values in your Automation using the Set Variable action with the Extract Header Value operation.
You can then use Extract Field actions to extract the data from the message and perform any other Automation actions. If your ThinkAutomation Server is not active when a web request is made it will be queued by the ThinkAutomation API for up to 48 hours.
By default API GET requests will respond with a 202 Accepted status as soon as the message has been queued (unless a &redirect parameter is specified). You can optionally wait for the Automation results by adding &wait=true or &results=true query string parameter to the URL.
If &wait=true is used the API will return the results of the Automation in the MessageResultDetail object of the Json response along with a 200 OK status. The response will include the Automation return value.
If the &results=true parameter is used then only the Automation Return Value content (or an error message) will be returned along with a 200 OK status. Depending on the content of the Automation Return value, the result will be served as plain text (text/plain), HTML (text/html) or Json (application/json). If the Return Value contains Markdown text it will be converted to HTML first. If the Return Value is already HTML it will be returned as HTML. If the Return Value is Json it will be returned as Json.
If your Automation is long running, or you want to provide a static link to the Automation results that a user can access later, you can use the %Msg_ResultsUrl% variable. Your Automation could include this variable in an outgoing email. A user can click the link to view the Automation results at a later date. The %Msg_ResultsUrl% URL is unique for each processed message and contains a secure hash. The link will work for as long as the Message is stored in the Message Store.
See: Using The Web API
This message source type synchronizes changes to various entity types in Microsoft Graph (Office 365/Azure Active Directory). A new message will be processed whenever an entity is created, updated or deleted.
Currently the following entity types can be tracked:
Calendar Events : For the logged in user or another username.
Organization Contacts : Contacts managed by administrators.
Users : Organization users.
Teams Channel Chat Messages : For monitoring a Microsoft Teams channel.
More entity types will be added in the future.
Select the Entity Type. Then click the Sign In button to sign in with your Office 365/Microsoft Azure account.
For each entity type ThinkAutomation synchronizes changes. For new message sources all existing entities will be read - from then on only new/updated or deleted entities will be read. A new message will be created for each entity returned.
The message passed to ThinkAutomation for processing will be in JSON format representing the entity. When a new Message Source is created a new Automation will be created with extracted fields to extract the most common properties.
This message source type is useful if you simply want to run an Automation at a preset schedule without a specific incoming message. It enables you to execute an Automation based on the Schedule (for example, every 10 minutes). It uses a static default message (that can be blank).
At the scheduled time a new message is added to the process queue. The Automation assigned to the Message Source will be executed.
Message Sources can be assigned a Schedule. This defines how often the Message Source should be checked for new messages. Schedules can be every x seconds, minutes or hours, or at specific times. You can also select the days of the week that the Message Source should be active (and active from and to times for each day). Select the Schedule tab on the Message Source properties page to edit the schedule. A default schedule will be created for new Message Sources if required.
If a Message Source has a schedule then new messages will be checked based on the schedule settings. You can force a Message Source to check for new messages, regardless of its schedule. Right-click a Message Source and select 'Run Now'. The Message Source will check for new messages immediately and then revert back to the schedule.
Web Form, File Pickup, SendGrid, Twilio, Teams, SMTP and API message source types do not need a schedule. Any new messages for these Message Source types will be processed immediately.
A number of additional properties can be set for each Message Source. Open a Message Source form (select a Message Source and click Edit on the ribbon) and select the Properties tab.
Unzip Zipped Attachments
If this option is enabled then any incoming message containing zip file attachments will be automatically decompressed and the contents added as attachments and the zip attachment removed.
Append PDF, Word & Text Attachments To Body For Parsing
If this option is enabled then ThinkAutomation will automatically add text, Microsoft Word & PDF attachments to the plain text body of the message for parsing. You can then parse and extract data from the body text as normal. Rich text, Word and PDF attachments will first be converted to plain text before being added to the body.
In addition to PDF, Word and Richtext documents, ThinkAutomation will also append the text for any attachments with the following file extensions: txt, xml, ini, log, csv, vcf, vcard, md and any attachment with a content-type of: text/plain, text/vcard, text/calendar, application/json.
Append PDF Form Data To Body For Parsing
If this option is enabled then ThinkAutomation will extract form data from PDF attachments and add it to the plain text body of the message for parsing. Form data is added in the format: 'FieldName: value'. Each form value will be on a separate line.
The Append options are global for all messages received by the Message Source. You can also read PDF text and form data within an Automation using the Convert Document To Text action.
Drop Attachments
If this option is enabled then all attachments will be dropped from incoming messages. This option is useful if your Automation does not require access to attachments as it will improve performance and reduce the size of the Message Store database.
If the Append PDF, Word & Text Attachments To Body For Parsing option is enabled then the text content of the attachments will be added to the body text before the attachments themselves are dropped.
The Unzip Zipped Attachments, Append and Drop Attachments options do not affect the original incoming message. They only affect the message that is processed and stored by ThinkAutomation.
Send Notification On Message Source Errors
If this option is enabled then any errors that occur on the Message Source (for example an Office 365 login needs re-authenticating) will send a notification. The notification will appear in the Studio and an email will be sent to the default email address for the Solution.
Pause Message Source On Message Source Errors
If this option is enabled then any errors that occur on the Message Source will automatically pause the Message Source. This prevents the Message Source from trying to read more messages until the error is resolved.
Pause Message Source On Automation Errors
If this option is enabled then any errors that occur during Automation execution will automatically pause the Message Source. This prevents further messages from being processed until the error is resolved. A notification will appear in the ThinkAutomation Studio (and optionally an email will be sent) whenever a Message Source is auto-paused.
For some Message Source types (Email, Database, File Pickup), ThinkAutomation checks if the message already exists in the Message Store before sending the message to an Automation for processing. This ensures the same incoming message is not processed twice.
If you want to reprocess existing messages you can either use the Reprocess option when viewing the Message Store, or you can delete the existing messages from the message store. For Email Message Source types, if you delete messages from the Message Store you will then need to click the Reset Sync Status button on the Message Store properties. This clears any sync status. ThinkAutomation will then start reading all messages again - and provided the messages do not already exist in the Message Store, they will be processed again as new messages.
An Automation is a workflow of business process actions, executed for each incoming message from the configured Message Source. Automations can contain any number of Actions. Automations themselves can Call other Automations and the returned value from the called Automation can be assigned to a variable in the parent.
To create an Automation click the New Automation button on the ThinkAutomation Studio ribbon.
All Actions that have parameters allow you to use %variable% replacements.
This means you can specify a ThinkAutomation variable, extracted field, list, built-in variable, solution constant or global constant as the parameter (or part of) that will be replaced at execution time with the value of the variable. Variable names must be enclosed with % symbols.
For example, outgoing emails can contain values extracted from the incoming message by simply inserting %variablename% (where 'variablename' is the name of your variable) into the email text (or any other setting):
Dear %Name%,
We have received your enquiry %Msg_Subject%. This has been assigned ticket number %TicketNumber%.
Another example: The Process Attachments action allows you save attachments from the incoming message to folders on your system. If you had created a variable called OrderNumber you could save the attachment as:
C:\Orders\order%OrderNumber%.pdf
If %OrderNumber% contained '1234' then the file would be saved as C:\Orders\order1234.pdf.
In addition to extracted fields and variables that you create in your Automation, you can also use any of the following built-in message variables. These automatically contain values related to the current message:
Name | Details |
---|---|
%Msg_Body% | The incoming message body in plain text format. If the incoming message is HTML only, then the plain text body will be created from the HTML with all tags removed. |
%Msg_Html% | The incoming message HTML body. |
%Msg_Mime% | The full mime text of the incoming message. |
%Msg_Json% | A Json document representing the incoming message. See: Built In Json Variables |
%Msg_ExtractedFieldsJson% | A Json document containing all extracted fields names and their values. See: Built In Json Variables |
%Msg_Text% | The mime text without headers. |
%Msg_Subject% | The incoming message subject. |
%Msg_LastReplyBody% | If the incoming message is a reply, this variable returns the last reply text. Quoted text and previous replies are removed where possible. The %Msg_Body% will be returned if the incoming message contains no replies or quoted text. |
%Msg_Digest% | The first 750 characters of the last reply body (with blank lines & whitespace trimmed). |
%Msg_To% | The 'to' address. |
%Msg_ToWithNames% | The 'to' address including names (if available). |
%Msg_From% | The 'from' address. |
%Msg_FromEmail% | The 'from' address without the name portion. |
%Msg_FromName% | The 'from' address name portion only (if available). |
%Msg_FromIP% | The IP address of the sender (extracted from the RemoteHost or Received header). |
%Msg_CC%, %Msg_CCWithNames% | The 'cc' address. |
%Msg_BCC%, %Msg_BCCWithNames% | The 'bcc' address. |
%Msg_ReplyTo% | The 'reply to' address. |
%Msg_References% | The 'references' header. |
%Msg_Return-Path% | The 'return-path' header. |
%Msg_Sender% | The 'sender' header. |
%Msg_Date% | The date and time of the message. |
%Msg_Size% | The total size of the message including attachments. |
%Msg_Importance% | The 'X-Priority' header, either HIGH,LOW or NORMAL. |
%Msg_Sensitivity% | The 'sensitivity' header. |
%Msg_BounceType% | The bounce type. See: Bounce Processing |
%Msg_BounceAddress% | The bounce address. See: Bounce Processing |
%Msg_Headers% | The full headers section of the mime text. |
%Msg_Attachments% | Attachment file names (separated with CrLf). |
%Msg_AttachmentsInLine% | Inline attachment file names (separated with CrLf). |
%Msg_AttachmentCount% | The number of attachments. |
%Msg_AttachmentInlineCount% | The number of inline attachments. |
%Msg_AttachmentsSavedTo% | Attachment paths (separated with CrLf). During Automation processing each attachment is saved to a temporary location. The saved to path will be updated if the Process Attachments action is used to save the attachment to a new location. |
%Msg_AttachmentsInlineSavedTo% | Inline attachment paths (separated with CrLf). |
%Msg_AttachmentListWithSizes% | A string containing all attachment file names & sizes separated by commas eg: 'document1.pdf (2mb), document2.pdf (500kb)' |
%Msg_CharSet% | The character set of the incoming message. |
%Msg_MessageId% | The unique message identifier from the Message Source. |
%Msg_MessageStoreId% | The unique id assigned to the message by ThinkAutomation and used as a unique key in the Message Store database. |
%Msg_ConversationId% | A hash of the From & To email addresses (sorted) and Subject. This provides a key that matches other message store messages from/to, or to/from the same email addresses and subject. |
%Msg_WordIndex% | Unique keywords extracted from the message body (comma separated excluding common words). |
%Msg_WordIndexSorted% | Unique keywords sorted by word count (highest first). |
%Msg_WordIndexWithCount% | Unique keywords with word count. |
%Msg_WordIndexWithCountSorted% | Unique keywords with word count sorted (highest first). |
%Msg_ValidationUrl% | A link to the user response web page for the current message. Used by the Wait For User Response action. |
%Msg_ResultsUrl% | A link to the Automation return value served via the Web API. |
%Msg_ViewUrl% | A secure hashed link to a web page showing the current message served via the Web API. |
%Msg_ViewUrlLocal% | A secure hashed link to a web page showing the current message served locally. |
%Msg_WebCallbackUrl% | A link to a custom webhook callback for the current message. Used by the Wait For Webhook action. |
%Msg_SignatureJson% | A Json document representing contact information extracted the email footer (signature). See: Extract Email Signature |
You can extract other email headers using the Set Variable action with the Extract Header operation or the Extract Field action with the Extract From set to %Msg_Headers%.
ThinkAutomation can recognize a variety of bounced email, automatic replies and unsubscribe replies. If the incoming message is detected as a bounce, automatic reply or unsubscribe the %Msg_BounceType% built-in variable will contain the reason. The %Msg_BounceAddress% will contain the bounced email address.
The %Msg_BounceType% will contain one of the following:
Value | Details |
---|---|
Hard Bounce | The email could not be delivered. |
Soft Bounce | A temporary condition exists causing the email delivery to fail. |
General Bounce | Could not determine if it is a soft or hard bounce. |
Blocked | A bounce occurred because the sender was blocked. |
Auto-Reply/Out-Of-Office | An automated auto-reply or out-of-office notification. |
Transient Message | Such as 'Delivery Status / No Action Required'. |
Subscribe Request | A 'subscribe' request. |
Unsubscribe Request | An 'unsubscribe' request. |
Virus Notification | The email was bounced due to virus. |
Suspected Bounce | A suspected bounce but no other information available. |
Challenge/Response | Auto-response sent by SPAM detector where only verified email address is accepted. |
Address Change Notification | |
Relayed Message | |
Abuse Feedback Report |
The %Msg_BounceType% variable will be blank if the message is not a bounce/auto-reply.
You can also create Solution Constants. These are solution-wide constants that can be used as %variable% replacements on any Automation within a Solution. To create Solution Constants click the Edit Solution button on the ThinkAutomation Studio Explorer ribbon.
You can then specify any number of Constant Name and Constant Value pairs.
For example: If you create a solution constant with name 'VatNumber' and value 'GB12345678'. If you use %VatNumber% on any Action property on any Automation within the Solution, the value 'GB12345678' will be replaced when messages are processed.
Global Constants are global to all Automations on all Solutions. To create Global Constants use the Server Settings - Global Constants.
A number of built-in system variables can also be used:
Name | Details |
---|---|
%Date% | The current date. |
%DateYesterday% | Yesterdays date. |
%Time% | The current local time. |
%Hour% | The current local time hour number. |
%Minute% | The current local time minute number. |
%Year% | The current year. |
%DateTime% | The current local date & time. |
%DateTimeUtc% | The current UTC date & time. |
%SQLDate% | The current date in yyyy-mm-dd format |
%SQLDateYesterday% | Yesterdays date in yyyy-mm-dd format. |
%SQLDateTime% | The current local date & time in yyyy-mm-dd hh:mm:ss format. |
%SQLDateTimeUtc% | The current UTC date & time in yyyy-mm-dd hh:mm:ss format. |
%UnixTimeStamp% | The current local date & time in Unix timestamp format (eg: 1676283187). |
%UnixTimeStampUtc% | The current UTC date & time in Unix timestamp format (eg: 1676283187). |
%Timer% | The number of elapsed seconds and milliseconds since midnight (eg: 51812.5037012). |
%DayNumber% | The current day of the month number (1-31). |
%DayOfWeek% | The current day of the week name. |
%WeekdayNumber% | The current day of the week number (1=Sunday, 2=Monday etc.). |
%MonthNumber% | The current month number (1-12). |
%MonthName% | The current month name. |
%LastErrorText% | This will contain a description of the last error from an action that has failed for some reason. This will be blank if no error has occurred. |
%LastActionExecutionMs% | This will contain the number of milliseconds the previous (non-comment) action took to execute. |
%FreeDiskSpace% | The current system drive free space in bytes. |
%Root% | The solution root folder. Corresponds to: ProgramData\Parker Software\ThinkAutomation.NET\%SolutionName%\ |
%AutomationLog% | The current Automation execution log for the message. |
%MessageSourceName% | The name of the Message Source for the current message. |
%MessageSourceType% | The type of Message Source for the current message. This will be one of: Email, Database, File, WebForm, WebChat, SMS, Http, Azure, Graph, Static or API. |
%AutomationName% | The name of the Automation executing for the current message. |
%AutomationId% | The id of the Automation executing for the current message. |
%SolutionName% | The name of the Solution for the current message. |
%SolutionId% | The id of the Solution for the current message. |
%SolutionEmail% | The email address assigned to the Solution. |
%SolutionContact% | The contact name assigned to the Solution. |
%CR% | A carriage return character. |
%LF% | A line feed character. |
%CRLF% | A carriage return and line feed. |
%TAB% | A tab character. |
%DB_Null% | A null value. This can be used on database update action parameter values to specify a null value. Will be replaced with a blank string when used anywhere else. |
You can also create your own constants for each Solution. See the Constants grid on the Solution Properties page. These Constants can be used on any Automation within the Solution.
The %Root% system variable will contain a folder path to:
\ProgramData\Parker Software\ThinkAutomation.NET\%SolutionName%\
For example, if your solution name is 'Orders' and your system drive is 'C:\' then %Root% will contain:
C:\Program Data\Parker Software\ThinkAutomation.NET\Orders\
The %Root% variable replacement is useful for any Actions that need to save files locally. ThinkAutomation ensures that the folder exists and the ThinkAutomation Message Processor service will always have access to it.
For example: If using the Create Document action to create a PDF document you can set the Save To property of this action to %Root%.
The variable replacement %func% can be used to execute a number of inline functions. Inline functions provide shortcuts to some common operations. The function will be executed and the returned value replaced. InLine functions can be used inside any action entry as with regular %variable% replacements.
The format of inline functions is: %func%:FunctionName(Value[,parameter][,parameter])
The value & parameters can be any fixed text or a %variable% replacement. If a parameter value contains brackets (), spaces or commas then it should be enclosed in quotes.
For example, in the text:
Dear %func%:ToProperCase(%fullname%),
If the fullname variable was set to 'alice bob' - when replaced the text would be:
Dear Alice Bob,
The following functions can be used:
Function | Details |
---|---|
Upper(value) | Converts the value to uppercase. |
Lower(value) | Converts the value to lowercase. |
ToProperCase(value) | Capitalizes each word in value. |
Right(value,count) | Returns the rightmost count characters in value. |
Left(value,count) | Returns the leftmost count characters in value. |
IndexOf(value,searchtext) | Returns the character position where searchtext occurs in the value. |
Clean(value) | Returns the cleaned version of value. All control characters are removed. |
PlainText(value) | Returns the plaintext version of value. If value contains HTML then all HTML tags are removed. |
Html(value) | Returns the value as is - without any HTML encoding. Useful when embedding %variables% in HTML email content where the %variable% content is already html. |
Trim(value) | Returns the trimmed version of value. |
Line(value,linenumber) | Returns the specified line of text if value contains multiple lines. Line numbers start at 1. |
RemoveWhiteSpace(value) | Returns value with all repeated space and control characters removed. |
Truncate(value,count) | Returns value truncated to a maximum length of count. |
TruncateWithEllipsis(value,count) | Returns value truncated to a maximum length of count with ellipsis characters at the end. |
SubString(value,start [,number]) | Returns the substring of value starting at position specified in start (zero based). If number is specified then the number of characters from the start position is returned, otherwise the characters from start until the end of the value are returned. |
Replace(value,find,replacewith) | Returns the value with the find parameter replaced with the replacewith parameter. |
PadLeft(value,characters) | Returns the value padded with spaces to the left if required to reach the total number of characters. |
PadRight(value,characters) | Returns the value padded with spaces to the right if required to reach the total number of characters. |
Format(value, formatstring) | Returns the formatted value using the formatstring. Formatstring can be any .NET format string. |
Length(value) | Returns the number of characters contain in the value. |
Lines(value) | Returns the number of lines of text contained in value. |
EmailAddress(value) | Returns the first email address found in value. |
Url(value) | Returns the first URL found in value. |
Base64Encode(value) | Returns the base64 encoded version of value. |
Base64Decode(value) | Returns the text value of the base64 encoded value. |
URLEncode(value) | Returns the URL encoded version of value. |
URLDecode(value) | Returns the text value of the URL encoded value. |
DateAdd(value,interval,number) | Returns a date with number of days, months, seconds or years added. The interval should be s=seconds,n=minutes,h=hours,d=day,yyyy=years. |
DateDiff(interval,date1,date2) | Returns a numeric value for the interval between date1 and date2. The interval should be s=seconds,n=minutes,h=hours,d=days,ww=weeks,yyyy=years. |
Day(value) | Returns the day number if value is a date. |
Month(value) | Returns the month number if value is a date. |
MonthName(value) | Returns the month name if value is a date. |
Year(value) | Returns the year number if value is a date. |
HyperLink(value,linktext) | Returns a HTML ref. The first URL or email address found in value will be used for the link URL. The linktext parameter will be used for the hyperlink text if specified. |
PlainTextToHTML(value) | Returns HTML from plaintext. Converts all line-feed characters to , encodes special characters and encloses any URLS or email addresses in tags. |
JsonValue(value,path) | Returns a specific Json path value if value is Json text. |
CSVValue(value,row,col) | Returns a specific row/column value if value is CSV text (assumes CSV data has no column headers). Row and column numbers start at 1. |
CSVWithHeadersValue(value,row,col) | Returns a specific row/column value if value is CSV text (assumes CSV data has column headers). Row and column numbers start at 1. |
Format Examples:
Order Date: %func%:Format(%Msg_Date%,U) :
replaced the text would be:
Order Date: 09 November 2020 09:00:00 :
If a parameter includes a comma you need to enclose it in quotes. Eg:
Order Date: %func%:Format(%Msg_Date%,"hh:mm tt, ddd-MM-MMM yyyy gg") :
Would be:
09:00 AM, Mon-11-Nov 2020 A.D.
Numeric Format
The Price Is: %func%:Format(%Price%,C)
replaced text would be:
The Price Is: £1234.56
Json Extract Example
You can use the %func%:JsonValue inline function to extract a specific Json path value. For example, if you have a variable called 'AddressJson' set to:
xxxxxxxxxx
{
"employee": {
"name": "John",
"salary": 56000,
"married": true
}
}
You could use the inline function such as:
Dear %func%:JsonValue(%AddressJson%,employee.name),
At runtime the replaced text would be:
Dear John,
For Json arrays, such as:
xxxxxxxxxx
["Ford", "BMW", "Fiat"]
You can access an array item directly:
First item %func%:JsonValue(%Json%,[0])
or Second item %func%:JsonValue(%Json%,[1])
or
xxxxxxxxxx
{
"employees":["John", "Anna", "Peter"]
}
Second employee %func%:JsonValue(%Json%,employees[1])
Note: JsonValue uses JsonPath notation. Eg: object.subobject.array[0].name
CSV Extract Example
You can use the %func%:CSVValue inline function to extract a specific row/column value from CSV data. For example, if you have a variable called 'LineItem' set to:
xxxxxxxxxx
1,ABC,Product 1,100.12
2.DEF,Product 2,200.13
You could use the inline funcion:
The price is %func%:CSVValue(%LineItem%,2,4)
At runtime the replaced text would be:
The price is 200.13
Row and column numbers start at 1. If your CSV data contained column headers you would use the CSVWithHeadersValue() function.
An Automation can contain any number of Actions. Each of the actions are optional. You can add multiple instances of each action type - so for example, you can send multiple Outgoing emails by adding multiple Send Email actions.
To add an action double-click an action in the Toolbox, or press ENTER on the selected action. You can also drag and drop an action to the Actions List.
You can also quickly add actions by typing the action name and selecting from the list. Press the TAB or Enter key to select the first action in the list based on the letters you have typed. The new action will be inserted below the currently selected action in the Actions List.
When you add an action the corresponding property page for the action type will be displayed. To edit an existing action double-click it or press ENTER. When editing an action property page, each action property that accepts text data can include %variable% replacements. Drag a %variable% from the variables list on to the property or type the %variable% name. These %variable% holders will be replaced with the Extracted Field, Variable, Built-In Variable or Constant value when the Automation executes. See: Variable Replacements.
When a Message is processed the actions will be executed in the order they appear in the Actions list. You can re-order actions using Move Up/Move Down buttons.
You can create If [else] End If or Select Case blocks to conditionally execute blocks of Actions and you can assign a Condition to each action.
ThinkAutomation includes a default set of built-in actions (shown below). You can also add additional Custom Actions from our on-line library or create your own using the Custom Action Designer
When designing your Automation you should disable the Message Source. This will prevent messages being retrieved until you have completed and tested your Automation. You can still process test messages using the Send Message option even if the Message Source is disabled.
Favorite Actions
If you right-click an action in the Toolbox and select Add To Favorites, the selected action will be added to the Favorites group at the top of the Toolbox. You can remove actions from the favorites group by right-clicking the action again.
ThinkAutomation includes a collection of built-in automation actions for common tasks. You can also download more actions from the Custom Action On-Line Library and you can create your own custom actions using the Custom Action Designer.
Not all actions may be listed here. Parker Software regularly adds new actions.
Extract Field : Parse and extract data from the incoming message and assign the result to a field name.
Set Variable : Assign a value to a variable with various Set Operations.
Execute Script : Execute custom C# or Visual Basic .NET code.
Process Attachments : Automate saving attachments to specific folders on your file system.
Set Message Store Folder : Assign the message to a folder in the Message Store.
Move Incoming Message : Move the incoming email message to a different folder on the source email account.
Comment : Add a comment line to an Automation and optionally save the comment value to the log.
Lookup From A Database : Execute a SQL database query and assign column values to variables.
Open Database Reader : Open a database reader for use with a For..Each block.
Execute A Database Command : Execute a database command or stored procedure.
Update A Database Using Custom SQL : Update or Insert data into a database using custom commands.
Update A Database Using Extracted Fields : Automatically update a SQL database using extracted fields parsed from the incoming message.
Update A Database Using CSV Or Json : Update multiple rows in a SQL database using CSV or Json data.
Update MongoDB : Create or update MongoDB documents.
Lookup From A MongoDB Database : Lookup a document from a MongoDB database and assign it to a Variable.
Embedded Data Store : Save and query data using the embedded Document DB.
Embedded Value Store : Save and retrieve a dictionary of key value pairs using the embedded DB.
Embedded Files Store : Save and query files using the embedded DB.
Embedded Knowledge Store : Save and search for knowledge base articles using the embedded DB. Add relevant articles to a ChatGPT conversation to provide context.
Full Text Search : Save and search text using the built-in full text search database.
Update Excel File : Update a Microsoft Excel file. Append new rows or update specific cells.
Lookup From Excel : Lookup specific cell and cell range values from an Excel file and assign to variables.
Counter : Update a counter value.
Send Email : Send an outgoing email immediately or on a scheduled future date.
Remove Scheduled Outgoing Message : Remove pending scheduled emails for a given recipient.
Forward Original Message : Forward the incoming message and optionally add or drop attachments.
Wait For User Response : Request confirmation from a user before continuing execution.
Send Appointment : Creates an appointment in any iCalendar compatible Calendar Server.
Send Slack Message : Send a message to a Slack channel.
Send Tweet : Send a Tweet to Twitter or reply to an incoming Tweet.
Create Document : Create a formatted document and save it in various formats.
Create Spreadsheet : Create a spreadsheet and save it in various formats.
Convert Document : Convert Word, Open Document, Excel, PDF, Richtext, Text, Markdown Text, CSV or HTML documents or attachments to PDF, Word, HTML, image or text.
Convert Document To Text : Convert PDF, Word, Open Document, Excel, Richtext or HTML documents or attachments to plain text or extract PDF form data.
Convert Image To Text Using OCR : Convert an image file or attachment to text using optical character recognition (OCR). Can also extract images from PDF files and convert these to text.
Convert PDF Document : Convert a PDF document or attachment to image files, text or HTML.
Append To PDF Document : Appends document content or text to a PDF document.
Convert PowerPoint Document : Convert a PowerPoint document or attachments to image files or PDF.
Sign PDF Document : Add a digital signature to a PDF document.
Save As PDF : Save the incoming message, image or any HTML file or URL as a PDF document.
Word Merge : Performs a mail merge on a Word document or attachments and saves the merged document as a new file.
Print : Automatically print the incoming message, attachments or specific documents.
Run A Report : Create a report using a pre-defined report template and export it to various formats.
Get/Update Contact : Get or update a contact for an Office 365 account.
Create Appointment : Create an appointment for an Office 365 account.
Update Incoming Message : Set flags and/or modify the subject on the incoming Office 365 source message.
Get User Presence : Get current presence information (availability and activity) for one or more users.
Send Teams Message : Send a message to a Microsoft Teams Channel.
Create Outlook MSG File : Save the current message or a custom message as a Microsoft Outlook MSG file.
Text Operation : Perform various operations on text values.
Date Operation : Perform various operations on date values.
File Operation : Perform various operations on files & folders.
List Operation : Create, update, sort and get single or all items from generic lists.
Math : Perform mathematical calculations and save the result to a variable.
Encryption : Encrypt/decrypt text data or files.
Compression : Create or unzip Zip files for attachments, files & folders.
Create Hash : Create hash values for text data or files.
Set Message Store Flag : Assign a flag to the message stored in the Message Store.
Message Store Operation : Read a list of message store messages from/to & to/from two email addresses, search the message store and other operations.
Set Logging Level : Set the amount of detail recorded in the Automation log.
Create Passcode : Create a random Passcode and assign the value to a variable.
Find and Replace : Finds and replaces text in any variable.
Read/Write Text File : Save data to a text file or read an existing text file and assign the content to a variable.
Tokenize : Tokenize any text and assign the comma separated tokens to a variable.
Extract Address Parts : Parse a postal address and extract specific address parts.
Extract Email Signature : Parse contact and company information from email signature footers.
Text To Speech : Convert text to a speech WAV file and return the WAV file path to a variable.
If Block : Conditionally execute a one or more actions based on a Condition.
Call Automation : Call another Automation with a value and assign the return value to a variable.
Return : End execution of the Automation and return a value.
End Processing : End execution of the Automation without returning a value.
For Each : Create a loop on various properties and execute Actions inside the loop.
Select Case : Conditionally execute a one or more actions in the matching Case block.
Go To Label : Move processing to a label.
On Error : Control what should happen if an error occurs on subsequent actions.
Create Web Form Redirect : For Automations called from a Web Form Message Source. Redirect the submitted form to another ThinkAutomation Web Form or URL.
Create Chat Input Request: For Automations called from a Web Chat Message Source. Create a set of buttons or form fields to send back to the chat to provide the user with a multiple choice response or specific data entry.
DNS Lookup : Perform a DNS Lookup and assign the returned data to a variable.
Ping : Ping any host and return the results to a variable.
Execute Secure Shell Command : Execute SSH commands against any host and assign the response to a variable.
Get CRM Entity : Read entity values from Microsoft Dynamics, Salesforce, Sugar or Zoho CRM.
Update CRM Entity : Add or update Microsoft Dynamics, Salesforce, Sugar or Zoho CRM entities.
Query CRM Entities : Perform a generic query to read one or more CRM entities as Json text, CSV or Markdown.
Xero Contact : Read, create & update Xero Accounting contacts.
HTTP Get : Read any web page or web API and assign the returned content to a variable.
HTTP Post : Post data to any web page or API.
Download File : Download a file via HTTP and return the local path to a variable.
OAuth SignIn : Obtain a authorization token from an OAuth endpoint for use on subsequent HTTP actions.
Cloud Storage : Download, Upload or Delete files using cloud storage providers (Amazon S3, Google Drive, Google Cloud Storage, Microsoft OneDrive, IBM Cloud Storage, Wasabi, Digital Ocean, Linode).
Wait For Webhook : Wait for a 3rd party webhook call.
Call A Soap Web Service : Execute a SOAP or .NET Web Service and assign the results to variables.
Check SSL Certificate : Check the validity and expiry date for the SSL certificate used on any host/URL.
FTP Upload : Upload files or attachments to an FTP or SFTP server.
FTP Download : Download files from an FTP or SFTP server.
Get Browser Info : Extract browser name, version and operating system info from a User Agent.
Wrap HTML : Wraps text inside HTML tags with optional styling.
Web Spider : Crawls a web site and returns a list of all URLs found.
Create JSON : Create a Json Document and assign it to a variable.
Update JSON : Create or update multiple Json paths within Json text and return the updated Json to a variable.
Read JSON Document : Parse a JSON document from any URL and assign element values variables.
Convert JSON To HTML : Convert Json to a readable HTML table and assign the HTML to a variable.
Update CSV : Add a row to a CSV file or variable containing CSV data.
Read CSV : Read a CSV file or variable containing CSV data.
Parse CSV Line : Extract column data from a comma separated text value.
Convert CSV To HTML : Convert CSV data to a readable HTML table and assign the HTML to a variable.
Translate : Translate text from one language to another and assign the result to a variable.
Detect Language : Detect the language of any text and assign the language code to a variable.
Speak Text : Return a URL of a WAV or MP3 file containing spoken text in the desired language.
GeoIP Lookup : Perform a GeoIP lookup for any IP address, URL, domain name or email address. Assign the Country, Region and City information to variables.
Country Lookup : Lookup country details for country name, code or dial code. Assign the Country Name, Code, Dial Code, Dial Prefix and Currency Code to variables.
Twilio Make A Telephone Call : Make a telephone call and optionally connect the call to another number.
Twilio Send SMS Message : Send a SMS message via Twilio.
Twilio Wait For SMS Reply : Send a SMS message via Twilio and wait for a reply.
Normalize Phone Number : Convert a phone number to the correct internationalized version.
ChatGPT : Send a prompt to ChatGPT or OptimaGPT and assign the response to a variable. Prompts can be assigned a Conversation Id if previous prompts/responses should be included when part of a conversation.
Score Sentiment : Perform Sentiment Analysis using the built-in sentiment analyzer on any text and return the score to a variable.
Train Sentiment : Train the Sentiment Analysis database.
Classify Sentiment : Assign the most relevant sentiment class name for any text to a variable.
Azure File : Download or Upload files to Azure Storage shares.
Azure File Get Link : Get URLs to files in an Azure Storage share and assign to a variable.
Azure Cosmos DB : Update Or Query Documents In A Cosmos Container.
Azure Blob : Get or Put Azure Blobs.
Azure Table : Get or Put Azure Table Entities.
Azure Queue : Get or Put Azure Queue Messages.
Azure Form Recognize : Extract text, key-value pairs and tables from documents, forms, receipts, invoices and business cards using the Azure Form Recognizer service.
Execute PowerShell : Execute PowerShell commands and assign the results to a variable.
Run A Program : Execute a Windows executable file and assign the output to a variable.
ThinkAutomation also includes Custom Actions. These are additional actions you create or download from our on-line library. You can add actions from the on-line library for use on any of your Automations.
To explore the online library, click the Custom Actions tab on the ThinkAutomation Studio ribbon and then click Explore Online Library button.
You can then view custom actions in the online library. Use the Search box to search for specific terms. Select a custom action that you wish to use and then click Install. This will download the custom action from the online library and add it to your local library. The custom action can then be used on any of your Automations in the same way as the built-in actions.
ThinkAutomation Professional Edition includes the ability to create your own custom actions using the Custom Action Designer. The Custom Action Designer includes a UI builder for configuring the action settings and a C# or VB.NET editor for editing the execution code. Once a Custom Action has been created it appears in the available actions list and can be used like any other action on any Automations. You can also share your custom action with the ThinkAutomation community.
For each Automation you can create any number of Extract Field actions. An Extracted Field is a distinct piece of data that ThinkAutomation will parse and extract from the incoming message, and assign it a field name. You can use these extracted field values on other action properties using %variable% replacements.
To create an Extracted Field drag the Extract Field action to your Automation.
You can create multiple Extract Field actions using the Create Extracted Fields From Text/Json button on the Automation toolbar. This option allows you to paste some text or Json and then create the Extract Field actions to extract each item.
Paste a sample of the text or Json you want to extract from. You can also specify the Extract Fields From variable - this should be set to the variable you will be extracting from. You can optionally set the Database Table Name if you will be using the Update A Database Using Extracted Fields action.
When extracting from Json you can also optionally specify a Start At Path. For example, suppose we want to create Extracted Fields the contact section only of the following:
x{
"events": [
{
"id": "EVWB66IXJICNYVGN3JAKVBEYP523WE",
"processed": false,
"created": 1674055179966,
"type": "account.created",
"live": true,
"data": {
"id": "kssbzdB-RZigU84gp7ycyQ",
"account": "kssbzdB-RZigU84gp7ycyQ",
"contact": {
"first": "TestFirstName",
"last": "TestLastName",
"email": "test@test.com",
"company": "Test Company",
"phone": "4075452118",
"subscribed": true
}
}
}
]
}
You would set the Start At Path to events[0].data.contact
Extracted Fields would then be created for first, last, email, company, phone & subscribed only. You can then repeat the process for other sections.
Click the Create Extracted Fields button to create the Extract Field actions..
A preview of the Extract Field actions created will be shown. You can test the extractions using the Test button.
Click OK to save. The Extracted Field actions will be inserted into your Automation below the currently selected line.
Logical operations allow you to control the flow of actions, call other Automations and conditionally execute actions (or blocks of actions).
The Call action enables you to call another Automation with a value and assign the return value to a variable. Select the Automation to call - this must be within the same Solution or an Automation saved to the Library. From the With Message Body Set To list - select the variable to pass to the called Automation. The called Automation will receive this value as its incoming message body value (%Msg_Body%). Other message properties (%Msg_Subject%, %Msg_From%, %Msg_To% etc.) will inherit the values from the currently executing message.
Passing HTML
If the With Message Body Set To entry is set to a %variable% containing HTML, then this will be available in the called Automation in the %Msg_HTML% built-in variable. The %Msg_Body% built-in variable will be automatically set to the plain text version of the HTML.
Passing Files
You can also optionally add attachments. Add one or more files (or %variables% containing file paths) in the With Attachments entry. Enable the Include Incoming Attachments and/or Include Incoming Inline Attachments options to include attachments contained with the currently executing message. You can enter a file mask in the Attachments Mask entry to only include matching attachments (eg: *.pdf).
Passing The Complete Currently Executing Message
If you want to pass the original message in its entirety you can set the With Message Body Set To entry to %Msg_Mime%. This will pass the currently executing message with no changes.
Automations can return a value using the Return action. Enable the Wait For Completion option and select the variable to receive the returned value from the Assign Return Value To list. The current Automation will wait until the called Automation has completed.
If Wait For Completion option is not enabled, then a new message for the selected Automation will be added to the process queue. The current Automation will continue without waiting for the new message to be processed.
If the Wait For Completion option is not enabled then you can optionally enable the Scheduled Execution option. You can specify that the call should execute After x minutes, hours or days or At a specific date/time. If scheduled execution is enabled then the new message will be added to the process queue - but will not be executed until the specified execution time. Called Automations waiting to be executed will show in the Outbox list when viewing the Message Store using the Studio. You can delete pending messages if you need to cancel execution.
The Scheduled Execution option is useful if you have some actions in your Automation that you need to execute at a certain time or be delayed. You can place these actions in their own Automation and use the Call action with the Scheduled Execution option.
Called Automations can also call other Automations. An Automation cannot call itself. You should ensure that called Automations do not in turn call the parent (which would result in a loop).
If you have created a generic Automation that would be useful to other Automations across all of your Solutions, then you can save it to the Library. Any Automation saved to the library can be called from any other Automation in any of your Solutions.
Ends execution of the Automation and returns a value. If this is the parent Automation for the incoming message then the returned value will be saved with the current message in the Message Store - otherwise the value will be passed back to the calling Automation.
Automations do not have to return a value. If all actions complete for an Automation then it will return automatically with a blank return value.
You can have multiple Return actions in an Automation inside If..Else..End If or Select Case blocks allowing you to return different values depending on conditions.
The return value can be fixed text or %variable% replacements or a combination. For example, the return value can be set to: 'New Order: %OrderNumber% For Customer %CustomerName%'.
Returned values are stored against the processed message in the Message Store unless the Don't Save Return Value With Message In Message Store option is enabled.
You can view the Message Store to see returned values for each message. The return value will also be displayed if you use the Send Message option in the Studio to manually send a message to an Automation.
Showing Return Values On Web Form Message Sources
If you use the Web Form message source then the return value can also be displayed to the web user after the form is submitted. Enable the Wait For & Include Automation Return Value In The Confirmation Message option on the Message Source Web Form properties.
If the return value contains HTML (eg: 'Your order number is: <strong>%OrderNumber%</strong>') it will be formatted when shown to the user. If the return value is Markdown then the markdown will be converted to HTML (eg: 'Your order number is: **%OrderNumber%**').
You can also include a redirect in the return value if you want another Web Form or URL shown after the form is submitted. See the Create Web Form Redirect action.
Returning The Return Value On API Message Sources
If you use the API message source then the return value can be returned to the calling HTTP GET or POST request. If the &results=true
querystring parameter is added to the API request then request will wait for the Automation to complete and the Automation Return value will be returned. Depending on the content of the Automation Return value, the result content-type will be served as plain text (text/plain), HTML (text/html) or Json (application/json). If the Return Value contains Markdown text it will be converted to HTML first. If the Return Value is already HTML it will be returned as HTML. If the Return Value is Json it will be returned as Json.
Providing A Link To The Automation Results
The %Msg_ResultsUrl% variable returns a static link to the Automation return value that a user can access via a web browser. Your Automation could include this variable in an outgoing email. A user can click the link to view the Automation return value at a later date. The %Msg_ResultsUrl% URL is unique for each processed message and contains a secure hash. The link will work for as long as the Message is stored in the Message Store.
Ends execution of the Automation without returning a value.
You can conditionally end execution by including End Processing or Return actions inside If.. End If blocks.
Conditionally executes a group of actions based on a Condition.
When you drag an If Action onto the actions list the Condition Builder will be displayed.
Here you create a Condition that will be tested. The condition must be true to start the If block otherwise processing moves to the next Else or End If statements.
In the If column you select a message variable or one of your Extracted Fields or Variables (you can also type text and have combinations of text and %variables%).
In the Is column you select one of the following Match Types:
Equal To
Not Equal To
Less Than
Greater Than
Less Than Or Equal To
Greater Than Or Equal To
Is Blank
Is Not Blank
Is A Number
Contains
Contains One Of (list of words or phrases)
Contains All Of (list of words or phrases)
RegEx Matches (matches a regular expression)
Does Not Contain
Starts With
Ends With (value
Length Equal
Length Less Than
Length Greater Than
Is A Valid Email Address (check the email address is the correct format)
Is A Valid Email Address With MX Record (check the email address is the correct format AND has a valid MX record)
Is Not A Valid Email Address
Date Only Equal To
Date Only Less Than
Date Only Greater Than
Hour Less Than
Hour Greater Than
Minute Less Than
Minute Greater Than
Weekday Number Equal To
In the Value column enter a value to compare against. This can contain %variable% replacements.
Click the Add button to add another line. The new line can be assigned as an AND or OR clause.
Each If statement must have a matching End If.
If blocks can be nested inside other If Blocks.
You can also assign a Condition to individual actions using the Condition tab of the Action properties page.
Contains / Does Not Contain Wildcards
The Contains and Does Not Contain match types can use wildcards in the value. For example: If value was 'good *,' - then this would match for a string containing 'Good Morning,' AND 'Good Afternoon,'. The Contains/Does Not Contain matches are case-insensitive.
Wildcard character | Matches |
---|---|
? | Any single character |
* | Zero or more characters |
# | Any single digit |
[charlist] | Any single character in charlist |
[!charlist] | Any single character not in charlist |
Contains One Of/Contains All Of Match Types
For the Contains One Of or Contains All Of match types you can enter multiple words or phrases. For Contains One Of the If field must contain at least one of the values. For Contains All Of it must contain all of the values. Both Contains One Of and Contains All Of use case-insensitive matching. Individual words/phrases can contain wildcards.
For example: Suppose we want to check that the message body (%Msg_Body%) contains 'Red' AND 'Blue' AND 'Green' - we would use Contains All Of and set the value to 'Red,Blue,Green'.
Individual words or phrases in the list can contain %variable% replacements. For example, you could use 'Red,Blue,%MyColor%' - %MyColor% will be replaced before the condition is checked.
Word Matches
By default the Contains One Of and Contains All Of match types match text anywhere, so if Contains One Of contained 'request' it would match for 'request' and 'requested' etc. To match whole words only, enclose the word or phrase in square brackets. For example: If we want to check that the message subject contains 'support' AND 'request' we would use Contains All Of and set the value to 'support,[request]'. This would match if the subject was 'New support request', but would NOT match if the subject was 'Support was requested'.
RegEx Matches Match Type
For RegEx Matches match type the value must be a valid Regular Expression. The match will be true if the If value contains one or more matches. For example: To check that the message body contains a ZIP code, set the If to %Msg_Body%
and use the RegEx Matches match type with the value set to *\b\d{5}(?:[-\s]\d{4})?\b*
Comparing Numeric Values
If the If value and the value both contain numeric values then the Equal To, Not Equal To, Less Than, Greater Than, Less Than Or Equal To and Greater Than Or Equal To comparisons compare the numeric values rather than string literals. So '1000.00' and '1,000' would be evaluated as equal.
Comparing Date Values
Where the If value is a date or datetime (for example: %Msg_Date%), you can use:
Date Only Equal To/Less Than/Greater Than : where value is also a date or datetime. Compares the date only portions (ignoring the time).
Hour Greater Than/Less Than : where value is a number. Compares the hour value of the time.
Minute Greater Than/Less Than: where value is a number. Compares the minute value of the time.
Weekday Number Equal To : where value is a number. Compares the day of week value (0=Sunday,1=Monday..6=Saturday).
You can also use other match types (Equal To, Not Equal To, Greater Than etc) where the If value is a date/datetime and the value is a date/datetime. In these cases the dates are converted to yyyy-mm-dd hh:mm:ss format and then compared.
Example If Block
xxxxxxxxxx
If %Msg_To% Contains support Then
If %Msg_Subject% Contains One Of urgent,ticket Then
// Support Email
If %Msg_Date% Hour Greater Than 8 And %Msg_Date% Hour Less Than 18 Then
// Day time
Send Teams Message To Support Team "Support Request: %Msg_Subject%" For User Support
Else
// Out of hours
Send Email To outofhours@mycompany.com "Support Email: %Msg_Subject%"
End If
End If
End If
Creates a Select Case block to conditionally execute a group of actions in the matching Case block.
When you drag a Select Case action onto the Actions list you will be asked for a Value. Enter a value or a %variable% replacement.
A Select Case block will then be created.
Click a Case action to define the condition for each Case statement.
The Is can be:
Equal To
Not Equal To
Less Than
Greater Than
Less Then Or Equal To
Greater Than Or Equal To
Contains
Does Not Contain
Contains One Of (list of words or phrases)
Contains All Of (list of words or phrases)
Starts With
Ends With
Else
Enter a Value or %variable% replacement to compare against the Select Case Value.
If the Select Case Value matches the Value of the Case statement then the Actions in the Case block will be executed. Drag any number of actions inside the Case block to execute. Execution will then move to the End Select action.
You can drag additional Case actions to the Select Case block.
The Case Else block will be executed if no matched Case actions are found.
Each Select Case block must have at least 1 Case action and end with an End Select.
Select Case blocks can be nested - so the Case actions can include further Select Case blocks.
Contains / Does Not Contain
The Contains and Does Not Contain match types can use wildcards and are case-insensitive.
Contains One Of/Contains All Of Match Types
For the Contains One Of or Contains All Of match types you can enter a list of words or phrases. For Contains One Of the Select Case Value must contain at least one of the values. For Contains All Of it must contain all of the values. Both Contains One Of and Contains All Of use case-insensitive matching. Individual words/phrases can contain wildcards.
Allows you to create a loop based on the following:
Message Recipients (All, To, CC or BCC)
Message Attachments (Regular Attachments, Inline Attachments only or both)
Message Keywords
Message Headers
Extracted Fields
List values contained in a List (See: List Operation)
Lines contained in any variable
Comma Separated Values contained in any variable
Email addresses, URL's and Tokens contained in any variable
Data Reader Rows (See: Open Database Reader)
Json Member in
Variable Value
Inside the loop you can assign the values of the current loop item and current iteration count to variables. You can then use these values in actions within the loop.
For example, when looping on Recipients you can assign the Email Address & Name of the current recipient in the loop to variables by selecting from the Assign To drop downs.
When looping on Lines the Lines In will be split into lines (based on carriage returns and/or line feeds). Each non-blank line will then assigned to the loop value.
When looping on Comma Separated Values In, the In value will be split on commas. Quoted values will be handled. For example, if Comma Separated Values In contained:
1997,Ford,E350,"Super, luxurious truck"
.. then the loop would be executed 4 times with values:
1997
Ford
E350
Super, luxurious truck
When looping on Json Member In the In value can be assigned any Json text. The loop will execute for each member. The Start At Path can be optionally set to a Json path (using dot notation). You can assign each member Name and Value to variables. See: Looping Through Json Member Values Using For..Each
When looping on Tokens the Tokens In value will be split into words and tokens.
When looping on Keywords the incoming message body will be split into unique words (excluding common words).
When looping on a Variable Value - this assumes the variable is numeric. The loop executes n times - where n is the variable value.
You then place actions to execute inside the For Each - Next Loop block.
Exit Loop
You can exit a loop using the Exit Loop action. This can be placed in an If block if you need to exit a loop based on a condition. Processing will continue with the action following the Next Loop action.
Continue Loop
The Continue Loop action moves processing to the Next Loop action. The loop will continue with the next iteration of the loop - or exit the loop if there are no more iterations. You can place the Continue Loop action in an If block if you need to move to the next iteration based on a condition.
You can create multiple Label actions within an Automation. Each Label is given a name. You can use the Go To Label action to move processing to the label specified. Labels cannot be placed inside If, Select Case or For Each blocks.
Automations can contain any number of Comment actions. By default comments do nothing.
You can space out Actions in your Actions list by adding blank comments.
If the Show In Log option is enabled then the comment value will be added to the Automation Log (regardless of the current Log Level). The Comment text can contain %variable% replacements. Comment text will be truncated if longer than 1000 characters.
If the Show Notification In ThinkAutomation Studio option is enabled then the comment will appear in the ThinkAutomation Studio for any active Studio users as a notification when the Automation executes. The Message Processor will limit studio notifications to 500 per processed message to prevent the Studio being overloaded.
If you have used the Studio Send Message option to send a manual message to an Automation then any Comment actions will show in the response, regardless of the Show Notification In ThinkAutomation Studio or Show In Log options.
The On Error action enables you to control what should happen if an error occurs on any action following the On Error action. You can add any number of On Error actions to an Automation.
Each On Error action can be set to:
Resume Next - just report the error in the log and continue.
Retry - retry the errored action. You specify the Retry Count and Pause interval. If the action still fails after the retries you have the option of sending an error report email and pausing the Message Source.
Go To Label - move execution to the specified label and optionally send an error report email.
Execute Automation - transfer execution to another Automation.
If no On Error action is used on an Automation then by default ThinkAutomation will stop execution of the current message when an error occurs, send a notification email and pause the Message Source. This enables you to investigate the error before more messages are processed. You must then re-enable the Message Source to continue processing.
The Create Web Form Redirect action is used on Automations called from a Web Form or Web Chat Message Source.
It can be used to redirect the submitted Web Form to another ThinkAutomation Web Form, Web Chat or external URL after the form is submitted. You can also pre-populate field values on the new Web Form with custom values or %variable% replacements created in the Automation.
Using the Create Web Form Redirect action allows you to create interactive forms that display new forms based on values submitted on a previous one.
When you create a web form redirect the redirect details are stored in a ThinkAutomation variable (selected from the Assign To list). You include this %variable% in your Automation Return value to trigger the redirect on the web form. You can create multiple Create Web Form Redirect actions and conditionally return the one you want to execute.
In the Redirect To list select Another ThinkAutomation Web Form or URL. If redirecting to an external URL enter the URL or use a %variable% replacement.
Another ThinkAutomation Web Form Or Web Chat Form
You must now choose another Web Form or Web Chat Message Source that you want to the user to be shown after the current one is submitted. You can create multiple Web Form and Web Chat Message Sources within a Solution. The current Web Form must have the Wait For Automation option enabled.
Pre-Populate New Web Form Fields
You can optionally pre-populate fields on the redirected web form. In the Value column of each field enter a value or select a field/variable. When the new web form is displayed, its field values will be automatically set. You can also define fields on the web form as hidden by default if you want to pre-populate a hidden field.
Delay Before Redirect
If a value (in seconds) is entered here then there will be a delay before the new Web Form is shown.
Assign To
Select the ThinkAutomation variable to receive the redirect properties. This %variable% must be included in the Automation Return value. The Automation return value can also contain other text if you want to display a response to the user. As long as the redirect %variable% is included somewhere in the return value then the redirect will execute.
You can conditionally return different redirects, for example:
xxxxxxxxxx
If %ContactType% Equal To Customer Then
Redirect = Create Webform Redirect To NewCustomerForm Pre-Populate Name=%Name%
Else
Redirect = Create Webform Redirect To NewSupplierForm Pre-Populate Name=%Name%
End If
Return Contact Accepted. One moment please %Redirect%
This action is used on Automations called from a Web Chat Message Source.
It can be used to create one or more buttons or input fields that are returned to the chat session. The user can click a button or input a value to send back a specific response. For example, you could ask 'Which product do you use?' followed by buttons for each product. The user can click one of the buttons to answer the question. Or you could create an input to request specific text, numbers or dates etc.
When you create a chat input request, the form details are stored in a ThinkAutomation variable (selected from the Assign To list). You include this %variable% in your Automation Return value to trigger the form display in the web chat. You can create multiple Create Chat Input Request actions and conditionally return the one you want to be displayed to the user.
In the Ask For Inputs list click Add Input to create an input request.
Select the Input Type. This can be:
Button Response : Shows a button that when clicked submits the text in the Send Response On Click entry. You can change button color using the Button Style selector.
Button Link : Shows a button then when click launches a web URL in the user browser.
Input Field Response : Shows an input field. Click the Edit Properties button to configure the input field. You can specify the Prompt text, field type (text, number, date etc) and any validation rules.
You can create multiple buttons or fields.
Assign To
Select the ThinkAutomation variable to receive the input request properties. This %variable% must be included in the Automation Return value. The Automation return value can also contain other text if you want to display a response to the user above the buttons/form.
When your Automation returns the %variable% containing the input request the buttons and/or form fields will be displayed to the web user in the chat session.
When the user clicks on one of the buttons the Send Response On Click text will be sent back to your Automation (as if the user had typed it).
For input forms, all form field values are sent in a single message, in the format:
xxxxxxxxxx
FieldName: value
FieldName: value
During Automation development you can debug your Automation regardless of the Message Source type.
Before debugging you first set one or more Breakpoints. Select an Automation line and click the Toggle Breakpoint button or click the breakpoint column in the Actions List. If you want to step through the entire Automation, set a breakpoint on the first line.
Once a breakpoint is added click the Debug button on the Automation actions list toolbar. Enter the message text and click Send. You can also drop files onto the send message textbox. Any .eml or .msg files will be converted to emails and sent. Any text files will be converted to message text. Any other sort of files will be added as attachments and sent.
You should send a new message in the format that the Automation expects.
The test message will start processing immediately. The message processor will pause execution at the first breakpoint. The Debug window will show in the Studio. This contains the current value of each variable and the current Automation log.
Once processing hits a breakpoint you can start stepping through your actions:
Click Step Next (or press F8) to continue processing the next action. As you step through the actions the current variable values displayed will be updated. The currently executing line will be highlighted.
Click Continue To Next Breakpoint to process all actions until the next breakpoint (or all remaining actions if no more breakpoints are defined).
Click Stop Debugging to end processing (no more actions will be processed).
The Variable Values list shows each Automation Variable, Extract Field & List names along with their current values. This list will be updated as you step through the actions. If a variable contains multiple lines of text, only the first line will be visible. Click the variable value to view all lines. Only the first 5000 characters of a variable value is shown.
Debugging Notes
If your Automation calls another Automation using the Call action then debugging will automatically switch to the called Automation and return to the parent Automation after the call is completed.
You cannot edit the Automation during debugging. You can open an Action to view its properties however.
Debug messages are processas a separate task so will not affect normal message processing.
Debug messages are processed by the Message Processor as with regular processed messages. If you debug an Automation from the Studio running on a remote computer, the message is still processed by the Message Processor service running on the remote ThinkAutomation server.
When stepping through actions - the Message Processor will wait a maximum of 1 hour for you to continue with the next action before aborting the debug session.
Debug messages are added to the Message Store as with regular messages.
Click the Debug button on the Automation actions list toolbar without setting any Breakpoints. Enter the message text and click Send. You can also drop files onto the send message textbox. Any .eml or .msg files will be converted to emails and sent. Any text files will be converted to message text. Any other sort of files will be added as attachments and sent.
The test message will be processed immediately. The result and Automation Log will be displayed along with any errors and Comment action values.
Use the Comment & Return actions to provide feedback. Comments can include %variable% replacements, so if you need to see the value of a variable - simply add a Comment action containing the %variable% name.
The Automation Return value will also be displayed if you have added any Return actions.
You can reprocess any existing messages stored in the Message Store. See: Viewing The Message Store - Reprocessing Messages.
The ThinkAutomation server automatically keeps a record of all changes made to Automations. You can revert to the previous version by clicking the Revert button on the Automation actions list toolbar. You can continue to do this until the Automation is reverted back to the first version.
The number of revisions stored is set in the Server Settings - Revision Saving.
You can save a copy of any Automation to the Automations Library. You can also create Automations directly in the library. The Call action can call Automations in the library. This is useful when you have a specific Automation that is called from multiple Automations in different Solutions. Rather than creating multiple copies of the same Automation in different Solutions, you can have a single version and call it from any other Automation.
To save an Automation to the library click the Save To Library button on the Automation toolbar.
To view the Library, select Open Library Automations from the Solution selector. You can add/edit/delete Automations in the library.
The Automations Library is also used when creating new Automations. When you select the New Automation button to create a new Automation. The New Automation dialog lists all current Automations and Automations in the library. You can select any of these to create the new Automation from. The New Automation will then be created based on the selected Automation. This is useful when you need a base Automation template to use to create new Automations from.
Click the Explorer Online Library button to open the Online Library Explorer. The Online Automation Library contains sample Automations created by Parker Software and Automations shared by other ThinkAutomation users. You can select an Automation in the online library and click the Install button to download it and add it to your local library.
If you have created an Automation that would be useful to share with other ThinkAutomation users, you can upload it to the online library. First save your Automation in your library using the Save To Library button on the Automation toolbar. Then open the library, right-click the Automation and select Upload To Online Library. The Automation will be uploaded. It will appear in the online library once it has been verified by Parker Software.
You can send manual messages to any Automation regardless of its configured Message Source. Select an Automation in the Explorer view and click the Send Message button on the ribbon. You can specify from/to addresses & subject text. You can also add attachments. Enter the Message Text and click the Send button.
If the Automation has any Extract Field actions you can optionally click the Enter Field Values button. This will display a form where you can enter specific field values.
Messages sent with the Send Message form will be processed immediately. The Return value (if any) for the Automation will be displayed, along with any Comment action values.
You can also drag and drop any file on to the Send Message form. These will be sent to ThinkAutomation for immediate processing. Any text files dropped will be converted into plain text emails. HTML files will be converted to HTML emails. Email messages (EML files) and Microsoft Outlook messages (MSG files) can also be dropped. Any other file types will be added as an attachment to a plain text email before being sent to ThinkAutomation. You can drag & drop multiple files in a single drag/drop operation. Each file will be treated as a separate message.
Network users can also use the ThinkAutomation Desktop Connector to send manual messages for processing. See: The ThinkAutomation Desktop Connector Application for more information.
When editing an Automation click the Properties tab to view/edit general Automation properties:
You can change the Automation Name and Details. These are text fields that can contain any text to describe the Automation. You can also provide a Group Name. Automations with the same group name will appear grouped together in the Explorer view.
You can enable or disable an Automation with the Enabled option. You can also enable/disable an Automation by right-clicking it in the Explorer. If an Automation is disabled no new messages will be processed. Messages will remain in the queue until the Automation is enabled.
The Message Processor service processes Automations. Separate Automations process messages concurrently. By default each incoming message for an Automation is processed one message at a time in the order that incoming messages were received.
If the Allow Concurrent Execution option is enabled then the Message Processor will process multiple messages for the same Automation concurrently. This setting is disabled by default on new Automations. It should not be enabled if the Automation should process messages in the same order that messages are received or that may be updating a file or database that does not support multi-user access. For example: If a Database Pull Message Source reader reads records from a database and the Automation saves those records to a CSV file, then if concurrent execution is enabled there is no guarantee that the CSV rows will be in the same order as the Database Pull records.
When Allow Concurrent Execution is not enabled then separate Automations will still process messages concurrently but a single Automation will only process one message at a time in the order that the messages were received. See Also: Server Settings - Message Processor.
If this option is enabled then any outgoing emails sent using the Send Email action are saved in the Message Store database. You can view Sent Items when viewing the Message Store. Disable this option if you do not need to view sent items. This will improve performance and decrease the size of the Message Store database. Sent Items can be automatically deleted from the Message Store by specifying the retention days on the Solution Properties Keep Sent Items For (Days) entry.
If this option is enabled then any outgoing emails sent using the Send Email action that fail to send (after any retries) will flag the processed message as failed. This Message Source will also be paused and a notification will show in the Studio (if the Pause Message Source On Automation Errors option is enabled). Outgoing emails are sent by the main ThinkAutomation Server and there could be several retries before an eventual fail (for example if your outgoing email server is down). Therefore, the executed message in the Message Source could show as executed successfully, and then later be marked as failed.
You can use the ThinkAutomation Studio to view the Message Store. Messages are added to the Message Store as they are received by the Message Sources. Click the Message Store tab on the ThinkAutomation Studio ribbon.
Messages are viewed by Solution - to change the currently selected Solution - click the Solution drop down menu on the Ribbon.
All Automations within the Solution will be shown. Select an Automation to view processed messages.
Messages are shown in pages of 1000 messages per page. Use the Page <
and >
selectors to move pages or press PgUp/PgDn buttons.
You can search for text using the Search bar. Messages will be searched by Subject, From/To address and Automation Return value. You can use 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.
Click the Filter button to apply additional filters.
You can filter messages by Processed status. Select All, Success Only or Failed Only. The Failed Only filter will only show messages where the Automation generated one or more errors. You can view the last Automation error by hovering over the red (!) icon in the first column of the messages grid. You can also view errors by opening the message and viewing the Automation log.
You can also filter messages by Message Flag. Messages can be assigned a Flag value inside an Automation using the Set Message Store Flag action. You define the Flags using the Server Settings - Message Store Flags option. You can also manually set a flag for a message by right-clicking the message in the list and selecting Set Flag.
You can filter by Date. Enter a From and To date and click the Apply button.
You can also filter the current view by clicking the filter icon in the message column headers.
Double click a message or click the Open button to view the full message body, attachments, headers and the Automation Log for the message. Once the message preview pane is open it will refresh as you select other messages in the grid. You can drag the preview pane outside of the ThinkAutomation Studio. You can then edit an Automation with a previously processed message open. This is useful if you need to view the automation log of a processed message whilst editing the Automation.
Processed Messages can be organized into folders. Each Automation has a root folder. Below each Automation you can create sub-folders (with multip). To create sub-folders, right-click a folder and select Create Sub Folder. To delete a folder, right-click a folder and select Delete. All messages in the folder (and its sub-folders) will also be deleted.
You can move existing processed messages into any sub-folder. Select a message (or range of messages), right-click and select the Move To menu option.
Processed messages can be assigned to a folder during Automation processing using the Set Message Store Folder action.
Individual messages can be reprocessed. Select a message (or range of messages) and click the Reprocess button. The selected messages will be added back to the process queue and processed again by the Automation.
You can remove individual messages from the Message Store or you can remove all messages for the selected Automation/folder.
If you use the Send Email action to send scheduled emails on future dates then these scheduled messages are held in the Outbox until they are sent. The Outbox can be viewed by clicking the Outbox button on the Message Store view. You can remove items from the Outbox to prevent them from being sent.
Any outgoing emails sent using the Send Email action will be shown in the Sent Items view. You can disable outgoing emails being stored using the Automation - Properties - Save Outgoing Emails To Sent Items option.
ThinkAutomation maintains logs for Message Source readers & Automation executions. Click the Logs tab on the ThinkAutomation Studio ribbon. You can then select to view the Server Log, Message Source Log, Automation Log or Current Utilization.
The Server Log entries are created by the ThinkAutomation Server. These are general server logs, not related to specific message processing.
The Message Source Log entries are created by the Message Reader service as new messages are received or created.
The Automation Log entries are created by the Message Processor service as Automation actions are executed.
Log entries will be added in real time. You can filter log lines by clicking the Filter icon in the column headers. For Automation Log entries - double clicking a log entry will open the Automation actions list with the relevant Action selected. The amount of detail recorded in the Automation log can be controlled on a per-Automation basis using the Set Logging Level action. You can also set a default level using the Server Settings - Logging setting.
The Logs tab displays the most recent log entries. You can also view Automation logs for specific processed messages by viewing the Message Store, opening a message to view the detail and selecting the Automation Log tab.
ThinkAutomation will automatically delete old log entries - depending on the Keep Messages For (Days) entry on the Solution properties. Logs will also be removed if you manually remove messages from the Message Store.
The Enable Debug Logging button on the Logs tab will switch on debug-level logging for all Automations for a defined number of minutes. This is useful during Automation development if you need to see more detail in the logs regardless of the current logging level. Logging will revert to previous levels automatically after the Minutes specified.
Click the Logs tab on the ThinkAutomation Studio ribbon, then click the Current Utilization button. This will display charts showing the current ThinkAutomation CPU percentage, Memory Used and currently queued message counts.
Find and extract data from the incoming message body or a variable and assign the extracted data to a field name. The extracted data can then be used on any other Automation action setting using %fieldname% replacement (see: Variable Replacements).
Enter a Name for the field.
Helper Message
When creating your first Extract Field action it is a good idea to paste a sample copy of the message body you are extracting data from into the Helper Message box. ThinkAutomation will then highlight the data it will extract for each field as you specify the extraction properties. The Helper text will be saved with the Automation - so you only need to paste it once. Each set of extract field actions with different Extract Field From values can have their own Helper Message text. For Database message source types the Helper Message text will be auto populated when you use the Test query option.
Extract Field From
Select the variable that you want to extract data from. This defaults to %Msg_Body% - which means extract data from the plaintext body of the incoming message. You can change this to %Msg_Subject% to extract from the subject or %Msg_Headers% to extract from the headers etc. You can also select any of your own %variables% to extract data from text created previously in your Automation.
You have four options for setting the field value:
Find & Extract : To find and extract distinct values from the Extract Field From data by looking for markers.
Extract From Json : To extract a specific Json path if the Extract Field From contains Json data.
Extract Using Text Range : To extract a text block from the Extract Field From data at specific left, top, right, bottom character coordinates.
Extract Built-In Variable : To set the field value to a message variable, system variable or Solution constant.
Select the Find & Extract option to find and extract distinct values from the Extract From data.
Start From Last Extract Point
Normally ThinkAutomation moves the 'extraction point' as it moves through the Extract From value extracting data for each Extract Field action. Disable this option if you want ThinkAutomation to start from the beginning of the data when it looks for this field. Once a field is extracted the extraction point will be set to the end of the extracted data for the next Extract Field action. The next field extraction starts from this point unless you disable this option.
Case Sensitive
By default ThinkAutomation ignores case when it looks for fields. So 'order number' and 'Order Number' will both match when searching for 'Order number'. Enable this option if you want to perform a case sensitive search.
Is Repeating Block
This option sets the field as a repeating block. If set ThinkAutomation will enter a loop and repeat the extraction of this field until it finds the next field to extract (or the end of the message). You can Call another Automation with the results of each block loop to perform further actions/extraction.
Look For
Enter the text that ThinkAutomation should look for when searching the data for this field. This should be the text that is the same for each message and uniquely identifies the field.
Then Look For
Enter an additional text string that ThinkAutomation looks for AFTER it has found the above text. This is optional, but is useful when data is formatted in the message using an unknown number of tabs or spaces. Consider the following line:
xxxxxxxxxx
Customer code : ABC
We would search for 'Customer code' and then ':' because we don't know how many spaces are between 'Customer code' and ':'. The field extraction would then start after the ':'.
In both the Look For and Then Look For entries you can make use of Regular Expressions to assist with searching. You can also use %variable% replacements using Fields/Variables previously extracted or set.
Find Next None-Whitespace
You can set the Look For or Then Look For to a single star '*' - a single star means find the next none-whitespace character.
This can be useful when searching for data. For example, suppose the text contains:
xxxxxxxxxx
Your serial number is:
1234-5678
If we wanted to extract the Serial Number we would be to look for 'Your serial number is:' and then look for '*' - which would effectively look for any none whitespace after 'Your serial number is:'.
Find Blank Line
You can set the Look For or Then Look For to '<BlankLine>' or you can include it, eg: 'Customer: <BlankLine>'. The <BlankLine> marker searches for a single blank line. A 'blank line' is LF + LF or CRLF + CRLF. To find multiple blank lines use '<BlankLine><BlankLine>'
Select the Extract From Json option if the Extract Field From contains Json data. You can easily find and extract a specific Json path. Enter or select the Json Path. If Json sample data has been pasted into the Helper Message then the paths list will be populated automatically.
Note: Paths use JsonPath notation.
If the selected Path is an array then you can extract a single array value or all values. Enable the Extract All Array Values To CSV to extract all array values to a CSV string. For example, consider the following Json:
xxxxxxxxxx
{ "cars":[ "Ford", "BMW", "Fiat" ] }
Setting the path to 'cars[0]' would extract the single value "Ford". If Extract All Array Values To CSV is enabled then the extracted value would be "Ford,BMW,Fiat".
If the Json array contains no enclosing object (eg: ["Ford","BMW","Fiat"]) then use paths: array[0], array[1] etc.
If the Extract Field From contained:
xxxxxxxxxx
{
"cars": [
{
"Name": "Ford",
"Color": "Green",
"Model": "Focus"
},
{
"Name": "BMW",
"Color": "Blue",
"Model": "3 Series"
}
]
}
Setting the path to 'cars' or 'cars[0]' and enabling Extract All Array Values To CSV would extract:
xxxxxxxxxx
Ford,Green,Focus
BMW,Blue,3 Series
Setting the path to 'cars[0].name' and enabling Extract All Array Values To CSV would extract "Ford,BMW"
Whilst setting the path to 'cars[1].name' and not enabling Extract All Array Values To CSV would extract 'BMW'.
You can use the Parse CSV Line action to further process CSV data.
Select the Extract Using Text Range option to extract a block of text from the Extract Field From data at specific Left, Top, Right & Bottom character coordinates.
This option is useful where data is always in the same place - but has no specific markers to easily find and extract. An example would be an 'address' block on a invoice/quote etc where the text has been converted from a PDF document.
For example, if the Extract Field From contained:
xxxxxxxxxx
1 Purchase Order No. PO0000000051040
2 Date 1/12/2023
3
4 PURCHASE ORDER
5
6 Ship To:
7 Test Customer Name Inc Test Customer
8 4767 New Broad Street 1100 Pontiac Ct
9 Baldwin Park
10 Orlando FL 32814 Export PA 15632-9066
11
If we wanted to extract the customer address we would set the coordinates to: left=9, top=7, right=60, bottom=11. We would extend the right & bottom values to ensure all values are extracted. If the Clean And Trim Blanks option is enabled then the extracted value would have any blank lines above or below removed after extraction and each line trimmed.
When extracting postal address blocks you can use the Extract Address Parts action to then extract specific address data.
When defining the coordinates you can select the text you want to extract in the Helper Message - the coordinates will then be automatically set to the selected range. Ranges can be on a single line or span multiple lines.
You can also set the field value to any of the built-in message variables, system variables or solution constants. Select the Extract Built-In Variable option and select the variable to use.
Click the Extract Data tab to define how ThinkAutomation will extract data for this field once it has found it.
For the Find & Extract option, there are a number of options you can use to extract data (all options start the extraction after the Look For, and optionally Then Look For text):
Until End Of Line
Extract all data up to the end of the line (or the end of the data if there are no more lines).
Until End Of Message
Extract all data up to the end of the data.
Until Any Of These Characters
Extract data until any of the following characters are found. You can then specify a list of characters to search for. If any one of the characters are found then extracting will stop. You can include the following markers:
Marker | Details | Example |
---|---|---|
<CR> | A carriage return character | " ,<cr>" - look for space, comma or carriage return. |
<LF> | A line feed character | " :<lf>" - look for : or line feed. |
<TAB> | A tab character | " <tab>" - look for a space or a tab. |
<ESC> | An escape character | " <tab><esc><cr>" - look for a space, tab, esc or carriage return. |
<CRLF> | A carriage return + line feed | "<tab><crlf>" - look for a tab or carriage return + line feed. |
<NEWLINE> | Either CRLF or LF | "<newline>" - look for any line ending. |
<BLANKLINE> | A blank line | " <blankline>" - look for a space or a blank line. |
<END> | End of data | " ,<cr><end>" - look for space, comma, carriage return or end of data. |
Until These Characters
Extract data until specific words or characters are found. You can then specify characters, words or phases to search for. Extraction will stop when the words are found. Regular expressions permitted. You can use the <BLANKLINE>
marker to search up to the next blank line.
Until These Many Characters
You can manually specify a number of characters to extract.
Until End Tag
Select this option if you are extracting HTML or XML tags. If the Look For value is a tag, for example: <mytag>
then ThinkAutomation will extract up to the end tag </mytag>
. This option will be automatically selected on new fields if you enter a tag in the Look For entry.
Use The Look For Expression
Select this option to extract the field INCLUDING the Look For expression. This is useful when you want to find AND extract using a regular expression. The data would be extracted starting from the Look For value. For example, if the 'Look For is set to the regular expression: [a-zA-Z0-9._-]+@[a-zA-Z0-9_-]+\.[a-zA-Z.]+
(which is the regular expression for an email address) and the Use The Look For Expression option is enabled.. then the first Email address will be found AND extracted. If the Use The Look For Expression is not enabled then the first email address will be found and extraction will start AFTER the end of the email address.
The Extract 'Until' options do not apply if you are using the Extract From Json option.
Clean And Trim Blanks
Enable this option if you want the extracted data to be cleaned and trimmed. This will remove any leading or trailing spaces, tabs and carriage return/line feed/control characters from the field data.
Remove First/Last
You can also select to remove a number of characters from the beginning and end of the extracted data.
Select the Attributes tab to define optional additional attributes for the field.
Field Data Type
Select the Field Data Type from the list. After the field is extracted the value will be converted to the appropriate type.
For the Boolean type field the value will be set to 'True' or 'False' only. The field value will be set to 'True' if the extracted data is any of 'true','yes','on','y','1' (case insensitive) and 'False' otherwise.
If the any of the numeric types are selected then the numeric value of the extracted value will be assigned. If the extracted value cannot be converted to a number of the selected data type then no data will be assigned.
For Decimal, Single and Double types you can also set the Decimal Places. The extracted value will be rounded up to the specified number of decimal places. If Decimal Places is zero then no rounding will be applied.
For the Date type the date will be extracted and assigned in yyyy-MM-dd
format or yyyy-MM-dd HH:mm:ss
format for the DateTime type.
If you are using Update A Database Using Extracted Fields action you should select the correct type matching the column in your database.
Max Length
You can optionally specify the maximum allowed field length for the field. ThinkAutomation will truncate the field if the extracted data is greater than the maximum length. Use this option to avoid database errors that will be raised when field data is inserted into your database that is greater than the defined length. This option applies to String and Text field types only. Set to zero if you do not want ThinkAutomation to truncate the field.
Default Value
Enter a value that will be assigned to the field if no data is found or the extracted value is blank.
Case
This option allows you to change the case of extracted value or to apply Word Capitalization.
Validate
In this section you can define validation rules for the extracted field and you can define what action ThinkAutomation should take if the extracted data is invalid.
Select the Validate option to enable validation for this field. Select Cannot Be Blank Or Zero option if the field must be a value (or be non-zero in the case of numeric fields). For numeric fields you can also select a valid Numeric Range. The Must Be In List option allows you to define a list of valid values. In the Choices entry specify the list of valid values for the field.
If Data Is Invalid
Here you specify what ThinkAutomation should do if the extracted field data is invalid. There are two options:
Set Field To Default Value - select this option if you want ThinkAutomation to replace the extracted data with the field's default value (or blank if no default it specified).
Throw Error - select this option if you want ThinkAutomation to cancel execution of the Automation for the current message.
If you are going to use the Update A Database Using Extracted Fields action in your Automation, then you can map extracted fields to tables & columns in the database you want to update. ThinkAutomation then builds the database update commands automatically.
You can also use the Update A Database Using Custom SQL action type which allows finer control over database updates.
Select the Database Update tab to map the extracted field to a table & column in your database that you want ThinkAutomation to update.
Enter the Update Table Name that the field will be updated on. This table must already exist in your database. Multiple fields can use different table names if required - but the tables must be part of the same database.
Enter the Update Column Name in the table that the ThinkAutomation field will be mapped to.
Key Field
Enable this option if this field is a Key Field. Key fields allow you to control how your database is updated. If you create one or more key fields, ThinkAutomation will first check if a record exists in your database using the key field values. If a record already exists then the existing record will be UPDATED otherwise a new record will be INSERTED.
Often messages contain repeating sections. Most of the time you need to run a process or update a database for each individual block of the repeating section. ThinkAutomation allows you to do this by defining a field as a Repeating Block. When a field is defined as a repeating block, ThinkAutomation will enter a loop and extract each block of the repeating section in turn. Another Automation can then be called with the value of each block.
For example:
Suppose you receive the following message:
xxxxxxxxxx
Name : Howard Williams
Company : PSL
Order Ref: 1234
Product : WHO1
Qty : 1
Product : WHO2
Qty : 2
The Product and Qty fields can repeat any number of times depending on what the customer has ordered.
We can define the Product & Qty fields as a single field and set them as a repeating block. The repeating block can then be passed to another Automation for processing on it's own.
We would define the extraction of the above fields as follows:
Name = Extract Field From %Msg_Body% Look For "Name" Then ":"
Company = Extract Field From %Msg_Body% Look For "Company" Then ":"
Order = Extract Field From %Msg_Body% Look For "Order Ref" Then ":"
Block = Extract Field Repeating Block From %MsgBody% Look For "*" Call Process Order Lines
The Name, Company and Order fields we extract by looking for the Name:, Company: and Order Ref: field headers and extract until the end of the line.
For the Block field we set the Look For to '*' - which means start from the next character after the last extract point:
We set the Extract Data option to Until These Characters - and set this to '<BlankLine>' which means 'the next blank line'.
You then enable the Is Repeating Block option on this field. ThinkAutomation will then repeat the field extraction until it either finds the next field in the extracted fields list or the end of the message.
We then create another Automation. In this case - called 'Process Order Lines'. This Automation will receive each block of the repeating section as a new message. The 'Process Order Lines' Automation can then extract the Product and Qty fields and perform further processing.
When you enable the Is Repeating Block option the Call tab becomes visible on the Extract Field properties.
On the Call tab of the repeating block field we select the Automation to call. The Body Text should be set to the value that you want this Automation to receive for each block. The Body Text should contain the %ExtractedValue% replacement field - this will be replaced with the current block text on each call. You can add additional variable replacements if you also want to pass previously extracted fields. For example:
xxxxxxxxxx
Name : %Name%
Company : %Company%
Order Ref: %Order%
%ExtractedValue%
For each block the 'Process Order Lines' Automation would be called with messages set to:
xxxxxxxxxx
Name : Howard Williams
Company : PSL
Order Ref: 1234
Product : WHO1
Qty : 1
and then..
xxxxxxxxxx
Name : Howard Williams
Company : PSL
Order Ref: 1234
Product : WHO2
Qty : 2
Create or set a ThinkAutomation variable.
In addition to Extracted Fields you can also make use of Variables in your ThinkAutomation Actions.
A variable is simply a place holder for a specific value.
Many other Actions can return values which can be assigned to variables. In these cases you should create the variable first by simply dragging into the Actions list and giving it a name before using it other Actions.
Each variable must be given a Variable Name. Enter a new variable name to set its initial value, or choose an existing variable or extracted field to change its current value.
You can optionally assign it a Value. The value can be a fixed value or the value of another variable, extracted field or combination (using %variable% replacements).
The variable value can then be used on any other Automation action setting using %variablename% replacement (see: Variable Replacements).
The Operation option allows you to perform an optional additional operation on the Value before it's assigned to the variable. The following operations are available:
Category | Details |
---|---|
No Operation | Just Assign |
Case | To Lower Case |
Case | To Upper Case |
Case | To Word Capitalized |
Convert | HTML To Plain Text (see: HTML Parsing Notes) |
Convert | HTML To XML (converts HTML to well-formed XML) (see: HTML Parsing Notes) |
Convert | HTML To JSON |
Convert | HTML To Markdown |
Convert | JSON To HTML (converts Json text into a formatted HTML table) |
Convert | JSON To CSV (converts Json or Json Array into CSV text) |
Convert | JSON To XML |
Convert | HTML CSS To Inline Style Attributes |
Convert | Markdown To HTML (see: Markdown Notes) |
Convert | CSV To HTML Table |
Convert | CSV To JSON Array |
Convert | CSV To Markdown Table |
Convert | Plain Text To HTML |
Convert | Reformat Json (reformat, tidy & reindent Json text). (see: Json Notes) |
Convert | XML To JSON |
Date | Add Days To (if the existing value is a date then adds the days specified in the value to the existing date) |
Date | Subtract Days From (if the existing value is a date then subtracts the days specified in the value ) |
Date | Day Number Only (if the existing value is a datetime then returns the day part) |
Date | Day Of Week Name Only (if the existing value is a datetime then returns the day name, 'Mon,Tues' etc) |
Date | Day Of Week Number Only (0=Sunday, 1=Monday etc) |
Date | Hours Only (if the existing value is a datetime then returns the hours part) |
Date | Minutes Only (f the existing value is a datetime then returns the minutes part) |
Date | Month Name Only (if the existing value is a datetime then returns the month name) |
Date | Month Number Only (if the existing value is a datetime then returns the month number) |
Date | Seconds Only (if the existing value is a datetime then returns the seconds part) |
Date | Time Only (if the existing value is a datetime then returns the time part only in hh:mm:ss format) |
Date | Week Number Only (if the existing value is a datetime then returns the ISO8601 week number) |
Date | Year Only (if the existing value is a datetime then returns the year number) |
Extract | Alias From Email Address (eg: 'test' from 'test@mydomain.com') |
Extract | Name From Email Address (eg: 'Test Name' from "Test Name" <test@mydomain.com>) |
Extract | Domain From Email Address (eg: 'mydomain.com' from 'test@mydomain.com') |
Extract | All Email Addresses (returns comma separated list) |
Extract | All URLs (returns comma separated list) |
Extract | Concepts |
Extract | Directory Name Only From Path & Filename (eg: 'C:\Documents' from 'C:\Documents\mydocument.pdf') |
Extract | Filename Only From Path & Filename (eg: 'mydocument.pdf' from 'C:\Documents\mydocument.pdf') |
Extract | File Extension From Filename (eg 'pdf' from 'mydocument.pdf') |
Extract | Filename Without Extension (eg 'mydocument' from 'mydocument.pdf') |
Extract | First Email Address Only |
Extract | First Line |
Extract | First Phone Number (finds and extracts the first valid phone number in any text) |
Extract | First Sentence |
Extract | First URL |
Extract | First Word |
Extract | Last Word |
Extract | Header Value (extracts a header value from the incoming message headers - set the value to the header name) |
Extract | Keywords (returns comma separated list of words with common words removed) |
Extract | Summarized Text |
Mask | Mask Credit Card Numbers (replaces any credit card numbers with ***) |
Mask | Mask Profanities (replaces any profanity words with ***) |
Numeric | Add To (adds the value specified to the current value of the variable) |
Numeric | Decrement (subtracts 1 from the current value of the variable) |
Numeric | Get Length |
Numeric | Get Word Count |
Numeric | Get Lines Count (excluding blank lines) |
Numeric | Get Numeric Value (converts text containing a number to the number only) |
Numeric | Increment (adds 1 to the current value of the variable) |
Numeric | Subtract From (subtracts the value specified from current value of the variable) |
Numeric | Hex Convert Decimal To Hex |
Numeric | Hex Convert Hex To Decimal |
String | Add Space Character To End |
Create | Global Unique Identifier (Guid - In hex or decimal format) |
Create | ObjectId (MongoDB style unique string) |
String | Normalize Whitespace (normalizes unicode word and line separators to standard space and line feed characters) |
String | Normalize Line Endings (Cr+Lf) |
String | Normalize Line Endings (LF Only) |
String | Normalize Words (normalizes common English contractions (eg: 'what's' to 'what is') and common abbreviations (eg: hi to hello, Nov to November, ur to your, bday to birthday, 2day to today, plz to please, thx to thanks etc.)) |
String | Prepend |
String | Remove All Whitespace (all spaces and control characters are removed) |
String | Remove Invalid Filename Characters |
String | Sort Lines Ascending |
String | Sort Lines Descending |
String | Dedup Lines (removes duplicate lines, case insensitive ) |
Transform | Base 64 Decode |
Transform | Base 64 Encode |
Transform | Compress (compresses the value to Base64 encoded text) |
Transform | Create MD5 Hash (Hex Encoded) |
Transform | Create MD5 Hash (URL Encoded) |
Transform | Decompress (decompresses the Base64 encoded value) |
Transform | Decrypt (decrypts the Base64 encoded value) |
Transform | Encrypt (encrypts the value to Base64 encoded text) |
Transform | HTML Entity Decode |
Transform | HTML Entity Encode |
Transform | Quoted Printable Decode |
Transform | Quoted Printable Encode |
Transform | SHA256 Hash (Base64 Encoded) |
Transform | SHA256 Hash (Url Encoded) |
Transform | SHA512 Hash (Base64 Encoded) |
Transform | SHA512 Hash (Url Encoded) |
Transform | URL Decode |
Transform | URL Encode |
Transform | JSON Escape (escapes json reserved characters) |
Trim | Trim (removes all whitespace, tab, CR and LF characters from the beginning and end of the text only) |
Trim | All Whitespace (replaces all whitespace, tab, CR, and LF characters with space characters, and removes extra space's so there are no occurrences of more than one space in a row) |
Trim | Blanks (replaces all whitespace, tab, CR and LF characters with spaces characters and trims) |
Trim | First And Last Characters (removes the first and last character) |
Trim | Blank Lines (All) (removes all blank lines in the text) |
Trim | Blank Lines (Repeating Only) (removes repeated blank lines, so the text only contains single blank lines) |
If the Append To Existing Value option is enabled then the Value will be appended to the existing value for the variable. Care should be taken using this if the Persist Value option is enabled and the variable value is not cleared at some point within the Automation, to avoid ending up with very large strings.
By default variables are private to the Automation and the currently executing message instance. If the Solution Global option is enabled then the variable instance and current value is global to the Solution. This is useful if you have an Automation that uses the Call Automation action to call another Automation within the same solution. The global variables will be accessible and updatable in the called automation.
You should not use Global variables if you have enabled Concurrent Execution for the Automation. This is because the global variable values may change during Automation execution if multiple messages are executing concurrently. Concurrent execution is disabled by default for new Automations.
By default, when an Automation starts processing a message all Automation variables will be reset. If the Persist Value option is enabled then the variable value will be saved by the ThinkAutomation Server between messages processed. For example: If an Automation sets a persisted variable called 'var1' to 'abc' on message 1, when the Automation next executes for message 2 then variable 'var1' will be automatically set to 'abc' before the Automation starts processing. Persisted variables are stored in the Message Store database - so will be persisted even when the ThinkAutomation Server is restarted. Variables will only be persisted if the default value for the variable (the value assigned to it on the first Set action within the Automation) is blank.
Executes custom C# or Visual Basic .NET code. Requires the Professional Edition.
You can create a custom script to execute custom logic. Scripts can be written in C# or Visual Basic .NET. Select the Language to use before you edit your script code. Each Script Action must be given a Script Name.
When your Automation executes a Script action it calls the execute(currentMessage message)
method which returns a string. This is the entry point. You can edit the code inside this method and you can add any number of additional methods within the ThinkAutomationScript
class. The returned string value from the execute
method will be assigned to the Assign Return Value To variable which you can then use in your Automation.
Scripts are compiled by ThinkAutomation when they are executed for the first time. Once compiled, scripts will execute as fast as built-in actions. Scripts will be recompiled if they are changed.
If you want to re-use a script on multiple Automations, you can create a Custom Action.
Example script:
xxxxxxxxxx
using System;
using System.Text;
using ThinkAutomationCoreClasses.Scripting;
public class ThinkAutomationScript
{
public string execute(currentMessage message)
{
try
{
// Action execution code
// Get automation variable values using message.GetValue("name")
// Set automation variable values using message.SetValue("name","value")
message.AddToLog("Returned the subject in lower-case");
return message.Subject.ToLower();
}
catch (Exception e)
{
// Pass the error back to the automation log
message.AddErrorToLog(e.Message);
return "";
}
}
}
Scripts can access and update existing Extracted Fields or Variables. To access a value use:
xxxxxxxxxx
string name = message.GetValue("name");
Where "name" is an existing Variable or Extracted field name. Values are always returned as strings.
You can drag and drop a variable onto the script editor - it will be converted to: message.GetValue("variablename")
.
You can also access any of the built-in variables, solution constants, global constants & system variables:
xxxxxxxxxx
string messageTo = message.GetValue("%Msg_ToWithNames%"); // the enclosing % signs are optional.
To set an existing variable or extracted field use:
xxxxxxxxxx
message.SetValue("name","value");
Where "name" is an existing variable or extracted field name. The "value" can be any string value.
The message
object contains read-only properties for the currently executing message. For example: message.Subject
can be used to access the subject directly. Main properties:
Property Name | Details |
---|---|
MessageId | The id of the incoming message. |
MimeText | The full mime text of the incoming message. |
Subject | The message subject. |
BodyPlainText | The plain text body. If the incoming message is html without a plain text body then this property will return the plain text version of the html (with all tags removed). |
BodyPlainTextLastReply | The plain text body with previous replies and quoted text removed. |
BodyHTML | The html body. |
Dated | The message date (datetime). |
From | The from address. |
ReplyTo | The reply-to address. |
ToAddress | The to address. |
CC, BCC | The cc / bcc address. |
Size | The message size (integer). |
AutomationName | The name of the Automation currently executing. |
SolutionName | The name of the Solution containing the Automation. |
SolutionEmail | The email address assigned to the Solution. |
TempPath | The path to the temporary files folder for the Solution. |
The message.Attachments
property contains a list of currentMessageAttachment
objects for the current message.
xxxxxxxxxx
currentMessageAttachment Attachment;
foreach (var Attachment in message.Attachments)
{
string name = Attachment.Name;
int size = Attachment.Size;
string contentType = Attachment.ContentType; // for example 'application/pdf'
string path = Attachment.Location; // this contains the temporary location of the attachment file
}
The Location property of the Attachment object contains the path to the temporary location of the attachment file during Automation execution.
You can also access related items (embedded attachments in email messages) using message.RelatedItems
.
The message.MessageHeaders
property contains a list of currentMessageHeader
objects for the current message.
xxxxxxxxxx
currentMessageHeader Header;
foreach (var Header in message.MessageHeaders)
{
string hname = Header.Name; // the header name
string hvalue = Header.Value; // the header value
}
You can add an entry to the Automation Log using:
xxxxxxxxxx
message.AddToLog("script message");
To add an error to the Automation Log use:
xxxxxxxxxx
message.AddErrorToLog("A script error occurred");
Inside any methods you create in your script you should always use Try .. Catch blocks to catch any Exceptions and then use the message.AddErrorToLog method to pass details of the error back to the Automation. This will then show any script errors in your Automation log. For example:
xxxxxxxxxx
static int ordervalue(currentMessage message)
{
try
{
int qty = Convert.ToInt32(message.GetValue("qty"));
decimal price = Convert.ToDecimal(message.GetValue("price"));
return qty * price;
}
catch (Exception e)
{
// Pass the error back to the automation log
message.AddErrorToLog("Script Error:" & e.Message);
return 0;
}
}
Scripts can reference other .NET Framework assemblies compatible with .NET Framework 4.7 or higher. Use the References tab to add additional references. You can add any of the .NET framework System assemblies. Any other .NET referenced assembly must be located in the ThinkAutomation program files folder (unless you use a NuGet package - see below).
You can also add NuGet packages to scripts. Click the NuGet Packages button to open the NuGet Package Manager. Enter a search term and click the search button to view available packages. Select a package and click the Add Reference button to download & install the package. A reference to the package (and any dependencies) will be added to your script. See: https://www.nuget.org for more information.
If you need to make http requests inside your execution code, you can optionally use the helpersHttp class which simplifies the process. See: Using The Http Helper Class for more information.
Click the Check button to validate that the script compiles and executes successfully. The Error tab will show any script errors, the Output tab will show any output from message.DebugPrint, message.AddToLog or message.AddErrorToLog calls.
To assist with script development you can add data to the Output window using message.DebugPrint
:
xxxxxxxxxx
message.DebugPrint("test");
Any calls to message.DebugPrint will show in the Output window in the script editor when the Check button is used, and are ignored when the script executes during Automation execution.
If you have an OpenAI account you can add your OpenAI API key to the ThinkAutomation Server Settings - Integrations - ChatGPT section. This will enable the Ask ChatGPT button on the script editor toolbar.
Click the Ask ChatGPT to open the Generate Script Using ChatGPT window. Enter a description of what you need your script to do. Be specific with your description and what you want it to return. If you need your script to access Automation %variables% use the term 'automation variable'.
For example:
xxxxxxxxxx
Send an SMS message using the Esendex API. The SMS message is in the automation variable 'SMSMessage'. The recipient phone number is in the automation variable 'PhoneNumber'. Return 'sent' along with the message id if the message is sent successfully, otherwise return the error message and add the error to the error log.
Or
xxxxxxxxxx
Read the current account balance from Stripe using the Stripe API. Return the balance. The API key is in the automation variable 'StripeAPIKey'.
When mentioning automation variables in your description this can may any %variable%, Extracted Field or Constant.
ThinkAutomation gives ChatGPT information about how scripts work and the objects available.
Examples:
xxxxxxxxxx
If the message subject contains 'quote', save any PDF attachments to a folder called 'Quotes'. Add the current date & time to the saved file name to ensure its unique. Return the number of attachments saved.
xxxxxxxxxx
If the message subject contains 'quote' and the automation variable 'IsCustomer' is equal to 'true', create a string in iCalendar text format and return it. Also set the automation variable 'Appointment' to 'set'. The start and end dates should be 30 days from the message date. The summary is the message subject. The organizer is the message to address.
xxxxxxxxxx
Find all links in the message html and return them one per line with duplicates removed.
Click the Ask ChatGPT button to send the request to ChatGPT. Your script will be displayed. Click OK to add the generated script to the script editor.
Notes:
ChatGPT code generation use useful to get you started and in may cases it can generate a script that can be used with no changes, however it is not foolproof. You should always test the script first. ThinkAutomation instructs ChatGPT to not use external libraries - however it may still do so - in which case these would need to be added as references.
Save attachments to specific folders on your file system.
Specify the File Mask for the extensions you want to save.
For example: *.pdf to save all files with the extension .pdf. Use *.* to save all attachments. You can specify multiple masks separated by commas, for example: 'quote*.pdf, invoice.*.pdf, *.doc'. You can create multiple Save Attachment Actions in the same Automation if you need to process different file types differently.
In the Save To Folder select the folder on your file system to save the attachments to. This can contain %variable% replacements.
For example: To save all attachments to sub folders based on the senders email address use 'C:\Attachments\%Msg_From%\'.
The directory will be created if it does not exist.
Renaming Attachments
In the Rename Saved Files To entry you can optionally specify a new name for the file. You can use %fieldname% replacements in the Rename to - for example: order%OrderNumber%.csv would rename the attachment order1234.csv if the %OrderNumber% field contained '1234'.
You can use the special field replacement %filename% to use the original file name as part of the renamed file. For example, suppose the incoming attachment was called "orderdata.csv" and the %OrderNumber% field was set to '1234' - renaming to: %filename%No%OrderNumber%.csv would rename the file 'orderdata_No_1234.csv'.
If your rename string doesn't contain a file extension then the original extension will be used. For example: If the attachment is called 'attachment.csv' and you rename it to %OrderNumber% - then the attachment will be renamed '1234.csv' (assuming the %OrderNumber% field has a value of '1234').
You can assign the saved path and file name to a ThinkAutomation variable. Select the variable to assign using the Assign Saved Path To list. Multiple saved attachments will be separated by commas.
Overwrite Existing Files
Check this box if ThinkAutomation should overwrite existing files.
Append Key To Filename To Make Files Unique
If this option is selected then ThinkAutomation will append a date and time stamp to the file name (including renamed files) to ensure that the file name is unique. The time stamp is in the format yyyymmddhhmmss_x
For example: order123420120307122033_1.csv
Would be save for file order1234.csv on 7th March 2012 and 12:20:33. The _1 indicates that this is the first attempt at saving using this file name. If a file already existed with the same time stamp (for example, if ThinkAutomation was processing multiple emails very quickly) the counter would be increased until a unique file was found.
Include Inline Attachments
For HTML emails you can also save inline attachments - these would usually be images embedded in the HTML that don't appear as regular attachments.
Further Attachment Processing
Other actions (such as Convert Document, Convert PDF Document, FTP Upload, Azure Blob etc.) allow specific processing of Attachments.
Assign the current message to a folder in the Message Store.
The Message Store contains copies of each message processed by the Automation. The Message Store can be organized into folders. This action is used to assign the current message to a folder. If no folder is assigned then the message is stored in the root folder for the Automation.
The Current Message Store Folders tree shows all current folders and sub-folders for the Automation. Select one of the folders to assign the current message.
You can also manually specify a path in the Assign Message To Message Store Folder Path entry. This can contain %variable% replacements to dynamically assign folders (Eg: 'Customers\%CustomerName%').
If folders for the specified path do not exist they will be created.
Folders and sub-folders in the path are separated by backslash characters. For example a path of 'Top\Level1\Level2' will create:
xxxxxxxxxx
Top
Level1
Level2
The message will then be assigned to the 'Level2' sub folder.
Folder names can contain letters and numbers only. Each folder name can be up to 100 characters.
You can also create folders and sub-folders whilst viewing the Message Store. Right click a folder and select Create Sub Folder. Existing messages in the Message Store can be moved to other folders by selecting one or more messages in the Message Store. Right-click the selection and select the Move To menu item.
This action can be used where the incoming message is read from an Office 365, Exchange, IMAP or Gmail Message Source. It moves the incoming message to a different folder on the source email account.
This action works with the message currently being processed.
Select the folder to move the current message to from the Move Current Message To Folder list.
This action can be used to conditionally move the current source message to a different folder on the source email account. For example you could choose to move the message to the Deleted Items folder based on variable values or other conditions.
This action can only be used on Automations that are called from an Office 365, Exchange, IMAP or Gmail Message Source.
ThinkAutomation supports native access to the following database types:
Microsoft SQL Server
Microsoft SQL Server Azure
MySQL / Maria DB
SQLite
Oracle
PostgreSQL
DB2
Firebird
Microsoft Access
MongoDB (and Azure Cosmos)
In addition it can also connect to an ODBC DSN and use any OLEDB driver. See: Database Connection Notes.
ThinkAutomation also includes an embedded server-less document database that you can use to store any arbitrary data in Json format and then later query the data using SQL statements. See: Embedded Document DB Notes.
All SQL statements use consistent quoted identifiers - regardless of the database type. Identifiers should be enclosed in double quotes. For example:
xxxxxxxxxx
SELECT * FROM "Person"."ContactType" WHERE Name = 'xyz'
All SQL statements used on database actions allow you to specify parameters.
You can substitute parameters using @parametername in the SQL statement. For example:
xxxxxxxxxx
SELECT * FROM Person WHERE Id = @Id OR Name = @Name
or
xxxxxxxxxx
INSERT INTO Customers (Name, CreatedDate) VALUES (@Name, @CreatedDate)
For any parameters you must complete the Parameters grid. Specify the Name, Type & Value for each parameter used. The Name column in the parameters list has a drop down selector that will be auto populated with any @parameter names used in the SQL statement. The Type must match your database column type. Parameter values can be set to fixed values or %variable% replacements (or combination).
Using parameters is recommended over directly specifying %variables% in the SQL statement itself as this correctly sets the value based on its Type and avoids any possible SQL injection attacks.
If you specify %variables% directly inside a SQL statement instead of using parameters you must ensure the value is correctly escaped (ie: single quotes represented by '') and string values enclosed in quotes.
Reads records from a database and assigns returned column values to multiple ThinkAutomation variables.
Select a Database Type to connect to from the list. You must specify a Connection String that ThinkAutomation will use to open the database. Click the ...
button to build the connection string. Click the Test button to verify that ThinkAutomation can connect to the database.
Specify the Max Rows to read.
Enter the SQL Statement to use to query records from the database. The SQL Statement can contain Parameters. Eg:
xxxxxxxxxx
SELECT * FROM Person WHERE Id = @Id
For any Parameters you must complete the Parameters grid. Specify the Name, Type & Value for each parameter used. Parameter values can be set to %variable% replacements. See: SQL Parameters. Click the Test button to verify the query.
Column Assignments
You can assign individual column values to ThinkAutomation Variables (optional).
In the Column Assignments grid you can map database columns returned from the query to ThinkAutomation variables.
In the Column Name/Index column specify a database field name or position number from the SELECT statement.
In the Assign Value To column select a ThinkAutomation Variable that you want the database column value assigned to.
If the database query returned multiple rows, then the first row returned will be used for variable assignment. If no rows are returned then assign-to variables will not be assigned.
Optional Assignments
You can assign the row count to a ThinkAutomation variable. Select a variable from the Assign Row Count To list (optional).
Assign All Rows/Columns To A Variable In JSON Format
You can assign all rows/columns returned by the query as JSON text to a ThinkAutomation variable. Select a variable from the Assign Json To list (optional).
Each row returned by the query will be a JSON value. For example:
xxxxxxxxxx
{
"PersonId": 1,
"PersonType": "EM",
"NameStyle": false,
"Title": "",
"FirstName": "Ken",
"MiddleName": "J",
"LastName": "Sánchez",
"Suffix": "",
"EmailPromotion": 0,
"AdditionalContactInfo": "",
"ModifiedDate": "2009-01-07"
}
If the query returned multiple rows then the JSON will be set to an array.
You can then perform other actions on this value - or pass it to another Automation using the Call Automation action. You can use the Convert JSON To Html action to convert the JSON to a HTML table if the data needs to be sent or viewed in human readable format.
Assign All Rows/Columns To A Variable In CSV Format
You can assign all rows/columns returned by the query as CSV text to a ThinkAutomation variable. Select a variable from the Assign CSV To list (optional).
For the JSON/CSV content you can use the Read/Write Text File action to save the content to a file for use on subsequent actions (Convert Document, Add Attachment to outgoing email etc.).
Converting The CSV To Displayable Format
If you want to use the Database Lookup to lookup multiple rows that you can then return in your Automation for a user to view, you can use the Set Variable action with the Convert CSV To Markdown Table option. Eg:
xxxxxxxxxx
CSV = Lookup From A Database MySQL on world SELECT * FROM world.country
Markdown = Convert CSV To Markdown Table(%CSV%)
Return %Markdown%
When run in the Studio this will display the table when used via the Send Message option. When used via a Web Form or API Message Source the markdown will be automatically converted to HTML.
If any columns return binary data (data types: blob, binary, varbinary etc) the data will be returned to the variable in Base64 format. If you want to write the base64 data to a file you can use the File Operation action with the Write Binary File From Base64 String operation.
Lookups From The Embedded Document DB
This action can also be used to perform lookups using the Embedded Document DB. Select Embedded Database when selecting the Database Type. See: Embedded Data Store action
Opens a connection to a database for use with For.. Each Actions
The Open Database Reader Action opens a connection to a database using a SQL query. The connection remains open during Automation execution. You can then create a For..Each loop to read each row returned by the query.
Enter the Reader Name. This is a unique name for the data reader. A single Automation can open multiple data readers - each having a unique name.
Select a Database Type to connect to from the list. You must specify a Connection String that ThinkAutomation will use to open the database. Click the ...
button to build the connection string. Click the Test button to verify that ThinkAutomation can connect to the database.
Enter the SQL Statement to use to query rows from the database. The SQL Statement can contain Parameters. Eg:
xxxxxxxxxx
SELECT * FROM Person WHERE PersonType = @Type
For any Parameters you must complete the Parameters grid. Specify the Name, Type & Value for each parameter used. Parameter values can be set to %variable% replacements. See: SQL Parameters. Click the Test button to verify the query.
Now create a For..Each Action. Specify the For Each option as Data Reader Row In and select the Reader Name.
You can then select a variable from the Assign Data Row Json To selector to be assigned the current row Json. The current row Json will be set for each record returned from the query. For example:
xxxxxxxxxx
{
"PersonId": 1,
"PersonType": "EM",
"NameStyle": false,
"Title": "",
"FirstName": "Ken",
"MiddleName": "J",
"LastName": "Sánchez",
"Suffix": "",
"EmailPromotion": 0,
"AdditionalContactInfo": "",
"ModifiedDate": "2009-01-07"
}
You can then perform other actions on this value - or pass it to another Automation using the Call Automation action.
The For..Each loop will continue until all rows from the query have been read or an Exit Loop action is used.
The Open Database Reader action is designed for queries that return a small number of rows (less than 10000). For example: To read a list of email addresses from a database and send an email to each. If your query will return many rows consider using the Database message source type instead. You can also use the Set Logging Level action before your For..Each loop. Set the logging level to Minimal so that only errors are logged during the loop. This will improve performance.
A For..Each - Data Reader Row In loop block cannot contain the following actions:
Twilio Send SMS Message (where waiting for status is enabled)
The reason is that the Automation will exit during the waiting phase of the above Actions (allowing the next message to be processed). The underlying data source for the Open Database Reader action may change during this waiting period causing the loop to become invalid.
Executes a SQL Command or Stored Procedure with optional parameters and returns multiple return values.
This Action allows you to execute a SQL Statement or Stored Procedure. You can pass any number of parameters and assign output parameters to variables.
Select a Database Type to connect to from the list. You must specify a Connection String that ThinkAutomation will use to open the database. Click the ...
button to build the connection string. Click the Test button to verify that ThinkAutomation can connect to the database.
Select the Command Type. This is either a SQL Statement or Stored Procedure.
Specify the Command SQL Statement or Stored Procedure Call depending on the command type. You can substitute parameters using @parametername in the SQL Command statement.
Command Parameters
You can pass multiple parameters to your command.
For each parameter in the SQL statement you must specify the Name, Type, Direction & Size. These must match your stored procedure parameters types when using a store procedure, or column types when using a SQL statement. See: SQL Parameters.
For Output Parameters and the Return Value you can specify the variable to Assign Result To.
For Input Parameters you set the Value - this can be fixed or a %variable% replacement.
Blob Data (Saving File Contents)
For parameters with type Blob - if the Value assigned is a file path, then the file contents are read and the binary data is assigned to the Value.
Saving Attachments
If you want to store message attachments to a database you can use a For..Each action to loop on Attachment. Inside the loop set variables for the Filename and Temporary Location values. You can then assign these variables to the relevant database parameter values. See: Example.
Execute Method
Select Non Query if your SQL statement does not return a result set. You can optionally assign the rows affected to a variable selected from the Assign Rows Affected To list.
Select Scalar if your SQL statement returns a result set. The first column of the first row of any results can be optionally be assigned to a variable selected from the Assign Result To list. For example, the SQL statement:
xxxxxxxxxx
INSERT INTO "Production"."ProductCategory" (Name) VALUES (@Name);
SELECT scope_identity();
The above SQL Server statement will insert a new record and then return the new identity value. The returned value can be assigned to a variable.
Insert or Update a row in a database using custom SQL.
This Action allows you to insert or update a row in a database based on the results of a select statement.
Select a Database Type to connect to from the list. You must specify a Connection String that ThinkAutomation will use to open the database. Click the ...
button to build the connection string. Click the Test button to verify that ThinkAutomation can connect to the database.
The Insert tab is used to enter any valid SQL statement. You can also optionally enter statements in the Update and Select tabs.
If a select statement is entered in the Select tab, then the SQL entered in the Update tab is executed if the select returns one or more rows. If no rows are returned then the SQL entered in the Insert tab is executed.
The select, insert & update statements can contain parameters (using @parametername).
You must specify the Name, Type & Value of each parameter used. Parameter values can be assigned to %variable% replacements. See: SQL Parameters.
It is not recommended that you directly specify %variables% in your SQL statements. You should use parameters instead and set the parameter values to each %variable%. This will ensure the database value is set correctly. It is also more secure. If you do use %variables% directly in your SQL statement you must ensure the value is correctly escaped (any single quotes must be replaced with two single ) and string values are enclosed in single quotes.
For the Insert & Update statements you can assign the rows affected to a variable.
For parameters with type Blob - if the Value assigned is a file path, then the file contents are read and the binary data is assigned to the Value.
If you want to store message attachments to a database you can use a For..Each action to loop on Attachment. Inside the loop set variables for the Filename and Temporary Location values. You can then assign these variables to the relevant database parameter values. See: Example.
Update a database with fields extracted from the incoming message.
This action can be used to automatically insert or update a record in a database based on the Extract Field actions defined in your Automation. The tables and column names used in the SQL commands are specified on the Database Update tab on each individual Extract Field Action. ThinkAutomation will then create the necessary SQL commands automatically.
Select a Database Type to connect to from the list. You must specify a Connection String that ThinkAutomation will use to open the database. Click the ...
button to build the connection string. Click the Test button to verify that ThinkAutomation can connect to the database.
The UPDATE and SELECT commands will only be created if you have defined one or more of your Extracted Fields as Key Fields. ThinkAutomation will then first check if a record exists with the key field values by issuing a SELECT * FROM ... command. It will then execute the UPDATE command if a record is found or the INSERT command otherwise.
You can have only have one Update A Database Using Extracted Fields Action in your Actions List since the SQL statements are automatically created based on your Extract Field actions. If you want to update multiple tables within the same database you can specify different table names against each Extract Field action in the Update Table Name entry - ThinkAutomation will then create separate SQL commands for each separate table being updated. You need to add your Update A Database Using Extracted Fields action below your Extract Field actions to ensure each extracted field has a value.
The result of the update can be assigned to a variable. Select a variable from the Assign Result To list. The variable will receive either 'Inserted','Updated' or an error message if the update failed.
If you need to update multiple separate databases within the same Automation then you can use the Update A Database Using Custom SQL Action. You can have any number of Update A Database Using Custom SQL Actions within your Automation.
This action can be used to automatically insert or update multiple records in a database from CSV or Json text (or file). The column names used in the SQL commands are mapped to CSV columns or Json paths. ThinkAutomation will then create the necessary SQL commands automatically.
Select a Database Type to connect to from the list. You must specify a Connection String that ThinkAutomation will use to open the database. Click the ...
button to build the connection string. Click the Test button to verify that ThinkAutomation can connect to the database.
Specify the Table Name to be updated. Click the Get Tables button to read the table names from the database schema. You can then select a table from the Table Name drop-down list.
From the Update Using list, select:
CSV Data - to update using CSV data or a linked file.
JSON Data - to update using JSON data or a linked file.
For CSV data, enable the CSV Has Header Row if the CSV data contains column names in the first line.
For Json data, you can optionally specify the Start At Path (using dot notation).
In the CSV/Json Data Or File Path entry, specify the source CSV or Json data. This can be a %variable% containing the data. You can also specify a file path (or a variable containing a file path). If a file path is used, the file will be read and the contents used for the source data when the Automation executes.
Complete the Column Mappings grid to map database columns to your source data columns.
When the Automation executes all records in the CSV/Json will be inserted or updated in the database. The database update is performed within a single transaction. This means that if one insert or update fails, then the transaction is rolled back and no database changes are made.
The number of inserted and updated database rows can be returned to variables. Select the variables from the Assign Inserted Count To and Assign Updated Count To lists.
You must map columns from the source data to columns in the database table you want to update. The easiest way to do this is to first paste a sample of your CSV or Json data into the CSV/Json Data editor, then use the Auto Map button. Once you have mapped your columns, replace the CSV/Json Data value with your %variable% that will contain the CSV/Json data or file path.
In the Column Mappings grid, for each source column, specify the Database Column Name, Type, Size and Source Column Name Or Value.
Click the Auto Map Database Columns To Data Columns button to auto-map. This will populate the column selector drop-down lists and also match database column names with source column names. You can then manually match where needed.
The Source Column Name Or Value can either be a column name in your source data or a %variable%. If you use a %variable% then the database column will be assigned the fixed %variable% value for each row inserted/updated.
For the Size value, you can specify the database column size for text data types. If a size is specified then the source data will be trimmed before being assigned to the database column to ensure it fits. Specify zero for no auto-trimming.
Enable the Key option for database columns where you want to update existing database records instead of inserting new. Multiple columns can be set as keys. ThinkAutomation will then first check if a record exists with the key field values by issuing a SELECT * FROM table WHERE keyfield1 = @value [AND keyfield2 = @value] command. It will then execute the UPDATE command if a record is found or the INSERT command otherwise.
For example, suppose we have the follow CSV data:
xxxxxxxxxx
Index,Organization Id,Name,Website,Founded,Industry,Number of employees
1,FAB0d41d5b5d22c,Ferrell LLC,https://price.net/,1990,Plastics,3498
2,6A7EdDEA9FaDC52,"Mckinney, Riley and Day",http://www.hall-buchanan.info/,2015,Ceramics,4952
3,0bFED1ADAE4bcC1,Hester Ltd,http://sullivan-reed.com/,1971,Public Safety,5287
And a database table:
xxxxxxxxxx
CREATE TABLE "Customers" (
"Index" INTEGER,
"OrganizationId" TEXT,
"Name" TEXT,
"Website" TEXT,
"Founded" INTEGER,
"Industry" TEXT,
"NumberOfEmployees" TEXT,
PRIMARY KEY("Index")
)
The Automap button would automatically map the CSV columns to the database columns (ignoring case and spaces). The 'Index' could be marked as a key.
When the Automation executes, 3 new records will be inserted. If the Automation was run again with the same CSV data then the 3 records would be updated if they already exist in the table with the same 'Index' value.
If you want to update a database from an Excel spreadsheet you can use the Lookup From Excel action to read a range of cells in CSV format. You can then use the variable containing the CSV text as your source CSV data.
When using Json data instead of CSV, the Json must be a Json array. The objects in the array must all be the same type. Sub-objects are not supported.
For example, the following JSON data could be used for the above database example:
xxxxxxxxxx
[
{
"Index": 1,
"Organization Id": "FAB0d41d5b5d22c",
"Name": "Ferrell LLC",
"Website": "https://price.net/",
"Founded": 1990,
"Industry": "Plastics",
"Number of employees": 3498
},
{
"Index": 2,
"Organization Id": "6A7EdDEA9FaDC52",
"Name": "Mckinney, Riley and Day",
"Website": "http://www.hall-buchanan.info/",
"Founded": 2015,
"Industry": "Ceramics",
"Number of employees": 4952
},
{
"Index": 3,
"Organization Id": "0bFED1ADAE4bcC1",
"Name": "Hester Ltd",
"Website": "http://sullivan-reed.com/",
"Founded": 1971,
"Industry": "Public Safety",
"Number of employees": 5287
}
]
You can use the Start At Path entry to specify an array path within the Json, for example:
xxxxxxxxxx
{
"Id": "1234",
"Customers": [
{
"Index": 1,
"Organization Id": "FAB0d41d5b5d22c",
"Name": "Ferrell LLC",
"Website": "https://price.net/",
"Founded": 1990,
"Industry": "Plastics",
"Number of employees": 3498
},
{
"Index": 2,
"Organization Id": "6A7EdDEA9FaDC52",
"Name": "Mckinney, Riley and Day",
"Website": "http://www.hall-buchanan.info/",
"Founded": 2015,
"Industry": "Ceramics",
"Number of employees": 4952
},
{
"Index": 3,
"Organization Id": "0bFED1ADAE4bcC1",
"Name": "Hester Ltd",
"Website": "http://sullivan-reed.com/",
"Founded": 1971,
"Industry": "Public Safety",
"Number of employees": 5287
}
]
}
If the Start At Path is set to 'Customers', then only the Customers array will be used.
Insert, Update or Delete documents in a MongoDB collection. This action can update any local MongoDB, or cloud based MongoDB compatible document databases including Amazon DocumentDB, Azure Cosmos and MongoDB Atlas.
Specify the MongoDB Connection String, Database Name & Collection Name.
Select the Operation:
Insert: To insert a new document.
Upsert: If you want an existing document returned from the Query to be updated. If no document is returned from the Query then a new document will be inserted.
Update: To Update one or more existing documents.
Delete: To delete one or more existing documents.
If Upsert, Update or Delete is selected you must specify the Query Json. See: Query Documents — MongoDB Manual for query syntax. You can use %variable% replacements in the query and document json. If the value is a string then it must be enclosed in quotes. For example:
xxxxxxxxxx
{ status: "%statuscode%" }
Click the Test Query button to test the connection and query. A maximum of 100 documents will be returned when using the Test option.
Enter Document Json for Insert, Upsert or Update.
If Update or Delete is selected then you can enable All Matching Documents. If enabled then all documents returned from the query will be updated/deleted.
Example Update:
With Query set to:
xxxxxxxxxx
{ "Name" : { "$gt" : "A" } }
And Document Json set to:
xxxxxxxxxx
{
"$set" : {
"Downloads" : 11
}
}
If All Matching Documents is enabled this would set the 'Downloads' field to 11 for all documents with 'Name' field greater than 'A'. If All Matching Documents not enabled then the first document found would be updated.
If you want to store a full copy of the incoming message you can use the built-in variable %Msg_Json%. If the incoming message body is already Json (for example, if using the Database message source) then you can set the Document Json to %Msg_Body%.
You can use the Create Json action to create a Json document to insert/update.
You can assign the result of the operation to a variable. Select from the Assign Result To list. For Update/Delete operations the result will be the number of documents affected. For Insert/Upsert operations the result will be the _id of the Inserted/Updated document.
Read a document from a MongoDB Collection and assign the Json to a variable. This action can lookup data from any local MongoDB, or cloud based MongoDB compatible document databases including Amazon DocumentDB, Azure Cosmos and MongoDB Atlas.
Enter the MongoDB Connection String, Database Name and Collection Name. Enter the Query json and optionally the Projection and Sort json. Click the Test button to test the connection and query.
You can use %variable% replacements in the query. For example:
xxxxxxxxxx
{ "_id": { "$eq": "%OrderNumber%" } }
See: Query Documents — MongoDB Manual for query syntax.
Select the variable to assign the returned document(s) to from the Assign To list.
The Json can be returned as either:
MongoDB Relaxed Extended - returns Json as stored in MongoDB. This will include additional objects for date, long, objectid etc.
Standard - returns standard Json.
Select from the Json Output Mode list.
You can then use Extract Field Actions (with the extract Json path option) to extract individual fields from the document.
Insert, Update and Query data using the embedded document DB. ThinkAutomation includes an embedded server-less document database that you can use to store any arbitrary data in Json format and then later query the data using SQL statements. The Embedded Data Store makes it easy to store and retrieve data in your Automations without having to configure a database. See: Embedded Document DB Notes.
If you only need to store single values against a key (key/value pairs) then you can use the Embedded Value Store action which provides simple storage and retrieval of key/value pairs.
Database Name
Any number of separate databases can be created. Database names can contain letters or numbers only. You can use a %variable% replacement for the database name (all none alpha numeric characters will be removed during execution). Databases are global to the ThinkAutomation instance (IE: The same database can be used on all Solutions/Automations). A database is automatically created when it is first accessed.
Password
A database can be optionally assigned a password. If a password is specified then the database file will be encrypted with AES encryption. You cannot change a database password after it has been created.
Collection Name
A database can contain multiple collections. A 'collection' is similar to a 'table' in a traditional database. Collection names can contain letters or numbers only. You can use a %variable% replacement for the collection name (all none alpha numeric characters will be removed during execution).
Operations:
Insert
Inserts a new document into the specified database/collection. Specify the Document Json. This can contain %variable% replacements - or be a single %variable% containing Json created from a previous action. If you are using the Database Message Reader then you can use %Msg_Body% since this will already contain Json read from the source database.
If you want to easily store all extracted field values you can use the %Msg_ExtractedFieldsJson% built-in variable. This will return a Json document containing each extracted field name & value.
Each document must have an '_id' field containing a unique id. This field will be added automatically with a unique value if it is not included in the Json. If an '_id' field is included in the Json and its value is not blank then the existing document will be updated if it exists, otherwise a new document will be inserted (upsert).
The '_id' field is automatically indexed. The unique id will be returned after the insert. Select the variable to receive the new Id from the Assign _id To list.
The Ensure Indexed entry allows you to optionally define one or more fields as additional indexes (separated by commas). This will enable faster queries. For example, suppose we want to insert the following:
xxxxxxxxxx
{
"isbn": "123-456-222",
"author": {
"lastname": "Doe",
"firstname": "Jane"
},
"editor": {
"lastname": "Smith",
"firstname": "Jane"
},
"title": "The Ultimate Database Study Guide",
"category": [
"Non-Fiction",
"Technology"
]
}
We could set the Ensure Indexed entry to 'isbn,author.lastname'. This will ensure both the "isbn" and "author.lastname" fields are indexed.
Update
Replaces an existing document. The Document Json should contain the new document. The Where _id Equals should be set to the _id of the document to replace. The Assign _id To variable will receive the _id - or be set to blank if the existing document was not found.
You can also use the SQL operation to update specific fields, for example:
xxxxxxxxxx
UPDATE books SET editor.firstname = 'Jane', editor.lastname = 'Doe' WHERE isbn = '123-456-222'
Delete
Deletes an existing document. The Where _id Equals should be set to the _id of the document to delete. The Assign _id To variable will receive the _id - or be set to blank if the existing document was not found.
Get
Retrieves a single document. The Where _id Equals should be set to the _id of the document to retrieve. The Assign _id To variable will receive the document Json - or be set to blank if the existing document was not found.
SQL
You can execute SQL statements against a Database. SELECT, UPDATE & DELETE can be used. The Collection Name entry is not required when using the SQL option, since the collection name will be specified in the SQL statement itself.
You can use SELECT * FROM {collectionname} to return full documents, or SELECT FieldName,FieldName2... FROM {collectionname} to return only specific fields.
Parameters can also be used. For example:
xxxxxxxxxx
SELECT _id,title,isbn,author.lastname FROM books WHERE author.lastname = @Name
ORDER BY author.lastname LIMIT 10
If a @parameter is specified in the SQL statement then you must set its type and value in the Parameters grid. Parameter values can be set to %variable% replacement values.
When using a SELECT statement the returned documents can be returned as Json or CSV. If returning Json then a Json array will be returned if the SELECT statement returns more than 1 document.
When using an UPDATE or DELETE statement then returned value will be the number of documents affected.
Select the variable to receive the results from the Assign To list. The results can be returned as Json, CSV (without headers) or CSV (with headers).
You can also use the regular Lookup From A Database action to perform a lookup using the Embedded Document DB. This action allows specific column values to be assigned to variables. The Update A Database Using Extracted Fields action can also be used to update (insert or update) the Embedded database.
Drop Collection
Deletes all documents in the specified Database / Collection.
The Assign To variable will receive the dropped collection name or blank if the collection does not exist.
Drop Database
Deletes the specified Database.
The Assign To variable will receive the dropped database name or blank if the database does not exist.
Get, Set and Delete from a dictionary of key/value pairs using the embedded document database. This action enables you to store any number of key/value pairs against a Collection Name. Values can later be retrieved by their key. You can store any sort of text data for the value. Keys can be any text, up to 1024 characters. For example: You could use a collection called 'subscribed' and use email addresses as keys - with the value set to Yes or No. Then do a simple lookup in any of your Automations to see if an email address is subscribed to a newsletter.
Collection Name
Key/value pairs are contained within a Collection. Multiple collections can be used. Collection names can contain letters or numbers only. Key/value pair collections are global to the ThinkAutomation instance (IE: The same collection can be used on all Solutions/Automations).
Operations:
Set
Add or update a key/value pair within the Collection. Specify the Key and Value (both can contain %variable% replacements). If the key already exists then its value will be updated, otherwise a new key/value pair will be created. The Assign To variable will receive the key value (or blank if an error occurred). You can use the Add Now button to manually add key/value pairs.
You can optionally set an Expires After value in seconds. If an expires after value is specified then any Get operation with the same key will return a blank value if the value was set or updated more than the Expires After seconds ago. This is useful when implementing caching. Leave at zero for never expire.
Get
Retrieve an existing value. Specify the Key. The Assign To variable will receive the value - or be set to blank if key does not exist (or has expired).
Delete
Delete an existing value. Specify the Key to delete. The Assign To variable will receive the key value - or blank if the key does not exist. You can use the Delete Now button to manually delete keys.
Drop
Removes all key/value pairs from the specified Collection Name. The Assign To variable will receive the collection name - or blank if the collection does not exist. You can use the Drop Now button to manually drop the collection (all key/value pairs in the collection will be deleted).
Get All
Get all key/value pairs in the specified Collection Name. You can specify a Limit to limit the number of key/value pairs returned. You can also Sort by Key or Value. You can Return Keys, Values or both (in CSV format). The Assign To variable will receive the returned keys/values (one per line). You can use the returned data in a For Each.. Line In loop if you need to perform actions on each value returned.
Get Count
Get the total number of keys for the specified Collection Name. The Assign To variable will receive the count.
Find
This operation allows you to return all Keys, Values or both where the keys Starts With, Ends With or Contains the specified Where Key text. You can specify a Limit to limit the number of key/value pairs returned. You can also Sort by Key or Value. You can Return Keys, Values or both (in CSV format). The Assign To variable will receive the returned keys/values (one per line). You can use the returned data in a For Each.. Line In loop if you need to perform actions on each value returned.
Save, get and delete files using the embedded document DB. ThinkAutomation includes an embedded server-less document database that you can use to store and retrieve files. See: Embedded Document DB Notes.
Database Name
Any number of separate databases can be created. Database names can contain letters or numbers only. You can use a %variable% replacement for the database name (all none alpha numeric characters will be removed during execution). Databases are global to the ThinkAutomation instance (IE: The same database can be used on all Solutions/Automations). A database is automatically created when it is first accessed.
Password
A database can be optionally assigned a password. If a password is specified then the database file will be encrypted with AES encryption. You cannot change a database password after it has been created.
Collection Name
A database can contain multiple collections. A 'collection' is similar to a 'table' in a traditional database. Collection names can contain letters or numbers only. You can use a %variable% replacement for the collection name (all none alpha numeric characters will be removed during execution).
Operations
Save
Save files to the database. You can specify specific local files or a %variable% containing a file path obtained from a previous action. You can also Include Incoming Attachments. For attachments you can specify a Mask (eg: *.pdf).
The Path In Database entry allows you to define a path within the database (similar to directories) where the files will be saved. This allows you to organize files within the database. You can use %variable% replacements in the path. For example: /Documents/%Msg_FromEmail%/
The Assign To variable will receive the saved file information.
Get
Read a previously saved file from the database and save it to a specified folder.
Specify the Path In Database for the file. For example: /Documents/Pdfs/Document1.pdf
Specify the Save To Local Folder path where the file should be saved. If Delete saved copy after message is processed is enabled then the saved file will be deleted after the Automation has completed for the current message. The file held in the database is not deleted - only the saved copy. This is useful if you need to access a file during an Automation (for example, to attach it to an outgoing message) but do not need it afterwards.
The Assign To variable will receive the local saved path (or blank if the file was not found in the database).
Delete
Delete a previously uploaded file from the database.Specify the Path In Database for the file. For example: /Documents/Pdfs/Document1.pdf
The Assign To variable will receive the deleted file path (or blank if the file was not found in the database).
Get Info
Gets file information for a previously saved file. The file itself is not read from the database.
Specify the Path In Database for the file. For example: /Documents/Pdfs/Document1.pdf
The Assign To variable will receive the file information (or blank if the file was not found in the database).
Get List
Gets a list of file information for a specified path.
Specify the Path In Database for the files. For example: /Documents/Pdfs/ - will return all documents starting with '/Documents/Pdfs/'. You can also use wildcards, for example: /Documents/Pdfs/Quotes*.pdf.
The file list can be returned as Json or CSV.
Drop Collection
Deletes all files in the specified Database / Collection.
The Assign To variable will receive the dropped collection name or blank if the collection does not exist.
File Information Format
The Save, Get Info and Get List operations return file information the following format:
xxxxxxxxxx
{
"DatabaseName": "Attachments",
"CollectionName": "Files",
"Id": "$/Documents/Pdfs/Document1.pdf",
"Size": 116601,
"UploadDate": "2021-09-16T08:35:32.34+01:00",
"MimeType": "application/pdf"
}
A Json array will be returned for multiple files.
You can include the File Information %variable% in your Automation Return value. If the Automation has been executed from the Studio or Desktop Connector Send Message form then any File Information json will be automatically converted to clickable links. This will allow the user to save and view the file.
Get List CSV Option
The Get List operation can also return the list as CSV text, for example:
xxxxxxxxxx
DatabaseName,CollectionName,Id,Size,UploadDate,MimeType
FilesStore,quotes,$/Documents/Quotes/Quote15.pdf,79467,2022-02-07 13:52:29,application/pdf
FilesStore,quotes,$/Documents/Quotes/Quote16.pdf,79467,2022-02-07 13:57:23,application/pdf
FilesStore,quotes,$/Documents/Quotes/Quote17.pdf,79468,2022-02-07 13:57:41,application/pdf
You could use the Set Variable action with the Convert CSV To Markdown Table if you wanted to include the list in the Automation return value to display a table.
Update, Get, Search and Delete from a knowledge base store using embedded document database. This action enables you to store any number of knowledge base articles against a Collection Name. Articles can later be retrieved by their title, or you can search and retrieve the top x most relevant articles for any search text.
This action is useful when used with the ChatGPT action. When a user asks a question, you can search the knowledge base to provide context to the asked question. ChatGPT will then be able to answer organization specific questions based on private data.
You could also use this action to lookup knowledge base articles in response to incoming emails when sending automated responses etc.
Collection Name
Articles are contained within a Collection. Multiple collections can be used. Collection names can contain letters or numbers only. Article collections are global to the ThinkAutomation instance (IE: The same collection can be used on all Solutions/Automations). A collection can contain any number of articles - however it is recommended to keep articles per collection below 5000.
Operations:
Update
Add or update a knowledge base article within the Collection. Specify the Article Title, Tag and Article Text (these can contain %variable% replacements). If the title already exists then it's article text will be updated, otherwise a new article will be created. The Tag is optional.
The Assign To variable will receive the number of articles updated (or blank if an error occurred). You can use the Update Now button to manually add/update articles.
Update: Importing Document Files
You can optionally specify a Import Document File for the Update operation. This is a path to a document file (Word, PDF, HTML, Markdown, RTF, Email EML,Outlook MSG, Text or Excel files). If a file is specified the contents will be read, converted to plain text and added to the article text. When importing a document, the file name will be used as the Article Title if no title is specified.
Note: Imported documents will be split into pages and a separate article will be added for each page.
Update: Special Handling Of Markdown Files
When importing Markdown files (.md extension), the Markdown text will be split into articles based on # Headings (up to 4 levels) and the title of each article will be the full heading for all levels (eg: Main Heading, Heading Level 2, Heading Level 3).
Note: This operation may take several minutes when importing large documents with many pages, or large Markdown files. You can use the Knowledge Store Browser option to manually import documents into your Knowledge Store.
Update: Add Embeddings
This option is used to include embeddings with the article record. Embeddings are a list of numbers (a 'vector') that are used to measure the relatedness of text strings. This enables a much more accurate list of relevant articles when doing a search. If you are using the Embedded Knowledge Store action in conjunction with ChatGPT then you should enable this option. Enter your Open AI API Key or OptimaGPT API Key (or specify a global OpenAI/OptimaGPT API Key in the Server Settings - AI section).
When using OpenAI, adding embeddings is not expensive (you could add embeddings for 1000 articles for less than $0.25).
If you do not add embeddings then the Search operation will only do a keyword match based search rather than a semantic .
Delete
Delete an existing article. Specify the Article Title to delete. The Assign To variable will receive the title value - or blank if the title does not exist. You can use the Delete Now button to manually delete articles.
Search
Search the Knowledge Base for relevant articles based on the Search For text. You can return the Top x most relevant articles - in relevance order. The Relevancy Threshold setting controls the relevancy level. Articles below the relevancy % will not be included. This value defaults to 75%.
Enable the Add Embeddings option if you added embeddings when the article was created. When this option is enabled then embeddings are obtained for the Search For text and then used to perform a semantic search of stored articles. This will provide a much more accurate list of relevant articles.
When using with ChatGPT you can specify the Max Tokens and Max Characters that should be returned in the search. This will prevent your requests from going over the token limit.
In the Return As list select either Text or Json. Specify Json if you are searching for articles to add as context for the ChatGPT action. The Assign To variable will be set to the returned articles.
You can optionally assign the top (most relevant) title and tag to variables, select from the Assign Top Title and Assign Top Tag to lists.
You can also perform a Knowledge Base search on the ChatGPT action itself when adding context to a conversation.
Get
Retrieve an existing article. Specify the Article Title. The Assign To variable will receive the article text - or be set to blank if article does not exist. You can use this option to lookup a specific article. In the Return As list select either Text or Json. Specify Json if you are looking up an article to add as context for the ChatGPT action. The Assign To variable will be set to the returned article.
List
Get a list of all article titles in the specified Collection Name. The Assign To variable will receive the returned titles (one per line). You can use the returned data in a For Each.. Line In loop if you need to perform actions on each value returned.
Drop
Removes all articles from the specified Collection Name. The Assign To variable will receive the collection name - or blank if the collection does not exist. You can use the Drop Now button to manually drop the collection (all articles in the collection will be deleted).
Click the Browse Knowledge Store button to open the Knowledge Store Browser. Here you can view articles for each collection. You can edit, add & delete articles. You can also test Searches and import multiple files & documents. You can also access the Knowledge Store Browser from the Studio - File menu.
You can also use the Web Spider action if you want to import an entire web site into your Knowledge Store.
Ensure the Add Embeddings option is enabled when adding articles to the Knowledge Store.
If you are building a Knowledge Store in order to provide context to a ChatGPT/OptimaGPT conversation you should ensure each article text is less than approximately 10000 characters. It is better to have lots of specific knowledge store articles than a few long ones (when importing files & documents into your Knowledge Store, these will be split into pages automatically - ensuring no single article text is > 10000 characters - or thereabouts).
If you have thousands of articles it is better to split them in to separate Collections based on some category. This will provide better performance during searches. For example, suppose you want to have a Chatbot that provides product information. You could ask for the product name at the start of the chat (using the Subject field). Then use this to lookup from the relevant Knowledge Base collection during the chat.
If you are adding product support type articles, or frequently asked questions, each article should be a question and answer, for example:
xxxxxxxxxx
I have forgotten my password, what can I do?
Answer:
Click the forgot password link in the control panel 'Account' menu. This will ask for an email address. Provided the email address is registered on our system, a reset password email will be sent. Click the link in the email to reset your password.
There may be occasions where you need to ensure a specific article is added to the context instead of relying on a search. For, example: If a specific keyword or combination of keywords exist in the incoming message. You can use the Get operation to lookup a specific article via it's title, and add this as context after adding context using a search. The context wont be added twice if the article was already included in the search.
If you want to add data related context for ChatGPT (for example, customer accounts/order information) - and the data is available via a Database/CRM etc, then you don't need to add this to the Knowledge Store. Instead, lookup the customer information via their email address from your database and add the context directly.
The Tag is an optional text string you can add to articles. You can return the top tag when performing a Knowledge Store search. This can be useful if you want to perform specific actions within your Automation based on the tag value.
For example: Suppose you have several articles relating to 'service status'. You could add the tag 'service status' to each of these. When a search is performed, if the top tag returned is 'service status' your Automation could lookup your service status and add this as context.
General Tips For Building A Knowledge Store
You can use separate Automations to update the Knowledge Store. For example: You could use an Email message source to read emails from a specific 'knowledgebase' mailbox. Any emails coming into this mailbox could update the Knowledge Store - using the %Msg_Subject% as the title and the %Msg_Body% as the article text. You can then simply send/forward emails to that email address to add/update the Knowledge Store. Or you could use the File Pickup message source to monitor a folder - and simply add files/documents to the folder that you want adding to the knowledge store.
This action enables you to store any number of text records against a Collection Name. Each record is saved with a key value. Full text searches can then be performed against the collection. Matching keys and/or text will be returned sorted by search rank. The full text database uses a full text index, allowing for fast retrieval against a large number of records.
Collection Name
Key/text pairs are contained within a Collection. Multiple collections can be used. Collection names can contain letters or numbers only. Key/text pair collections are global to the ThinkAutomation instance (IE: The same collection can be used on all Solutions/Automations).
Operations:
Set
Add a key/text pair within the Collection. Specify the Key and Text (both can contain %variable% replacements). The Assign To variable will receive the key value (or blank if an error occurred). You can use the Add Now button to manually add key/text pairs.
Search
This operation allows you to perform a full text search. Specify the search text in the Search For entry. This can be a %variable%.
The search for text can be multiple words or phrases and can contain boolean operators. Examples:
Search Text | Results |
---|---|
pricing quote | Searches for any text containing 'pricing' and 'quote' anywhere in the text. |
"pricing quote" | Searches for any text containing the phrase 'pricing quote'. |
pricing + quote | Searches for any text containing the phrase 'pricing quote'. |
quot* | Searches for any text beginning with 'quot'. |
pricing NOT quote | Searches for any text containing 'pricing' and not 'quote'. |
pricing OR quote | Searches for any text containing 'pricing' OR 'quote'. |
pricing AND (quote OR quotation) | Searches for any text containing pricing and either quote or quotation. |
From the Return list, select:
Keys : to only return the keys
Text : to only return the text
Keys, Text : to return both
If text or keys+text is selected, then you can enable the Highlight Matched Text option. If this option is enabled then matched words in the returned text will be enclosed in <b>
and </b>
tags.
From the Return As list, select:
Text : to return text. If 'text' or 'keys, text' is selected for the Return type, then each record will be separated by a single line '---'. When only returning keys, then each key will be returned on a separate line.
Json : to return Json data.
The Limit entry is used to specify the maximum number of records to return.
Records will be returned in rank order, with the closest matches being returned first.
The Assign To variable will receive the returned results. Use the Test button to test searches.
Delete
This operation will delete a full text record. Specify the Key to delete. The Assign To value will contain the deleted key, or blank if no record was deleted.
Drop
This operation will delete the entire collection.
Update a Microsoft Excel Spreadsheet file.
Enter or select the Excel File Name to update. Optionally enter the Worksheet Name to update. If no worksheet is specified then the first worksheet in the Excel file will be updated.
ThinkAutomation will create the file if it does not already exist. Excel does not need to be installed on the ThinkAutomation computer for this Action to work.
Select the Operation:
Add a new row to the worksheet.
If the Automatically Add A New Row Using Extracted Fields option is selected, then a new row will be automatically added with a column for each Extract Field action.
The spreadsheet will be in the following format:
ExtractedField1 | ExtractedField2 | ExtractedField3 |
---|---|---|
Value | Value | Value |
If the worksheet contains no rows then a header line will be created with each extracted field name.
The data line will be added to the existing data lines with each extracted field value.
If Automatically Add A New Row Using Extracted Fields option is not selected then you must specify the Value and Header for each column number. Specify each Column Number that you want to add (starting from column 1). Then specify its Value and Header. The value can be a fixed value or %variable% replacement (or combination). You can skip columns (eg: Add columns 1,3 & 5). The Header will only be used if the worksheet contains no existing rows.
Select the Update Specific Cells option to update specific cells within a worksheet. You can then specify specific cell references (eg: A1, B4, E23 etc) and the value to assign each cell. The value can be a fixed value or %variable% replacement (or combination).
This option enables you to insert CSV data into a worksheet. In the Insert A Cell Reference enter the cell reference where the inserted rows can columns should start. If this entry is blank then the data will be inserted starting at the last row used in the existing worksheet (or at the first row for a blank spreadsheet).
If the Shift Rows Below Down option is enabled then any rows below the specified Insert At Cell Reference will be shifted down to make room for the inserted rows (does not apply if no Insert At Cell Reference specified or if the spreadsheet is blank).
Specify your CSV data in the CSV Data Or File Path entry. This can be a %variable% replacement containing CSV data or a file path. If a file path is used then the CSV data is read from the file.
Enable the Has Column Headers option if the CSV data contains column headers.
Enable the Insert Headers option if you want the CSV column headers to be inserted in the spreadsheet.
If you simply want to convert a CSV file into an Excel Document you can use the Convert Document action.
Enable the Recalculate option if you want ThinkAutomation to recalculate all formulas in the Excel file after any updates. Normally you would not need to enable this option (since Excel itself will recalculate when the file is opened). However, if you make use of the Excel file in subsequent actions and any updated cells are used in formulas then you should enable this option to ensure the Excel file is fully updated before its saved.
Password
Enter a Password if you are updating an existing Excel file that is password protected. If you are creating a new Excel File then it will be saved with the password (optional). Note: Updating a password protected Excel file is slower.
Read specific cell and cell range values from an Excel compatible spreadsheet file and assign returned values to multiple ThinkAutomation variables.
Enter or select the Excel File Name to read. You can optionally specify a Password if the Excel file is password protected.
In the Cell Assignments grid you can list one or more Cell References to read from the Excel file. For each you can specify the Worksheet. If the Worksheet is blank then the first worksheet will be used. In the Assign To column specify the ThinkAutomation variable to receive the value of the specified cell reference.
Cell References can be a single cell (eg: B12), a cell range or a Named Range/Named Cell. In Excel you can define a Name for a range or cell so that if rows/columns are inserted before it, the 'Name' still references the existing cells even though their row/column references may have changed. This is useful if you need to read a total cell where new rows are added regularly.
Cell Reference Examples | |
---|---|
B12 | Returns the single cell value for cell B12. |
A1:C3 | Range that includes cells from top-left cell A1 to the bottom-right cell C3. |
B3:F{last} | Range that includes cells from top-left cell B3 to the last row bottom-right cell F |
A:A | Range that includes the entire column A. |
A:C | Range that includes the entire columns from A to C. |
1:1 | Range that includes the entire row 1. |
1:3 | Range that includes the entire rows from 1 to 3. |
3:{last} | Range that includes the entire rows from 3 to the last row in the sheet. |
Cell Ranges To CSV Text
When a cell reference is specified that returns multiple cells, the data will be returned as CSV text, with the number of rows and columns depending on the selected range (without column headers, unless the range itself starts with the column headers).
You can use the {last}
marker in ranges to use the highest available row number.
Enable the Compress CSV option if you want to remove any blank rows and columns from any CSV data extracted from cell ranges.
Update a counter value for any name/value pair and optional period.
This action can be used to update a counter value that is stored by the ThinkAutomation Server. After updating the counter the new counter value can be returned to a variable.
Enter the Counter Name. The name is limited to 50 characters and will be truncated if longer.
Enter the Counted Value. This entry is optional. If a Value is specified then a separate counter will be maintained for each unique name/value pair. The Value can contain %variable% replacements.
Counters are shared within a Solution. So if a counter on two Automations within the same Solution update the same name/value pair then the same counter will be used.
Period
Counters can be maintained per :
Period | Details |
---|---|
Static | No period |
Day | The month day number (1-31) |
Day Of Week | The day of week (0-6, 0=Sunday, 1=Monday etc) |
Year And Month | The year and month (2022 01, 2021 02 etc) |
Year | The year |
Month | The month number (1-12) |
Year And Week Number | The year and week number (0-52) (Iso8601) |
Hour | The hour (0-23) |
Minute | The minute (0-59) |
The period date is based on the message date %Msg_Date%
If a period is selected then a new counter is created for each unique period. A Static counter has no period.
Operation
You can Increment, Decrement, Get or Set a counter. If Set is selected then you can specify a value.
When a message is processed, ThinkAutomation will lookup the unique name/value pair. A new counter will be created if the name/value pair does not exist.
Any arbitrary data can be counted. For example:
Aim | Usage |
---|---|
Messages by day of week | Leave Value blank and set the Period to Day Of Week. |
Messages received by email address per year/month | Set the Value to %Msg_FromEmail% and the Period to Year And Month. |
Messages by any extracted field or variable value (payment types, currencies etc) | Set the Value to a %variable% and any select a Period. |
Orders by company name per year | Set the Value to a %variable% holding a company name and the Period to Year. |
Outgoing emails sent by email address per month | Set the Value to the variable containing the receiver address and the Period to month. |
The counted Value has a maximum size of 250 characters. Values larger than this will be truncated before being counted.
Select a variable to receive the updated counter value from the Assign Counter Value To list.
Getting All Counter Values
You can return all counter values for a given counter name/value using the Get All operation. This will return all periods currently counted. The Get All operation returns the data in CSV format to a variable. If no Value is specified then all values/periods will be returned.
You can use the Set Variable action with the Convert CSV To Markdown Table operation to convert the CSV data to a Markdown table if you want to create an Automation to quickly return and view counter values.
Viewing Counters Using The Studio
Counters can be viewed using the ThinkAutomation Studio. Open the Solution properties page and click the Counters tab. You can clear a counter using the Clear button.
Send an outgoing email message.
Emails can be sent immediately or you can Schedule Send on future dates. Email messages can be sent in plaintext, Markdown and/or HTML format. You can add attachments and you have the option of including the incoming attachments.
Enter the From & To addresses and Subject. The Reply To, CC & BCC are optional. The To, CC and BCC entries can contain multiple addresses separated with commas, semi-colons or line breaks.
If you want to send the email to the sender of the incoming message set the To address to the %Msg_From% built-in variable.
The To address should contain the recipient name and email address where possible. This will reduce the likelihood of the recipient mail server marking the email as spam. The format is: name <email>. For example: Howard Williams <howard.williams@somecompany.com>. You can use %variable% replacements for both parts. The %Msg_From% will already contain both name & email parts if the sender supplied them.
Adding an Unsubscribe link to your emails will also reduce likelihood of the email being marked as spam. You can create a Web Form message source with an unsubscribe form to process unsubscribes and then include the Web Form URL as a link in outgoing emails.
The To address can contain multiple recipients separated by commas, semi-colons or line breaks. The receiver of the email will see all addresses in the 'To' address on the email they receive. If you want to send the same email to multiple recipients without each receiver seeing the other recipients you can use a For..Each loop, looping on Comma Separated Values In or Lines In. Inside the loop, use the Send Email action and assign the To address to the variable containing the individual email address. Each email will then be sent separately with a single 'To' address.
You can attach files to outgoing messages. You can also include attachments from the incoming message.
To add attachments - click the ...
button on the Attach box to add local files. You can also use %variable% replacements in the Attach box to include files created by other actions.
Enable the Include Incoming Attachments option to automatically add any incoming attachments with the outgoing email. This will be in addition to any other attachments you add.
Enable the Include Incoming Inline Attachments option to attach incoming inline attachments. Inline attachments are images and other types of file that are included in the body of the incoming email. If this option is enabled then ThinkAutomation will add the inline attachments as regular attachments to the outgoing message.
For the body of the email click the Message tab to enter the message text. Click the HTML tab to compose the HTML portion (you can use either or both). When the email is sent it will include both plaintext and HTML. If HTML is specified, but no plaintext, then ThinkAutomation will automatically create the plaintext portion of the email from the HTML. Both the Message and HTML can contain %variable% replacements.
Using Pre-Prepared HTML
If you have created a %variable% containing HTML (for example using the Wrap HTML action) you can use this on the Message tab. If the %variable% content of the Message tab is HTML (contains <html>
and <body>
tags) and the HTML tab content is blank, then ThinkAutomation assumes you want to send HTML content.
Markdown
You can use Markdown in the Message tab text. The Markdown will be converted to HTML when the email is sent. To use Markdown to HTML conversion - ensure that the HTML tab content is blank. You can disable the Markdown to HTML conversion by unchecking the Convert Markdown To HTML When Email Is Sent option. See: Markdown Notes.
External Content For HTML
For HTML content you also have the option of using an External File or URL For HTML. If an external file or URL is specified then this will be read and used for the HTML content. When using an External File or URL then you also have the option to Embed Images. If Embed Images is enabled then any external images used in the HTML will be downloaded and embedded. Not all email clients will display embedded images - so you should test this option before using.
If the Convert CSS To Inline Styles option is enabled then any stylesheets in the HTML will be converted to inline style attributes. This provides better email client compatibility.
Email messages can be sent on future dates using Scheduled Send option.
For example, suppose you have an Automation that responds to a sales order email. The Automation sends the customer a 'thank you' email when the order is received. You could then use the Scheduled Email option to send a follow up email in 30 days time to see how the customer is getting on with their new product.
Any number of scheduled email responses can be setup. ThinkAutomation saves the email in the Message Store database along with the scheduled date and time that the message should be delivered.
Enable the Scheduled Send option and specify either Send After n Days or Minutes, or Send On A Specified Date/Time and enter the date/time to send the email.
If you are not using the Scheduled Send option you can select one of the Send Options:
Add To Outbox Queue - the email is added to the outbox queue and will be sent by the ThinkAutomation Server as a separate process (with automatic retries for any temporary failures). The Automation will not wait for the email to be sent. Your Automation will execute faster with this option. This is the default option.
Send The Email Immediately - the email is sent immediately and the Automation will wait for the result. The result can be returned to a variable from the Assign Result To list. The result will be 'success', 'retry' or a fail reason. If your outgoing email server returns a temporary failure, then the result will be 'retry' and the email will be added to the outbox queue to be retried later.
Do Not Send The Email - the email is not sent. The mime text can be returned to a variable (see below).
You can also optionally assign the MIME text (EML) created for the outgoing email to a variable. This is useful if you want to save the mime text to a folder for an external mail server to pickup, or use a custom action or script to actually send the message. If the Do Not Send The Email send option is selected, then ThinkAutomation will not send the email itself - it will just assign the resulting mime text to the specified variable.
By default outgoing emails are sent using the Email Sending options specified in the Server Settings. You can optionally specify email sending options on a per outgoing email basis. This is useful when you want to route specific outgoing emails via specific mail servers. For example, suppose you have two mail servers, one located in the USA and one in the UK. You could choose to send emails via the USA or UK server based on some condition.
Click the Send Via tab to specify the Send Via options.
Each of the Send Via options can use %fieldname% replacements. This allows you to conditionally set the Send Via options.
You can optionally digitally sign the outgoing email. A digital signature is a unique identifier that validates the authenticity of a person’s outgoing email messages and assures recipients they have come from that person, as opposed to a cybercriminal or unknown sender. Unlike a simple electronic signature, digital signatures cannot be replaced or altered, thus giving recipients peace of mind that the contents of the incoming message are safe before opening it.
Select the Send Signed tab and enable the Send Signed option. You must then select a certificate to use for the signing. Click the Select Certificate button. You can choose a certificate imported into the Windows Machine certificate store, or select a PFX file. Only certificates that have been obtained from an independent certificate authority and are valid for email signing should be used.
The Send Signed option is not available when using SendGrid to send outgoing messages.
The Send Test Email button will send the current message immediately, regardless of the Schedule or Send Option. The email will be sent using any Send Via settings. Change the To address if you want to send a test message to yourself.
Removes any pending scheduled emails for a given recipient.
This action can be used to cancel the sending of any scheduled emails. This could be used for example on an 'Unsubscribe' Automation.
Specify the recipient email address in the Remove Scheduled Message To entry.
The From can be blank - or if completed, only messages from the given address will be deleted.
You can remove only messages matching a Subject - or leave blank for all.
The number of scheduled messages removed can be assigned to a variable. Select the variable from the Assign Number Remove To list.
Forwards the incoming message to new recipients.
Specify the From and To addresses. The Subject can be changed - if you wish to use the incoming subject set it to %Msg_Subject% (or 'FW: %Msg_Subject%').
You can add additional attachments and Drop Incoming Attachments.
Waits for a user response before proceeding with the remaining actions for the Automation.
This action can be used to provide a human validation response in the form of a unique web form that must be completed before the Automation continues. This can be used to gather additional information from a user. ThinkAutomation will pause execution of the Actions for the current message until a user completes the web form. It will move on to process the next message whilst waiting for the validation of a previous one. A single Automation can contain multiple Wait For User Response actions. The web form can optionally contain Survey Fields. If any survey fields are specified then the user must complete the form before validating the message. The results of the Survey Fields are passed back to the Automation and can be used in subsequent actions
For each Wait For User Response request ThinkAutomation creates a unique Validation URL. You must send an email or SMS containing the %Msg_ValidationUrl% variable replacement to someone. When the recipient receives this email they click the URL to validate the message. Once validated the remaining actions setup on the Automation are then executed for that specific message. Validation URLs are secured using a one-way hash, so a user could not validate the wrong message by manually changing the URL.
You can either use a separate Send Email or Send SMS Action to send you own message containing the %Msg_ValidationUrl% variable (send before the Wait For User Response action itself) or enable the Send Request Via Email option to include the email sending within the Wait For User Response action itself. You can customize the email content. The Body text must contain %Msg_ValidationUrl% somewhere.
The Send Request Via Studio & Client Users option will send the validation request to any users running the ThinkAutomation Studio or ThinkAutomation Desktop Connector. Studio and Desktop Connector users can complete the validation request from there. You can specify specific Usernames or leave this blank to send to any ThinkAutomation Studio or Desktop Connector users (connected to your ThinkAutomation Server instance).
Show Accept Buttons
If this option is enabled then the validation page will show Accept & Not Accept buttons below the validation page message. The user must click the Accept button to validate the message. If the Do Not Accept button is clicked then the message is rejected and the Timeout/Not Accepted Action performed. If this option is not enabled then the user only needs to click the Validation URL to validate the message (unless survey fields are used - see below). You should adjust the Validation Page Message accordingly.
Continue On Timeout
If this option is enabled then the Automation will continue if the validate request has not been completed before time timeout. The Assign Result To variable will be set to 'expired'.
Max Wait Time (Mins)
This is the maximum number of minutes that ThinkAutomation should wait for the validation. It defaults to 2880 (48 hours).
Assign Result To
Select the variable to receive the validation result. This will be 'true', 'false' or 'expired'. Within your Automation you can then perform conditional actions based on the result.
Survey Fields
In addition to displaying a message, ThinkAutomation can optionally show a form containing any number of input fields. If any fields are specified then the user must complete the form before validating the message. The results of the form are passed back to the Automation and can be used in subsequent actions. Click Add to add a new input field.
Enter a Name and Label Text. You can also optionally specify Help Text that will display in a smaller font below the input field.
The Field Type can be:
Text
Number (numeric only)
Date
Boolean (check box)
HTML Editor (a full featured HTML editor - returns HTML)
Email (only a valid email address allowed)
URL (only a valid URL allowed)
Telephone
Password
Decimal
Currency
Time
Range
Label (displays the label text only - does not return a value)
For text field types you can specify the Max Length. The Max Lines option allows you to define the maximum lines.
The Attributes tab allows you to specify a default value, change case & validation rules. Enable the Validate option. When the web user completes the form they will not be able to submit it until all of the fields pass validation.
If you want the user to select possible values from a list, select the Must Be In List option and then enter the Choices. For example to show a list box showing 'Yes', 'No' & 'Not Sure', set the Field Type to 'Text', enable the Validate option, select the Must Be In List option and add Choices of 'Yes', 'No' and 'Not Sure'. The default value of the select list will be set to the Default Value entry.
You can arrange the order of fields on the form using the Up & Down buttons.
Assigning A Survey Field Value To A ThinkAutomation Variable
You must then select a ThinkAutomation variable to assign the entered value to. Select the variable from the Assign Value To list. Once a message is validated and the Automation continues execution, you will be able to make use of input values in subsequent actions.
A simple example would be a single field that asks 'Add customer %Name% to CRM?' - with a Y/N choice. The value can be assigned to a Variable called '%AddCRM%'. After the Wait For User Response Action you can add a conditional Action: 'If %AddCRM% Is Equal To Y Then ....'
The Wait For Used Response web page uses the ThinkAutomation Web API hosted in Azure, so it will work without requiring any local setup.
Creates an appointment in any iCalendar compatible Calendar Server, sends an iCalendar compatible appointment request as an email attachment or saves the appointment to a file which can be attached to an email on a subsequent action.
iCalendar is used and supported by a large number of products, including Google Calendar, Apple iCal, Lotus Notes, Yahoo Calendar, Microsoft Outlook and others.
The Send As drop down has three options:
Send Directly To An iCalendar Server: This option allows you to post directly to an iCalendar Server using the CalDav protocol. You need to specify the URL of the server to post to. This URL will depend on the Calendar Server you are using.
For Google Calendars use: https://www.google.com/calendar/dav/{googlemailaddress}/events/ - and use your Google user name/password.
You may need to specify a User Name and Password and Authentication mode if the iCalendar Server requires a login first. Login to your iCalendar Server to obtain the iCal address.
Send To An Email Recipient: With this option you specify an email address. The appointment will be sent as an attachment with the .ics extension. Most Calendar applications will import this directly when the recipient opens the attachment.
Save To File: Saves the Appointment to a local file with an .ics extension. You can then use this as an attachment on other Send Email actions.
All remaining text fields can use %variable% replacements.
You must specify the Attendees as email addresses. Multiple addresses can be separated by commas.
The Categories, Location, Subject & Description fields are optional.
The Organizer must be specified as an email address.
The Start Date/Time and End Date/Time can use %variable% replacements if required. If a Start/End Date is given as a %variable% replacement then the variable contents must be able to be interpreted as a date.
Send a message and/or files to a Slack channel. Slack is a messaging and collaboration platform. See: https://slack.com for more information.
Before you can use this action you must first authorize ThinkAutomation to connect to Slack. Click the Connect button and enter your Slack username/password. You will then be asked if you want to allow ThinkAutomation to be able to post messages to Slack.
Once connected your team name & domain will be shown
You can post messages and/or upload files to any of your team channels that the authorized user has access to.
Posting A Message
Enter the Send Message text you want to post. Leave this blank if you only want to upload files.
Uploading Files
Expand the Select Files box and enter or select the file you want to upload. This can be a single file or a comma separated list. %variable% replacements can also be used if you want to upload files created from previous actions. You can also optionally Include Incoming Attachments. Enter the Mask for the attachment types to upload (eg: *.pdf).
If the Post The Message From The Authenticated User option is enabled then the post will be from the Slack user you connected with, otherwise the post will show as from a bot called ThinkAutomation.
Select the channel you want to post the message/files to from the Post To Channel drop down - this will list all the channels available to your team.
You can assign the result of the post to a variable. Select from the Assign Response To dropdown. If the post was successful the response will be 'Ok'. Otherwise it will contain an error message.
Send a Tweet to Twitter or reply to an incoming Tweet.
Before you can use this action you must first authorize ThinkAutomation to connect to Twitter. Click the Connect button and enter your Twitter username/password. You will then be asked if you want to allow ThinkAutomation to be able to post Tweets to Twitter. Tweets will be sent on behalf of the this user.
Enter the Send Tweet test. This can contain %variable% replacements. Twitter limits Tweets to 280 characters. ThinkAutomation will truncate the message if required.
If the incoming Message Source type is Twitter you can reply to the current message. Enable the Reply To Incoming Tweet option. For example: You could create a Twitter Message Source to monitor your @mentions for your own Twitter account. Any Tweets with 'great/good service' etc you could automate a 'Thank you' reply.
ThinkAutomation uses the new Twitter Version 2 API. The Send Tweet text can be set to the Json body for more complex Tweets. See: POST /2/tweets | Docs | Twitter Developer Platform
Create a document using the built-in Word Processor and save the document in various formats.
The Document Editor emulates Microsoft Word. You can format the document as you would with Word using fonts, tables, headers/footers etc. You can load an existing document file using the File - Open option. Once you save the Action the document data will be saved with your Automation (the original file will remain unchanged).
Inserting Variables
Variables can be dragged and dropped onto the document (or type the %variablename% directly in the document). These will be replaced when the Automation executes. Any formatting applied to the %variable% will be preserved when the value is replaced.
Save As
From the Save As Format list select the type of file to save when the Automation Executes. The document can be saved as:
DOCX (Microsoft Word)
ODT (Open Document)
TXT (Text File)
RTF (Rich Text File)
HTML
MHT
EPub
When the Automation executes, the document template will be used to create a file in the above format. All %variables% in the document will be replaced.
If PDF format is selected then you can specify a Password. The recipient of the PDF file will need the password to open it.
If HTML format is selected then the following options are available:
Use Inline Styles - select this option to use Inline CSS instead of a style section. This option should be used if you will use the HTML on outgoing emails.
Embed Images - select this option to specify whether images should be embedded into the HTML or stored externally. Embedded images in the HTML document are stored in base64 encoding. This option should be used if you will use the HTML on outgoing emails.
Specify the Save To folder - click the ...
button to select a local file or use %Root% to save it in the default ThinkAutomation location.
Enter a File Name to save the document as (the extension will be added automatically based on the Save As Format if it is not specified).
If Ensure Unique File Name is enabled then ThinkAutomation will add a timestamp to the filename to ensure it is unique.
If Delete File After Message Is Processed is enabled then ThinkAutomation will remove the file when the Automation completes for the current message. This is useful if you wish to use the document in the Automation (for example, to send the document as an attachment with the Send Email action, or to use the html file as the body of an outgoing email), but do not need to keep a local copy afterwards.
You can assign the saved path & filename to a variable by selecting the variable from the Assign Path To list. You can then use this variable in the Attachments entry on Send Email actions or in any other way.
Enter the Document Name. This shows in the actions list and Automation log. If a File Name is not specified then the document name will be used. For PDF exports the PDF document properties 'title' will be set to the document name.
Default Document Template
When creating a new document, ThinkAutomation will look for the Microsoft Word document DefaultDocument.docx in the ThinkAutomation program files folder. If this file exists it will be loaded and all the styles available in the document can then be used in the new document.
Create an Excel compatible spreadsheet using the built-in Spreadsheet Editor. Automation %variables% can be assigned to cells when the Automation executes. Spreadsheet formulas are then recalculated. The resulting spreadsheet can then be saved in various formats and you can read cell values back into Automation %variables%. You can use this Action to create formatted Invoices, Quotations etc. that can then be saved and emailed.
The Spreadsheet Editor emulates Microsoft Excel. You can format the spreadsheet as you would with Excel using formulas, charts, images, borders, fonts etc. You can load an existing Excel file using the File - Open option. Once you save the Action the spreadsheet data will be saved with your Automation (the original file will remain unchanged).
Inserting Variables
Spreadsheet cells can contain Automation %variables%. When the Automation executes these will be replaced with their values.
There are two ways to embed %variables%.
Drag and drop a variable from the Variables List onto any cell or edit a cell and include one or more %variables% inside any text. It is assumed these variables are not used in formulas.
Add a Cell Assignment. You would use this method if the cell is used in a formula. Select a cell in the Spreadsheet and click the Add button from the Before Calculation Assign Variables To Cells list. The Assign Cell form will be displayed. Enter a value or select a %variable% from the Assign From list. You can enter a value in the spreadsheet cell itself as a placeholder to allow you to see formatting/formula results etc. When the Automation executes the cell value will be replaced and all formulas re-calculated. You can create any number of Cell Assignments.
Saving The Spreadsheet (optional)
Enable the Export File option.
From the Save As Format list select the type of file to save when the Automation Executes. The spreadsheet can be saved as:
Excel File
CSV File
PDF Document
HTML File
When the Automation executes, the spreadsheet template will be used to create a file in the above format. All %variables% and Cell Assignments in the spreadsheet will be replaced and formulas re-calculated.
If Excel or PDF format is selected then you can optionally specify a Password. The recipient of the file will need the password to open it.
Specify the Save To folder - click the ...
button to select a local file or use %Root% to save it in the default ThinkAutomation location.
Enter a File Name to save the spreadsheet as (the extension will be added automatically based on the Save As Format).
If Ensure Unique File Name is enabled then ThinkAutomation will add a timestamp to the filename to ensure it is unique within the Save To Folder.
If Delete File After Message Is Processed is enabled then ThinkAutomation will remove the file when the Automation completes for the current message. This is useful if you wish to use the document in the Automation (for example, to send the spreadsheet as an attachment with the Send Email action), but do not need to keep a local copy afterwards.
You can assign the saved path & filename to a variable by selecting the variable from the Assign Saved File Path To list. You can then use this variable in the Attachments entry on Send Email actions or in any other way.
Reading Back Cell Values
After all Cell Assignments have been made and formulas re-calculated you can optionally read cell values back and assign to Automation %variables%.
For example, you could create a quotation spreadsheet that adds %qty% and %price% variables and then read back the 'total' cell to a %variable% which you can then use further in the Automation.
Select a cell in the Spreadsheet and click the Add button from the After Calculation Assign Cells To Variables list. The Assign Cell form will be displayed. Select a %variable% from the Assign To list. You can create any number of Variable Assignments.
Assign CSV Data
You can optionally assign the spreadsheet data in CSV format to a variable. Select the variable from the Assign CSV Data To list. Enable the Use Formatted Values For CSV if you want to return data as it has been formatted, otherwise unformatted data is used.
This option is useful if you want to use the Spreadsheet action to simply create a table of data that you can then use further in the Automation. For example, you may want to include a table in an outgoing email. Use the Spreadsheet action to create your table and assign the CSV data to a variable. Then use the Set Variable action with the Convert CSV To Markdown Table operation and include the Markdown table in your outgoing email body.
Converts a Microsoft Word, Microsoft Excel, PDF, Open Document, Richtext, Text, Markdown Text, CSV or HTML, file to various formats.
The document to convert can be a local file (or a file saved from a previous action) or incoming Attachments.
Select a Document To Convert - this can be any local file or a %variable% replacement. You can specify multiple documents if required, separated by commas (any file paths that contain commas must be enclosed in quotes).
Enable the Include Incoming Attachments option to convert attached documents matching the Matching Mask. Enter *.* to convert all supported attachments.
Select the Convert To type. You can convert to the following formats:
DOCX (Microsoft Word)
ODT (Open Document)
XLSX (Microsoft Excel)
XPS
HTML
TXT
CSV
Images (PNG, GIF, BMP, JPEG, TIFF)
When converting PDF to image files, each page in the PDF document will be converted to a separate image file. The page number will be added to the filename, eg: document_1.tiff, document_2.tiff.
When converting to Excel, the document to convert can be CSV, XLS or text only.
In the Rename Converted Files To entry you can optionally specify a new name for the converted file. You can use %fieldname% replacements - for example: order%OrderNumber%.pdf would rename the attachment order1234.pdf if the %OrderNumber% field contained '1234'.
You can use the special variable replacement %filename% to use the original file name as part of the renamed file. For example, suppose the document to convert was called "orderdata.docx" and the %OrderNumber% variable was set to '1234' - renaming to: %filename%-%OrderNumber%.pdf would rename the file 'orderdata-1234.pdf'.
If your rename string doesn't contain a file extension then the Convert To type extension will be used.
In the Save To Path entry, enter or select the local folder to save the converted document to. If no Save To Path is specified then the converted files will be saved in the same folder as the file being converted.
If the converted file already exists it will be overwritten.
You can assign the saved path & filename(s) to a variable by selecting the variable from the Assign Filename(s) To list. You can then use this variable in the Attachments entry on Send Email actions or in any other way.
If Delete File After Message Is Processed is enabled then ThinkAutomation will remove the file when the Automation completes for the current message. This is useful if you wish to use the document in the Automation (for example, to send the document as an attachment with the Send Email action), but do not need to keep a local copy afterwards.
Converting HTML To PDF Or Word Formats
Converting HTML files to other formats will only work if the HTML contains absolute links (image files, stylesheets etc), and the those links are accessible. If you want to convert an online web page to PDF you can use the Save As PDF action instead - which allows any URL to be rendered to PDF.
You can also use the HTTP Get action to get HTML from a URL with Convert option set to Convert Relative Links To Absolute Links. Save the HTML to a file using the Read/Write Text File action and then convert this.
Markdown text files ('.md') will be converted to HTML first before being converted to the Convert To file type.
This action enables you to parse and extract text data from Word, PDF, Open Document, Excel, RichText, Markdown and HTML attachments or local document files. Documents are converted to plain text which is then assigned to a variable. This action can also extract PDF form data.
Select a Document To Convert - this can be any local file or a %variable% replacement. You can specify multiple documents if required, separated by commas (any file paths that contain commas must be enclosed in quotes).
Enable the Include Incoming Attachments option to convert attached documents matching the Matching Mask. Enter *.* to convert all supported attachments.
Select the variable to receive the plain text from the Assign To list.
The document(s) will be converted to plain text. Excel files will be converted to CSV text. Markdown documents will be converted to HTML first and then the HTML converted to plain text.
If multiple files are converted within the same action then the extracted text from each file will be appended to the returned text.
PDF Extract Form Data
Enable the PDF Extract Form Data option to extract only form data from PDF files. If enabled then form data only will be extracted in the following format:
xxxxxxxxxx
{form field Name}: {value}
{form field name}: {value}
...
Enable the Return PDF Form Data As Json option to return the form data as Json text.
PDF Text Extract Mode
When converting PDF documents to text you have a number of options:
Keep Positioning Method 1 : Some positioning will be retained.
Keep Positioning Method 2: Same as above but using a different extraction method. This may provide a more accurate plaintext representation of the PDF document in some cases.
Keep Reading Order Method 1 : The text will be extracted in reading order - with no positioning indentation.
Keep Reading Order Method 2 : Same as above but using a different extraction method.
Extract To CSV : Extracts each text element to CSV text with columns: Page, Bounds (left,top,right,bottom), Text, Font, Size, Weight, RGB. The CSV will contain a row for each text element.
Enable the Remove Repeated Blank Lines option if you need repeated blank lines removed from the text. This option is useful in cases where there is differing amounts of blank space in the PDF document which your extraction rules do not need.
You can then use the text in other actions - or use Extract Field actions to parse & extract data from the text.
To test the text extraction select or enter a document and click the Test button. The results will be displayed. Click the Copy button to copy the extracted text to the clipboard. You can then paste this into the Extract Field Helper Message if you need to extract data from the text.
Converts image files or image attachments to text using optical character recognition (OCR) and assigns the extracted text to a variable. This action can also extract images from PDF files and the convert these images to text.
Select a Image To Convert - this can be any local file or a %variable% replacement. You can specify multiple files if required, separated by commas (any file paths that contain commas must be enclosed in quotes).
Enable the Include Incoming Attachments option to convert attached images matching the Matching Mask. Enter *.* to convert all supported attachments (png, bmp, gif, tiff, jpeg, pdf).
The Language defaults to 'eng' (English). You can specify a different three letter language code. You can download additional language packages from https://github.com/tesseract-ocr/tessdata. These should be copied to the Tesseract tessdata folder.
The Output Type can be text, xml or CSV. If the Preserve Layout option is enabled then space padding is preserved.
If multiple images are converted within the same action then the extracted text from each image will be appended to the returned text.
Select the variable to receive the plain text from the Assign To list.
To test the text extraction select or enter an image file and click the Test button. The results will be displayed.
You can also use the ChatGPT action with the 'Ask ChatGPT To Respond To A Prompt With An Image' operation to perform OCR on images.
This action uses the open source Tesseract OCR library. Tesseract is not installed by default with the ThinkAutomation setup. If Tesseract is not installed the Install Tesseract button will be visible.
Converts PDF files or attachments to various image formats, html or text.
Select a PDF Document To Convert - this can be any local PDF file or a %variable% replacement. You can specify multiple documents if required, separated by commas (any file paths that contain commas must be enclosed in quotes).
Enable the Include Incoming Attachments option to convert attached documents matching the Matching Mask. Enter *.* to convert all PDF attachments.
From the Convert To list, select the type of file to convert the PDF document(s) to.
You can specify a Page Range to convert. Leave this entry blank to convert all pages in the document. Or specify a single page, a range (eg: 1-10) or a comma separated list of pages (eg: 1,3,5).
PDF files can be converted to the following image formats: PNG, GIF, BMP, JPEG and TIFF.
For image conversion you can optionally specify the Width and Height. Leave both as zero to leave the size unchanged. If only one of the Width or Height is specified, then the specified dimension will be respected and the other dimension will be calculated so that the original aspect ratio is maintained.
For Image conversion you can specify the Resolution. Larger resolutions will result in bigger converted files and increase conversion time.
For Image conversion enable the Color option if you want full color images created. Otherwise the images will be Grey-scale.
For conversion to TIFF image files you can enable the TIFF Multi-Frame option. If this is enabled then all pages will be converted to separate frames within the same image file.
You can also specify the TIFF Compression format. Supported compression formats are: Zip, Lzw, Rle, Ccitt3, Ccitt4 and None. Set to 'Default' for the best possible compression.
Converted files will have the same name as the original but with the new file extension. For image files, each page in the PDF document will be converted to a separate image file. The page number will be added to the filename, eg: document_1.tiff, document_2.tiff. You can rename the converted file by entering the new filename in the Rename Converted Files To entry. Use the field replacement %filename% to include the original file.
Specify the folder to save the converted files to in the Save To Path entry.
You can assign the full path & file name to a ThinkAutomation variable to use on subsequent actions (for example, if you wanted to attach the file to an outgoing message). Select from the Assign Filename(s) To list. Multiple files will be separated by commas. You can use this variable on the attachments entry of outgoing emails if you wanted to send the converted files via email.
If Delete File After Message Is Processed is enabled then ThinkAutomation will remove the file when the Automation completes for the current message. This is useful if you wish to use the document in the Automation (for example, to send the document as an attachment with the Send Email action), but do not need to keep a local copy afterwards.
Append document content or any text to a PDF document.
Enter or select the PDF File To Append To. This can be a %variable%. If the existing PDF file does not exist it will be created.
You can append other documents and attachments. Supports PDF, Word, Excel, Richtext, OpenDoc, HTML, Text and Markdown files.
Select a Append Documents - this can be any local document file or a %variable% replacement. You can specify multiple documents if required, separated by commas (any file paths that contain commas must be enclosed in quotes).
Enable the Include Incoming Attachments option to append attached documents matching the Matching Mask. Enter *.* to append all supported document types.
In the Append Content entry, you can specify any text to append. This can contain %variable% replacements. You can use plaintext, Markdown or HTML.
You can append Documents or Text Content, or both.
The updated PDF file can be saved with a new name. Specify the Rename Appended File To.
The updated PDF file can be saved to a different location. Specify the Save To Path.
If the original file is not renamed or not saved to a new location then the original PDF file will be updated.
The updated file name can be returned to a variable selected from the Assign Filename To list.
If Delete File After Message Is Processed is enabled then ThinkAutomation will remove the file when the Automation completes for the current message. This is useful if you wish to use the document in the Automation (for example, to send the document as an attachment with the Send Email action), but do not need to keep a local copy afterwards.
Converts PowerPoint files or attachments to various image formats or PDF.
Select a PowerPoint Document To Convert - this can be any local PowerPoint file or a %variable% replacement. You can specify multiple documents if required, separated by commas (any file paths that contain commas must be enclosed in quotes).
Enable the Include Incoming Attachments option to convert attached documents matching the Matching Mask. Enter *.* to convert all PowerPoint attachments.
From the Convert To list, select the type of file to convert the PowerPoint document(s) to.
PowerPoint files can be converted to the following image formats: PNG, GIF, BMP, JPEG, TIFF, WMP and SVG.
You can specify a Slide Range to convert. Leave this entry blank to convert all slides in the document. Or specify a single slide, a range (eg: 1-10) or a comma separated list of slides (eg: 1,3,5).
For image conversion you can optionally specify the Width and Height. Leave both as zero to leave the size unchanged. If only one of the Width or Height is specified, then the specified dimension will be respected and the other dimension will be calculated so that the original aspect ratio is maintained.
For Image conversion you can specify the Resolution. Larger resolutions will result in bigger converted files and increase conversion time.
For Image conversion enable the Color option if you want full color images created. Otherwise the images will be Grey-scale.
For conversion to TIFF image files you can enable the TIFF Multi-Frame option. If this is enabled then all slides will be converted to separate frames within the same image file.
You can also specify the TIFF Compression format. Supported compression formats are: Zip, Lzw, Rle, Ccitt3, Ccitt4 and None. Set to 'Default' for the best possible compression.
Converted files will have the same name as the original but with the new file extension. For image files, each slide in the PowerPoint document will be converted to a separate image file. The page number will be added to the filename, eg: document_1.tiff, document_2.tiff. You can rename the converted file by entering the new filename in the Rename Converted Files To entry. Use the field replacement %filename% to include the original file.
Specify the folder to save the converted files to in the Save To Path entry.
You can assign the full path & file name to a ThinkAutomation variable to use on subsequent actions (for example, if you wanted to attach the file to an outgoing message). Select from the Assign Filename(s) To list. Multiple files will be separated by commas. You can use this variable on the attachments entry of outgoing emails if you wanted to send the converted files via email.
If Delete File After Message Is Processed is enabled then ThinkAutomation will remove the file when the Automation completes for the current message. This is useful if you wish to use the document in the Automation (for example, to send the document as an attachment with the Send Email action), but do not need to keep a local copy afterwards.
Adds a digital signature to a PDF document.
Select a Sign PDF Document - this can be any local PDF file or a %variable% replacement. You can specify multiple documents if required, separated by commas (any file paths that contain commas must be enclosed in quotes).
Enable the Include Incoming Attachments option to sign attached documents matching the Matching Mask. Enter *.* to sign all PDF attachments.
You must then select a Certificate. This can be either an existing certificate stored in the Windows Certificate Store (specify the Common Name - ThinkAutomation will search for a certificate matching the Common name.) or a PFX file (you must also specify the PFX Password).
Optionally specify a Timestamp URL (eg: http://timestamp.digicert.com
) if you want the signature to include a timestamp.
Signature Box
Enable the Show Signature Box option to add a visual signature box to the PDF. If this option is disabled then the PDF will still be digitally signed, but will have no visual signature box.
The signature box can be added to the first or last page. Select from the Add To Page list. It will be positioned on the page using the Placement (eg: top/left, or bottom/middle).
You can optionally add an Image (for example, a green tick mark) and set the Image Placement & Image Opacity.
You can specify up to 3 lines of text to add to the signature box. The text can contain %variable% replacements.
Saving Signed Documents
Signed PDF documents by default will have the same name as the original. You can rename the signed PDF document by entering the new filename in the Rename Signed Files To entry. Use the field replacement %filename% to include the original file.
Specify the folder to save the signed documents to in the Save To Path entry.
You can assign the full path & file name to a ThinkAutomation variable to use on subsequent actions (for example, if you wanted to attach the document to an outgoing message). Select from the Assign Filename(s) To list. Multiple documents will be separated by commas. You can use this variable on the attachments entry of outgoing emails if you wanted to send the signed documents via email.
If Delete File After Message Is Processed is enabled then ThinkAutomation will remove the file when the Automation completes for the current message. This is useful if you wish to use the document in the Automation (for example, to send the document as an attachment with the Send Email action), but do not need to keep a local copy afterwards.
Renders the incoming message, an image file or any HTML content/file or URL as a PDF document.
From the Render list, select:
To render in the incoming message. This will render the incoming message body as it would appear in a web browser - including all images.
To render any HTML content/file or URL. Enter the file path or full URL to the web page you want to save as a PDF (or a %variable% containing a file path or URL). You can also specify a %variable% containing raw HTML instead of a filename if you want to use HTML content generated earlier in your Automation.
To render an image file. Enter or select the file path of an image file or a (%variable% containing an image file). You can use PNG, JPEG, BMP, Webp, TIFF & GIF images. The image will be embedded inside HTML and the HTML will then be converted to a PDF. Enable the Centered option to center the image horizontally on the page. Enable the Border option to show the image within a rounded border.
Select the Page Size, Orientation & Margin.
You can also enter an open Password. Users opening the PDF must enter this password before they can view the content.
Enter the File Name and select the Save To folder. You can use %variable% replacements in the file name. A '.pdf' extension will be added if required.
If Ensure Unique File Name is enabled then ThinkAutomation will add a timestamp to the file name to ensure it is unique within the Save To folder.
If Delete File After Message Is Processed is enabled then ThinkAutomation will remove the file when the Automation completes for the current message. This is useful if you wish to use the document in the Automation (for example, to send the document as an attachment with the Send Email action, or to use the html file as the body of an outgoing email), but do not need to keep a local copy afterwards.
If Generate Table Of Contents Using H1-H6 Tags option is enabled then a table of contents will be generated using HTML heading tags (H1-H6) and inserted into the start of the document.
Enable the Print Created Document option if you want ThinkAutomation to print the PDF file after it is created. You can select the Printer to use.
You can assign the full save path & file name to a ThinkAutomation variable to use on subsequent actions (for example, if you wanted to attach the file to an outgoing message). Select from the Assign To list.
Header/Footer
You can also add Header & Footer text. The header/footer text can be plain text, HTML or Markdown. This will be rendered at the top & bottom of the page. You can also enter the Header/Footer Height in pixels. For the footer you can enable the Add Page Numbering option to add a centered Page x of y
block below the footer text.
Page Breaks
The page breaks in the generated PDF document can be controlled using the following CSS properties:
page-break-before: always style forces a page break in the PDF before the element.
page-break-after: always style forces a page break after the element.
page-break-inside: avoid style will ensure a page break does not occur inside the element if possible.
Performs a mail merge on a Microsoft Word document or Word Attachments and saves the merged document as a new file.
This action takes a Word Document and replaces all the mail-merge fields in the document with ThinkAutomation variable values. The resulting merged document is then saved.
Specify the Word File or select Merge Word Attachments and enter a File Mask to use any Word Documents attached to the message.
In the Save Merged Document To enter the new name for the merged document. You can use the special %filename% replacement to use the original file name in part of the new filename. If no name is specified then the original document will be saved.
In the Save To Path specify the folder to save the new document in.
The merged document path & filename can be assigned to a ThinkAutomation variable. Select the variable to use from the Assign Filename(s) To list.
Select Delete After Message Is Processed if you want ThinkAutomation to delete the file after it has finished executing all actions for the current message.
You must then map the Word Document Merge Fields to ThinkAutomation fields/variables. Click the Get Fields From Word Doc to extract mail merge fields from any Word Document. You can also just type them in the list.
Specify each mail Merge Field and the Value to assign the field to. This can be a fixed value or any ThinkAutomation Field, Variable or Built-in Variable.
Prints the incoming message, a report of extracted fields, document attachments or a specific file.
Enable the Print The Incoming Message option to print the incoming message.
Enable the Print Extracted Fields option to print a table showing extracted field names and values.
Enable the Print PDF Attachments option if you want ThinkAutomation to print PDF file attachments.
Enable the Print Document Attachments option if you want ThinkAutomation to print any Word, Excel, PowerPoint, HTML or Text documents.
You can also a specify Print File. This can be any PDF, Word, Excel, PowerPoint, HTML or text file or a %variable% containing a file path.
You can pre-select the printer to use from the Printer list. This can be a %variable% replacement if you need to conditionally select a printer in a previous action.
If you select a network printer the ThinkAutomation service may not have permission to print to it. This is because the ThinkAutomation service runs under the SYSTEM account by default and the SYSTEM account cannot access any network resources. Configure the ThinkAutomation Message Processor service to run under a different user.
Creates a report using a pre-defined report template. Reports can be printed, and/or exported to various formats, including PDF, HTML, Rich text and Excel. Exported reports can be attached to outgoing emails.
Enter a Report Name.
Click the Edit Report to start the Report Designer
Using The Report Designer
ThinkAutomation includes a report designer that allows you to create custom report templates. Reports can use ThinkAutomation variable data and link to external data sources.
The Extracted Fields/Variables and built-in variables will be listed in the report designer Explorer pane - Fields List. You can drag any of these onto the report designer surface.
After you have dragged a field to the designer, click it to edit its properties in the Properties Toolbox. You can change colors, alignment, borders, fonts etc. You should also re-size the field so that it will fit the data contents. (Note: If the 'Can Grow' property is set to True then the field height will grow automatically based on the field content).
You can also drag other objects onto the report (Labels, Images, Text Boxes, Charts etc). External data sources can be added using the Add Data Source button.
Click Save in the report designer to save the template.
Click Report Designer End-User Documentation to view detailed report designer documentation.
Enable the Export Report option to export the report at run time. Select the file format from the Export Format list. Available types are:
DOCX (Microsoft Word)
XLSX (Microsoft Excel)
PNG, JPEG
TXT, RTF
HTML
MHT
Use the Assign Export Filename To list to select a ThinkAutomation Variable to assign the exported file name to. You can then use this %fieldname% on other Actions - such as the Send Email action to add the exported report as an attachment.
Enable the Print option to also print the report.
Get or add/update a Contact record for an Office 365 Account.
Click the Sign In button to sign-in to Office 365.
Enter the Email Address for the Contact record. Select the Update option if you want to add/update a contact record, otherwise the contact will be retrieved using the email address specified.
In the Map To Extracted Fields grid map your ThinkAutomation variables to the Exchange Contact fields. Against each Exchange contact field select the relevant ThinkAutomation Variable.
If updating then ThinkAutomation will first lookup an existing contact using the Email Address. If an existing contact is found then the contact is updated, otherwise a new contact record is created. If not updating then ThinkAutomation will lookup the contact using the email address and then if found, assign the contact fields to the mapped ThinkAutomation variables.
Creates an appointment for an Office 365 Account.
Click the Sign In button to sign-in to Office 365.
You must then specify the Appointment Settings.
The Attendees field must use email addresses.
If %variable% replacements are used for the Start Date/Time or End Date/Time then you need to ensure that the fields contain valid dates or times.
Set flags and/or modify the subject on the incoming Office 365 source message.
This action works with the message currently being processed.
Enter a comma separated list of Categories to assign to the message. Leave blank for no change.
Set Focused - set if the message appears in the 'Focused' or 'Other' view.
Set Importance - set the Importance for the message.
Set Mark As Read - set the 'read' status for the message.
Set Follow Up Flag - set the follow up status for the message.
If Follow Up Flag is set to Flagged, enter the number of Days if you want the follow-up flag to be set for the current message. The Days entry can use %variable% replacements. It should be set to a numeric value representing the number of days from today.
Modifying The Subject
You can modify the message subject by entering a value in the Subject entry. You can use %variable% replacements, for example to append '(processed)' you would set the Subject to %Msg_Subject% (processed). If this entry is blank then the subject is not changed.
This action can only be used on Automations that are called from an Office 365 Message Source.
Get current presence information (availability and activity) for one or more users. This action reads presence information for Microsoft Teams users.
Click the Sign In button to sign-in to Office 365.
In the User Names entry enter one or more Office 365 user names that you want to read presence information for. This will usually be the user's login email address. Separate multiple users with commas or one per line. Up to 260 users can be specified per request.
Enable Return Only Presence option if you only want to return current presence, otherwise the username, displayname, current presence and current activity is returned (for each user).
Return As
The result can be returned as CSV, Markdown table or JSON.
For example:
CSV
xxxxxxxxxx
Username,DisplayName,Availability,Activity
howard@parkersoftware.com,Howard Williams,BusyIdle,Busy
benjamin.wilshaw@parkersoftware.com,Benjamin Wilshaw,Available,Available
liam.dobbs@parkersoftware.com,Liam Dobbs,Offline,Offline
Markdown
xxxxxxxxxx
+--------------------------------------------+-------------------+--------------+-----------+
| Username | Display Name | Availability | Activity |
+============================================+===================+==============+===========+
| mailto:howard@parkersoftware.com | Howard Williams | BusyIdle | Busy |
+--------------------------------------------+-------------------+--------------+-----------+
| mailto:benjamin.wilshaw@parkersoftware.com | Benjamin Wilshaw | Available | Available |
+--------------------------------------------+-------------------+--------------+-----------+
| mailto:liam.dobbs@parkersoftware.com | Liam Dobbs | Offline | Offline |
+--------------------------------------------+-------------------+--------------+-----------+
JSON
xxxxxxxxxx
[
{
"Username": "howard@parkersoftware.com",
"DisplayName": "Howard Williams",
"Availability": "BusyIdle",
"Activity": "Busy"
},
{
"Username": "benjamin.wilshaw@parkersoftware.com",
"DisplayName": "Benjamin Wilshaw",
"Availability": "Available",
"Activity": "Available"
},
{
"Username": "liam.dobbs@parkersoftware.com",
"DisplayName": "Liam Dobbs",
"Availability": "Offline",
"Activity": "Offline"
}
]
If you enable Return Only Presence and Return As CSV and get the presence for a single user then a single text value will be returned with that users current presence only.
The presence (Availability) will be one of: Available
, AvailableIdle
, Away
, BeRightBack
, Busy
, BusyIdle
, DoNotDisturb
, Offline
, PresenceUnknown
.
The Activity will be one of: Available
, Away
, BeRightBack
, Busy
, DoNotDisturb
, InACall
, InAConferenceCall
, Inactive
, InAMeeting
, Offline
, OffWork
, OutOfOffice
, PresenceUnknown
, Presenting
, UrgentInterruptionsOnly
.
Select the variable to receive the results from the Assign To list.
Sends a message to a Microsoft Teams channel on behalf of an Office 365 user.
Click the Sign In button to sign-in to Office 365. This is the user that the message will be sent from.
The Teams and Channels for the user will then be listed. Select the Team and then the Channel within the team to send a message to.
Enter the Message text.
The message text can contain Markdown. If Markdown is used it will be converted to HTML before being sent.
Saves the current message or a variable containing EML (mime) text as a Microsoft Outlook compatible MSG file to a folder on your file system.
Select the Save To folder and enter a File Name. The .msg file extension will be added automatically if not specified. If Ensure Unique File Name is enabled then ThinkAutomation will add a timestamp to the filename to ensure it is unique within the Save To folder.
Saving The Current Inc Message
From the Create Outlook MSG File Using list select Current Message. The currently executing message will then be saved as an Outlook MSG file (regardless of it's source type).
Saving EML (Mime) Text
This option will convert EML text to Outlook MSG format. From the Create Outlook MSG File Using list select Mime Text. You must then select a %variable% containing EML (mime) text created earlier.
If you want to create EML text, you can use the Send Email action to create a custom email message. Enable the Dont Send Just Assign Mime option and select a %variable% from the Assign Mime Text To list to save the mime text to. You can then use this variable on this action to create an Outlook MSG file based on the custom email.
You can assign the saved path & filename to a variable by selecting the variable from the Assign Saved File Path To list.
Perform various operations on text.
The From value can be any text or %variable% replacement or combination.
Select the Text Operation Type:
OperationType | Details |
---|---|
Trim: All Whitespace | All Whitespace (replaces all tab, CR, and LF characters, with space characters, and removes extra space's so there are no occurrences of more than one space in a row). |
Trim: Blanks | Blanks (removes all CR/LF/tab characters and trims). |
Trim: End | Trims the last Length characters. |
Trim: Start | Trims the first Length characters. |
Trim: Start & End | Trims the first and last Length characters. |
Get: Index Of | Returns the start position of Look For value in the From value (1 based). The Look for can be a regular expression or %variable% replacement. |
Get: Left | Get the last Length characters. |
Get: Right | Get the first Length characters. |
Get: SubString | Get Length characters starting at Start Position. If Start Position is not a number then the value of Start Position will be searched in the From value - and the search position will be used (if found). |
Get: Length | Returns the character length of the From value. |
Extract: JSON Path | Get a specific Json Path value from Json text specified in the From valu |
Extract: Regex | Get one or all matches of the Regex Pattern. |
Replace: Regex | Replace one or more Regex Pattern matches with a replace pattern. |
Set: Format | Returns a formatted value of the From value. The Format can be any .NET format. For example: 'The delivery date is {0:d}' would return 'The delivery date is 1/1/2021' if From contained a date value. |
Mask: Inside | Replaces Length characters starting from Start Position with * characters. |
Mask: Profanity | Replaces all profanity words with * characters. |
Mask: Credit Card Numbers | Replaces all Credit Card numbers with * characters. |
Convert: To Lower Case | Returns the From value as lower case. |
Convert: To Upper Case | Returns the From value as upper case. |
Convert: To Word Capitalized | Returns the From value as Word Capitalized. |
Convert: CamelCase To Words | Returns the From value as words extracted from Camel Case. Eg: customerName would return 'Customer Name' |
Convert: HTML To PlainText | Returns the plain text version of any HTML text. (see: HTML Parsing Notes) |
Convert: HTML To XML | Returns the well formed XML version of any HTML text. (see: HTML Parsing Notes) |
Convert: HTML To Json | Converts HTML to XML and then converts the XML to Json. (see: HTML Parsing Notes) |
Convert: HTML To Markdown | Converts HTML to Markdown. |
Convert: Markdown To HTML | Converts Markdown to HTML. |
Convert: CSV To HTML Table | Converts CSV text into a HTML table. |
Convert: CSV To Markdown Table | Converts CSV text into a Markdown table. |
Convert: CSV To Json Array | Converts CSV text into a Json array. |
Convert: Json To CSV | Converts Json/Json Array text into CSV text with headers. |
Convert: XML To Json | Converts XML text into Json. |
The 'Sub String' and 'Get Index Of' use 1 based index positions. 'Get Index Of' will return 0 if the Look For value is not found.
The Preview will show a preview of the operation. This is useful to check how the operation will work. The preview however will not show if the From text is a %variable% replacement (since the value will not be known until the Automation executes).
Select the variable to receive the result from the Assign To list.
For the Text Operation action, when converting HTML to plain text, Markdown, JSON or XML there are a number of additional options:
Suppress Links : If enabled then links will be removed before conversion.
Suppress Images : If enabled then images will be removed before conversion.
Drop Tags : You can enter a comma separated list of tags to remove from the HTML before conversion. This can be useful for removing navigation blocks and footers, if you only need the page content (eg: <nav>
and <footer>
tags). Specify tag names (without enclosing <
and >
characters, eg: nav,footer
)
Drop Tags With Class/Id Names : You can enter a comma separated list of class and/or id names. Any tags with matching class or ID names will be removed from the HTML before conversion.
For the Text Operation action, the Extract: Regex operation allows you to extract data from the From entry based on a regular expression in the Regex Pattern entry. If All Matches is enabled then all matches are returned (one per line).
For example if the From text is set to:
xxxxxxxxxx
Product Code Quantity
------------ --------
A1234 1
And the Regex Pattern is set to ''A[0-9]{4}'' - which means any text starting with 'A' followed by 4 numbers (0-9). Then the returned text would be 'A1234'.
For the Text Operation action, the Replace: Regex operation allows you to search for regular expression patterns and then perform a replacement on the matches. The replace pattern can contain substitutions.
For example if the From text is set to:
xxxxxxxxxx
Phone Number: 4075452119
And Regex Pattern is set to "(?(\d{3}))?[\s-]?(\d{3})-?(\d{4})" and the Replace With set to "($1) $2-$3". Then the returned text would be "Phone Number: (407) 545-2119".
Perform various operations on dates.
Select the Date Operation Type:
OperationType | Details |
---|---|
Get Date | Extract the date from any text or variable and return it to another variable in a predefined format. Enable the Convert To UTC option to convert the date to UTC. |
Get Time | Extract just the time from any text or variable and return it to another variable in a predefined format. |
Get Date and Time | Extract the date and time from any text or variable and return it to another variable in a predefined format. |
Get Interval | Calculates an Interval between a From and To date and returns the value to a variable. The Interval can be Seconds, Minutes, Hours, Days, Weeks, Months or Years. The interval can be returned as a number or duration text. Select from the Interval Format option. If Short Duration is selected then for interval will be returned as hh:mm:ss format. Long Duration will return as x Hours, x Minutes, x Seconds (depending on the Interval type). |
Add To | Adds an interval Value to an existing date/time extracted from any text or variable and returns the new date time to a variable in a predefined format. |
Subtract From | Subtracts an interval Value to an existing date/time extracted from any text or variable and returns the new date time to a variable in a predefined format. |
Get Date and Time From Unix Timestamp | Get the date and time from a Unix timestamp. A Unix timestamp is a number representing the number of seconds since 1st Jan 1970. |
Get Unix Timestamp From Date and Time. | Gets the Unix timestamp from a date. |
Get Year, Month, Day, Hour, Minute, Second | Get a specific date part from any date/time. |
Select the variable to receive the result from the Assign To Variable list.
When extracting and formatting dates you can select the Locale. This will default to the system locale.
Formatting
You can use this action to change the format of an existing date %variable% or extract a specific part of a datetime and assign it to a different variable. Use the Get Date and Time operation. Set the From to the variable containing the date. Enter or select the required Format. Select the same variable from the Assign To Variable list if you want to update the existing variable.
See: Custom date and time format strings | Microsoft Docs for available Format strings.
Create new folders, copy, move, rename, check exists, delete files and get file information.
Use this Action to create new folders or to copy, move, check if files exists, rename & delete files and get file information. You can also use this action to generate an SHA256 hash (checksum) for any file.
Select the Operation Type:
Create Folder
Copy File
Move File
Delete File
Rename File
Check If File/Folder Exists
Get SHA256 Hash For File
Get File Size
Get File Date
Get File Version
Read File To Base64 String
Write Binary File From Base64 String
Append To Filename
Prefix Filename
Get Folder Contents
Depending on the Operation Type enter the Folder, File Name, To Folder & To File Name.
You can assign the result to a variable. Select from the Assign To Variable list. The variable will be set to the new folder and file name depending on the Operation Type. For example, for the Create Folder operation the variable will be assigned to the new folder name. For the Copy operation the variable will be assigned the full path & file name of the new file. If the operation fails the variable will be assigned a blank string and the error will be shown in the log. The Check If File/Folder Exists operation will return the file/folder path is the file/folder exists, otherwise blank.
The Append To Filename and Prefix Filename operations allow you to append text or prefix text to existing file names. For example: If the Append Text is set to 'abc' and the processed filename was 'order.pdf' then the existing file will be renamed to 'orderabc.pdf'.
The Copy, Move, Delete, Append To Filename & Prefix Filename operations allow the File Name to contain wildcards. If using wildcards enable the Match Files Using Wildcards option. The File Name can contain * and ? wildcard characters. When using wildcards, if multiple files are processed then the Assign To Variable will contain a list of files processed separated by commas.
For the Copy operation you can specify the To File Name (when not using wildcards). You can specify a different destination file name. If this entry is blank the original file name will be used.
For the Copy operation you can enable the Overwrite Existing option if you want existing files in the destination folder to be overwritten. If this option is not enabled and an existing file already exists then an error will raised.
The Get File Version operation returns file information in the following format:
xxxxxxxxxx
File: D:\ThinkAutomation\Setup Files\ThinkAutomation.exe
InternalName: ThinkAutomation
OriginalFilename: ThinkAutomation.exe
FileVersion: 5.0.240.2
FileDescription: ThinkAutomation Installer
Product: ThinkAutomation
ProductVersion: 5.0.240.2
Debug: True
Patched: False
PreRelease: False
PrivateBuild: False
SpecialBuild: False
Language: English (United Kingdom)
For the Create Folder operation the complete folder structure will be created if any levels do not exist. If the full folder already exists the Assign to variable will be assigned the existing folder name and no error will be reported. An error will only be reported for the Create Folder operation if the creation of a new folder fails.
The Get Folder Contents operation returns a list of files in the specified Folder and Mask. The list will be assigned to the Assign To variable with each file separated by a comma. The full path and filenames are returned. You can use the For Each.. Comma Separated Value In action to loop through the list of files.
If you are access folder/files on your network you will need to change the user name that the ThinkAutomation Message Processor Service runs under.
Create and update a list. This action enables you to create a generic list of values. You can then add to the list, delete, sort & search. You can then read single values or all values further in your Automation. Any number of separate lists can be created - with each list referenced by its name.
Each list must be given a Name. You cannot use the name of an existing %variable% as a list name. If you want to update the same list further in your Automation you would use the same name. Lists can contain any number of items (based on available memory).
Select the List Operation:
Create
Create a new list. A list must be created before any other operations can be used. If you re-create an existing list all existing items will be removed.
Specify the Of Type - this can be text, number or date. The Of Type setting determines how the list is sorted if you use the Sort operation.
Enable the Unique option to only allow unique values to be added to the list. If Unique is enabled then duplicate values cannot be added (an error will not be raised when duplicate values are added).
You can optionally initialize the created list with one or more Values. Values can contain %variables%.
You can also optionally add values contained in the Load From entry. A value will be added for each line contained in the %variable% specified.
Append
Append one or more values to the end of an existing list. Enter one or more Values to append. Values can contain %variables%.
Insert
Insert one or more values to an existing list. Specify the Index position where you want the values to be inserted. Index positions start at 1. If no index value is specified then the values will be inserted at the start of the list. The Index value can be a %variable%.
Delete
Delete a value at the specified Index position (starting at 1).
Get Value
Get a value at the specified Index position (starting at 1). The item value can be assigned to a %variable% from the Assign To list.
Get All Values
Get all values in the list and assign to the Assign To variable. The Return As defines how the list will be returned to the Assign To variable:
Text : The list is returned as text with each value on a separate line.
Json Array : The list is returned as a Json array.
Markdown Table : The list is returned as a Markdown table.
CSV : The list is returned as a CSV line with values separated by commas and quoted if required.
HTML List : The list will be returned as a HTML unordered or ordered list.
Sort Ascending
Sort the list in ascending order.
Sort Descending
Sort the list in descending order.
Search For
Searches the list for a matching value (case insensitive) and assigns the index number to the Assign To variable (or blank if no match was found). Enter the value to search in the Search For entry.
Individual list values can be any text of any size. If the Of Type is set to number then the expected values should be numeric. If the Of Type is set to Date then the values should be dates or date+time. The date values are stored in yyyy-mm-dd hh:mm:ss format so they can be sorted.
The List Operation action has many uses. It can be used to create Json arrays. Where you add separate Json blocks or values to a list and then use the Get All operation with the Return As set to Json Array.
You can use the For Each action to loop through values in a list.
You can use a list name as a %variable% replacement. This will replace the %listname% with all values in the list (one per line).
Executes mathematical formulas and returns the result to a variable.
Enter the Formula text. The formula can contain %variable% replacements.
Select the variable to receive the result from the Assign To list.
Formulas can be as simple as %Price% * %Amount%
which would return the value held in %Price% multiplied by the value held in %Amount%.
Click the Validate button to check the formula.
The following mathematical operations are supported:
Addition: +
Subtraction: -
Multiplication: *
Division: /
Modulo: %
Exponentiation: ^
Negation: !
Standard Functions:
Function | Arguments | Description |
---|---|---|
sum | sum(A1, ..., An) | Total |
roundup | roundup(A1,Digits) | Rounds up decimal to specified digits |
sin | sin(A1) | Sine |
cos | cos(A1) | Cosine |
asin | asin(A1) | Arcsine |
acos | acos(A1) | Arccosine |
tan | tan(A1) | Tangent |
cot | cot(A1) | Cotangent |
atan | atan(A1) | Arctangent |
acot | acot(A1) | Arccotangent |
loge | loge(A1) | Natural Logarithm |
log10 | log10(A1) | Common Logarithm |
logn | logn(A1, A2) | Logarithm |
sqrt | sqrt(A1) | Square Root |
if | if(A1, A2, A3) | If Function |
max | max(A1, ..., An) | Maximum |
min | min(A1, ..., An) | Minimum |
avg | avg(A1, ..., An) | Average |
median | median(A1, ..., An) | Median |
round | round(A1) | Round |
random | random() | Random |
For more complex calculations you can use the Create Spreadsheet action. The Create Spreadsheet action allows you to assign %variables% to cells and then read-back cell values to %variables% after all formulas have been re-calculated.
Encrypts or Decrypts text or files using AES encryption and returns the encrypted/decrypted text/filename to a variable.
This action is used both to encrypt and decrypt text or files. Select the Encrypt or Decrypt options.
Encrypting
To encrypt text select the Encrypt option and enter the text or file to encrypt.
When encrypting text you must specify the Encoding method to use. This can be hex, base64 or URL. The default is base64.
To encrypt a file select the Encrypt File tab and select the File Path & File Name. Select the Save To Path to save the encrypted file to. Optionally enter a Save To Filename. If no filename is specified then the original file name will be used but with an '.aes' extension. You can use %variable% replacements for the file path & names - this enables you to use it with the For..Each action if you wanted to encrypt attachments.
You must specify a Key Length and Secret Key. The key length can be 256, 192 or 128. These are bit sizes. The secret key length must be 32 characters for 256 bit keys, 24 characters for 192 bit keys or 16 characters for 128 bit keys. You can use %variable% replacements for the secret key - however this must convert to the correct key length when the message is processed.
The encrypted text/file path can be returned to a variable. Select from the Assign Encrypted File To list.
Decrypting
To decrypt text select the Decrypt option and enter the text or file to decrypt. The text must be encoded using the same encoding method used to encrypt (base64, hex or URL). You must also specify the Encoding method.
To decrypt a file select the Decrypt File tab and select the File Path & File Name. Select the Save To Folder to save the decrypted file to and enter the Save To File Name.
You must specify a Key Length and Secret Key. The key length can be 256, 192 or 128. These are bit sizes. The secret key length must be 32 characters for 256 bit keys, 24 characters for 192 bit keys or 16 characters for 128 bit keys. You can use %variable% replacements for the secret key - however this must convert to the correct key length when the message is processed.
The decrypted text/file path can be returned to a variable. Select from the Assign Decrypted File To list.
Creates Zip compatible compressed archive files for attachments or files/folders. Can also be used to unzip files.
This action is used both to zip and unzip files.
Compressing Files/Attachments
To create a Zip file select Compress.
Select the Zip File Path to save the Zip file to and enter the Zip File Name. You can use %variable% replacements here. If a %variable% replacement is used for the Zip File Name (for example %msg_subject%) it will first be converted into a valid file name. If no extension exists then .zip will be used.
Enable Create New if you want a new zip file creating. If this option is not selected and an existing Zip file already exists then the new files will be added to it.
Optionally specify a Password if you want to password protect the Zip file.
Enable the Zip Attachments option if you want to compress files attached to the incoming message. You can specify a File Mask if you want to only compress files of a certain type (eg: *.pdf).
Select the local Folder and File Mask for other files you want to add to the Zip file.
The File Mask entry can contain multiple masks, separated by commas (eg: *.pdf, ThisDoc.docx, *.xlsx).
The Exclusions entry can contain filenames and masks that you want to exclude from the zip file. Separate multiple with commas.
Enable the Delete Zip After Message Is Processed option if you want ThinkAutomation to delete the Zip file after the Automation has finished executing actions for the current message. This is useful if you are creating a Zip file to send with an outgoing message and the Zip file is not needed to be kept afterward's.
Select the variable that you want the Zip file path to be assigned to from the Assign To list. You can then use this on further actions - for example on the Attach entry of outgoing messages.
Decompressing
To unzip and existing Zip file select Decompress.
Select the Zip File Path and Zip File Name.
Specify a Password if the Zip file is password protected.
Enter a File Mask for the files you want unzipped - or specify *.* for all files.
The Exclusions entry can contain filenames and masks that you want to exclude from being unzipped. Separate multiple with commas.
Select the Unzip To Folder for the folder where you want the unzipped files placed.
Enable the Delete Unzipped Files After Message Is Processed option if you want ThinkAutomation to delete the unzipped files after the Automation has finished processing actions for the current message.
The unzipped files list can be returned to a variable. Select the variable from the Assign Unzipped Files To list. This will be a comma separated list of files with their full path.
Generate a hash for any text/variable.
Enter the Text To Hash and specify the Hash Algorithm.
The resulting hash can be encoded in various formats (the default is Base64).
Select the variable to assign the hash to from the Assign Hash To list.
Assigns a Flag to the current message.
ThinkAutomation stores a copy of each processed message in the Message Store. You can assign a Flag number to the message stored in the Message Store. When viewing the Message Store you can filter by Flag.
In the Set Incoming Message Flag Number To entry, enter the flag number to assign to the current message. You can use a %variable% replacement to conditionally set a flag value based on previous actions.
You can setup any number of Flag values using the Server Settings - Message Store Flags option.
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:
This operation returns the conversation for the currently executing message.
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:
xxxxxxxxxx
{
"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:
xxxxxxxxxx
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:
xxxxxxxxxx
<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.
This operation will flag the currently executing message to be deleted from the message store database after the Automation completes.
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.
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.
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.
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).
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 Or Attachment Names Containing - specify a value to search against subject, from/to addresses or attachment names (leave blank for all). You can use 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, from/to. You can also search these individ
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).
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:
xxxxxxxxxx
{
"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:
xxxxxxxxxx
Id,From,To,Dated,Importance,Subject,Size,Attachments,ReturnValue,Url
HTML Table: HTML text in the following format:
xxxxxxxxxx
<table id='taMessages'>
<thead>
<tr>
<th id='taMC1'>View</th>
<th id='taMC2'>📎</th> <!--attachment icon-->
<th id='taMC3'>From</th>
<th id='taMC4'>To</th>
<th id='taMC5'>Date</th>
<th id='taMC6'>❗</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>📎</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).
Set the logging detail level for the current message.
This action can be used to change the level of logging for the currently executing message. This is useful if you have many actions, or actions that loop and you want to reduce the number of log entries to improve performance. Setting the logging level to 'Minimal' will cause only errors to be logged.
Any Comment actions that have the Show In Log option enabled will always be logged, regardless of the current logging level.
For fast running Automations, or Automations that generate many log entries, you should use the Set Logging Level action to set the logging level to 'minimal' once you have completed debugging your Automation. This will significantly increase performance.
It can also be used to increase the logging level whilst debugging a specific Automation.
You can change the logging level multiple times during an Automation.
The logging level will revert back to the default once the Automation has completed executing actions for the current message.
You can set the default logging level for all Automations using the Server Settings - Logging option.
Creates a random Passcode and assigns the value to a variable.
This action can be used to generate a random passcode. The passcode can then be sent by email (via the Wait For User Response or Send Email actions) or by SMS (via the Twilio Send SMS Message and Twilio Wait For SMS Reply actions) in order to implement two-factor authentication or to check that a given email address or mobile phone number is valid.
Select the Passcode Type. This can be:
Letters (a-z)
Letters & Numbers (a-z,0-9)
Letters, Numbers & Special Characters (a-z,0-9, ~!@#$%^&*_-+=|(){}[]:;<>?/)
Numbers Only (0-9)
Random Word and Numbers
Two Random Words and Numbers
Enable Include Upper Case to also include (A-Z) characters if Numbers only is not used.
Enter the Number Of Characters. This can be between 3 & 99.
Select the variable to assign the passcode to from the Assign To list.
The Passcode generated will be random containing no repeating characters. The Passcode is not guaranteed to be universally unique.
For the Random Word and Two Random Words options the passcode will consist of one or two random words (English) followed by numbers (based on the Number Of Characters entry). For example: 'Glove2085' - if the number of characters was set to 4. If the Include Upper Case option is enabled then the first character of the random word will be in upper case.
Finds and replaces text in any ThinkAutomation variable and returns the result to the same or different variable.
Enter the text to find in the Replace entry. You can make use of %variable% replacements.
Enter the text to replace with in the With entry. Again you can use %variable% replacements. Note: The With value can be blank if you wish to just remove the Replace value.
In the In list - select the field to use for the replacement. This can be any of your extracted fields/variables.
By default the text search will start at the beginning of the text. Enter a Start At Character value if you want to start the search from a specific character position.
Enable Replace All Occurrences if you want all occurrences of the Replace text to be replaced.
Enable Case Sensitive Search if the find should be case sensitive.
You must then select variable to assign the replaced text to from the Assign Result To list. By default the same variable that you select in the In selection will be used.
You can also perform regular expression replacements using the Text Operation action.
Saves data to any text file and/or reads the contents of the file into a variable. This action can be used to save text or %variables% to a text file, or read the contents of a text file and assign the contents to a %variable%.
The File Path must contain a path & filename of the text file to write to/read from.
Writing
On the Write To File tab you can define the text that you want to write to the file. The file will be created if it does not already exist. All directories contained in the path will be created if they do not exist.
Select the file Format. This can be ASCII, Unicode or UTF-8 (default).
Select the Line Terminator that will be appended to the text written to the file.
Enter the Content that you want to write to the file. This can contain %variable% replacements.
If the Append To File option is enabled then the new text will be added to the end of any existing text file.
If the Make Backup option is enabled the existing file will be copied to the same file name with a .BAK file first.
On the Read From File tab you can select a ThinkAutomation variable that you want to assign the text file contents to. The file will be read again after any text is written to it.
Reading Only
Select the Read From File tab and then select the %variable% to assign the text file contents to.
If nothing is specified in the Content entry then the file is only read.
Gets a list of comma separated tokens (words) for any text.
Enter the Text/HTML to tokenize. If the text is HTML then the HTML will be converted to plain text first.
Options:
Remove Common Words : Remove all common words (and, the, a etc.) from the tokens list.
Remove Email Addresses & Urls : Removes any email addresses and URLs from the tokens list.
Include Numeric Tokens : Include tokens containing numbers and dates in the tokens list.
Normalize : Normalizes common contractions (eg: 'what's' to 'what is') and common abbreviations (eg: hi to hello, nov to november, ur to your, bday to birthday, 2day to today, plz to please, thx to thanks etc.)
Stem Words : Reduces words to their root form (English only). For example: the words 'ask','asking' and 'asked' would all stem to 'ask'.
Unique : Duplicates are removed from the tokens list.
Include Count : The frequency is appended to each token (if unique enabled).
Sort By : None, frequency, word (if unique enabled).
Top : Return the top x words if sorted (if unique enabled).
The tokens can be assigned to a variable. Tokens are returned as a comma separated string.
Parses a postal address block and extracts specific parts (Company Name, Address Line 1, Address Line2, State, Zip/Postcode, Country).
In the Extract Address From enter the address or a %variable% containing an address.
You can then assign Company Name, Address Line 1, Address Line 2, State, Zip/Postcode and Country to variables.
You can also assign the normalized address block to a variable from the Assign Address To list. The normalized address will include above parts, one per line. US state abbreviations will be expanded.
This action will attempt to locate the country/state using the zip/postcode if no state/country is specified in the incoming address. This currently supports UK, USA, Canada & Ireland postcodes.
Postcodes for European countries (France, Germany, Spain, Italy, Netherlands) will be extracted if the address contains the country name.
This action is useful where an address block has been extracted from a document using the Extract Field action with the Extract Using Text Range option.
You can test the address extraction by pasting an address into the Extract Address From entry and clicking the Test button.
Parses contact and company information from email signature footers.
ThinkAutomation will parse the email text and extract the footer block. From this it attempts to extract the following:
Name
Known As
Title
Company Name
Address
Company Number
VAT Number
Phone
Mobile Phone
Other Phone Numbers
Web Address
Unsubscribe Link
Privacy Policy Link
Social Links
Other Links
Footer Text
Pre-Signature Text (the body text before the signature part)
In the Assign Signature Info grid, select the Property name and the variable you want to assign the value to.
The complete signature block Json can also be assigned. Select from the Assign Json To list.
For example, consider the following email text:
xxxxxxxxxx
Hi,
Please find attached the report you requested.
Kind regards,
Clare
Senior Accountant
p: +44 (0)330 0882 943 | US (800) 680 7712
e: clare.rowley@parkersoftware.com
w: https://www.parkersoftware.com
https://www.whoson.com
https://www.thinkautomation.com
This email is from Parker Software Ltd.
Victoria Business Park, Prospect Way, Knypersley, Staffordshire, ST8 7PL.
Registered in England & Wales No. 4525820.
The email signature would be extracted as:
xxxxxxxxxx
{
"FirstName": "Clare",
"LastName": "",
"Name": "Clare",
"KnownAs": "",
"Title": "Senior Accountant",
"Company": "Parker Software Ltd",
"Address": [
"Victoria Business Park",
"Prospect Way",
"Knypersley",
"Staffordshire"
],
"State": "England",
"StateCode": "",
"PostCode": "ST8 7PL",
"Country": "United Kingdom",
"CompanyNumber": "4525820",
"VatNumber": "",
"EmailFrom": "stephen@parkersoft.co.uk",
"Email": "clare.rowley@parkersoftware.com",
"Phone": "+44 0 330 0882 943",
"MobilePhone": "",
"OtherPhoneNumbers": [
"800 680 7712"
],
"WebAddress": "https://www.parkersoftware.com",
"UnsubscribeLink": "",
"PrivacyPolicyLink": "",
"GoogleMapsLink": "",
"SocialLinks": null,
"OtherLinks": [
"https://www.parkersoftware.com",
"https://www.whoson.com",
"https://www.thinkautomation.com"
],
"Text": "Clare\r\nSenior Accountant\r\np: +44 (0)330 0882 943 | US (800) 680 7712\r\ne: clare.rowley@parkersoftware.com\r\nw: https://www.parkersoftware.com\r\nhttps://www.whoson.com\r\nhttps://www.thinkautomation.com\r\nThis email is from Parker Software Ltd.\r\nVictoria Business Park, Prospect Way, Knypersley, Staffordshire, ST8 7PL.\r\nRegistered in England and Wales No. 4525820.\r\n",
"PreSignatureText": "Hi,\r\n\r\nPlease find attached the report you requested.\r\n\r\nKind regards,\r\nClare \r\n"
}
The above Json can also be referenced directly using the %Msg_SignatureJson% built-in variable without using this action.
The amount of information extracted will depend on the email footer (if any). This action can be used on any type of email, however the accuracy will be better for non-marketing type emails. Currently only English text is supported.
Uses the Windows speech synthesizer to convert text to a WAV file containing a spoken version of the text.
Enter the Text To Speak. This can contain %variable% replacements.
Select the Voice. This list will be populated by Speech language packs installed on your system. You can install more language packs in your Windows settings. After selecting a Voice, click the Test button to hear how the text will sound.
Select or enter the Save To path where the created wav file should be saved.
Enter the WAV File Name. This can contain %variable% replacements. The .wav extension will be added if necessary.
If the Ensure Unique File Name option is selected then ThinkAutomation will append a unique timestamp to the filename to ensure it is unique within the Save To path.
If Delete File After Message Is Processed is enabled then ThinkAutomation will remove the file when the Automation completes for the current message. This is useful if you wish to use the wav file in the Automation (for example, to send the file as an attachment with the Send Email action), but do not need to keep a local copy afterwards.
You can assign the saved path & filename to a variable by selecting the variable from the Assign Saved File Path To list. You can then use this variable in the Attachments entry on Send Email actions or in any other way.
Performs a DNS Lookup and assigns the returned data to a variable.
In the Lookup entry enter an IP Address or Hostname. If an email address is used ThinkAutomation will automatically use the domain part (the section after the @ sign).
Select the DNS Record Type to lookup. Here you can select any valid DNS type.
The DNS Server entry allows you to specify a specific DNS server IP address to use for the lookup. Leave blank to use the system default.
You must then select the variable to assign the result to by selecting from the Assign Result To list. If the lookup fails - the variable will be set to Error: {description}.
Results will be returned as FieldName: Value format. The fields returned depend on the DNS Record Type.
For example, an MX lookup of test@google.com would return:
xxxxxxxxxx
PREFERENCE: 50
EXCHANGE: alt4.aspmx.l.google.com
If the lookup fails an error is returned:
xxxxxxxxxx
Error: 3 Name error
This Action is useful for validating email addresses. If an error is not returned then the email address has a valid MX record.
Pings any network/internet host and assigns the response time to a variable.
Enter the Ping host. This can be an IP address, Host Name, Domain name, URL or Email Address. The host name will first be resolved to its IP address before the Ping starts.
Select the variable that the Response Time will be assigned to. You can also assign the Response Host (IP Address).
If the Ping fails or a timeout occurs the Response Time will be blank and an error will show in the log.
Executes a command on a remote SSH Server. Most UNIX/Linux/Mac machines include an SSH Server. The output of the command can be returned to a variable.
Enter the Host Name IP Address or host name of the server you want to execute the command on.
Enter the Port. This defaults to 22. If no port is specified then the default will be used.
Enter the remote User Name & Password. This user must be allowed to execute remote commands on the host system.
Enter the Command Text to execute.
All entries can use %variable% replacements.
The result of the command can be returned to a variable. Specify the variable from the Assign Response To list.
Any errors generated by the command can also be returned to a variable. Select from the Assign Errors To list.
Showing A Notification On A Mac
The following command will display a notification on a Mac computer:
xxxxxxxxxx
osascript -e 'display notification "Processed Message %msg_subject%" with title "ThinkAutomation" subtitle "%AccountName%" sound name "Default" '
Speaking Text On A Mac
The following command will speak the given text on a Mac computer:
xxxxxxxxxx
say "you have received a new message from Think Automation!"
To enable the Remote SSH server on a Mac, use System Preferences - Sharing. Enable the 'Remote Login' option.
ThinkAutomation can read and update entities in the following CRM systems: Microsoft Dynamics (Online), Salesforce, Zoho CRM & Sugar CRM. See: CRM Connection Notes for specific CRM connection details.
Performs a query against a CRM system to lookup a single entity and assign entity values to variables.
Click Connect to connect to a CRM system. Currently ThinkAutomation can connect to:
Microsoft Dynamics CRM (Online)
Salesforce
Sugar CRM
Zoho CRM
See: CRM Connection Notes for specific CRM connection details.
Once connected select the Entity Type to query.
You then create Query Conditions to lookup an entity of the Entity Type specified. The query can contain %variable% replacements. You can create multiple query conditions, for example: FirstName Equal To %Name% AND Email Contains %Company%.
The query will return the first record that matches the query conditions.
In the Assign Returned Entity Values To Variables list, select each CRM entity value that you want to assign to a ThinkAutomation Variable. If the query returns no entity then the selected ThinkAutomation variables will be set to blank values.
Creates or updates entities in a CRM system,
Click Connect to connect to a CRM system. Currently ThinkAutomation can connect to:
Microsoft Dynamics CRM (Online)
Salesforce
Sugar CRM
Zoho CRM
See: CRM Connection Notes for specific CRM connection details.
Select Create New Entity, Update Existing Entity or Delete Existing Entity from the Action To Take selector.
Select the Entity Type to update.
When updating or deleting existing entities, you must specify the Entity ID To Update - this can be a ThinkAutomation variable that has received an Id from a previous Get CRM Entity action.
In the Update Entity Fields grid you map Entity fields to ThinkAutomation variables. Each field for the selected Entity Type will be listed. In the Set Value To column enter a value or select a ThinkAutomation variable to assign to the field. ThinkAutomation will automatically convert the value to the correct data type when updating your CRM. If the Entity field has a maximum length then the value will be truncated if required. The Required column shows if the Entity Field is marked as a required field in the CRM system. You should ensure that required fields are assigned a value to prevent updates from being rejected.
The updated entity Id can be returned to a ThinkAutomation variable. Select from the Assign Entity ID To list. When creating a new entity, the new id will be returned. When updating or deleting an existing entity, the same id passed with the Entity ID To Update entry will be returned - or blank if the existing entity could not be found.
Perform a generic query to read one or more CRM entities as Json text, CSV or Markdown.
Click Connect to connect to a CRM system. Currently ThinkAutomation can connect to:
Microsoft Dynamics CRM (Online)
Salesforce
Sugar CRM
Zoho CRM
See: CRM Connection Notes for specific CRM connection details.
Select the Entity Type to query from the SELECT FROM list.
You can then select one or more columns to return from the Columns list or leave blank to select all columns.
You then create a WHERE clause to lookup entities of the Entity Type specified. The query can use %variable% replacements. You can create multiple query conditions, for example: FirstName Equal To %Name% AND Email Contains %Company%.
The query will return all records that match the query conditions - up to the Limit value.
In the ORDER BY list you can optionally select one or more columns to order the results by.
The results can be returned as either a Json Array text, CSV text or Markdown table text. Select the type from the Return As list.
Select the variable to receive the results from the Assign To list.
You can also optionally assign the number of records returned from the Assign Count To list.
For example:
Using Salesforce, entity type Contact, we could select the columns: FirstName, Email, LastName, & Title. With a WHERE clause of Email Contains 'test' and a Limit of 2 records. The json returned would be:
xxxxxxxxxx
{
"Contact": [
{
"FirstName": "Howard",
"Email": "test@mycompamy.com",
"LastName": "Williams",
"Title": "Director"
},
{
"FirstName": "Joe",
"Email": "joe@testemail.com",
"LastName": "Bloggs",
"Title": null
}
]
}
If the Return As was set to CSV then the returned text would be:
xxxxxxxxxx
Howard,test@mycompany.com,Williams,Director
Joe,joe@testemail.com,Bloggs,,
You can use the CSV option with the For..Each line action - to loop through each CSV line, along with the Parse CSV Line action to get specific values (for example, to read a CRM for Contact records and send an email to each email address returned).
For CSV you also have the option to Include CSV Headers Line. If this is enabled then the returned CSV text will contain the field name headers line.
The the Return As was set to Markdown then a Markdown table will be returned. You can use the Set action to convert this markdown to html if required.
If no records are returned the Assign To variable will be set to blank text.
Xero is a cloud based accounting system. See: https://www.xero.com
Get, update or create Xero contact records and add notes or attachments to existing contacts.
Click the Sign In button to sign-in to your Xero account. Select the Xero Company to use from your available companies.
Select the Operation to perform:
Get Contact
From the Where - Field select to lookup a contact by either: Name, ContactID, EmailAddress or AccountNumber. Enter the lookup value. The lookup value can contain %variable% replacements.
In the Assign Fields grid you can map Xero contact fields to ThinkAutomation variables. Select a Contact Field and corresponding ThinkAutomation variable from the Assign To drop down.
Click the Test button to perform a test lookup.
You can also optionally return the full Xero contact record in Json format to a variable. Select from the Assign Contact Json to list.
You can assign the Xero Contact ID to a variable. Select from the Assign Contact ID To list.
If a contact is not found then the ThinkAutomation variables will be set to blank values.
Create Contact
In the Assign Fields grid, select each Xero contact field to assign a value to. In the Assign From column enter a value to assign to the contact field or select a ThinkAutomation variable.
The Name Contact Field is required when creating new contacts.
You can also optionally return the full Xero new contact record in Json format to a variable. Select from the Assign Contact Json to list.
You can assign the new Xero Contact ID to a variable. Select from the Assign Contact ID To list.
Update Contact
From the Where - Field select to lookup a contact by either: Name, ContactID, EmailAddress or AccountNumber. Enter the lookup value. The lookup value can contain %variable% replacements.
In the Assign Fields grid, select each Xero contact field to assign a value to. In the Assign From column enter a value to assign to the contact field or select a ThinkAutomation variable.
When updating a contact - you only need to select the Xero contact fields that you want to change.
Add Note
This operation adds a new text note to an existing Xero contact.
From the Where - Field select to lookup a contact by either: Name, ContactID, EmailAddress or AccountNumber. Enter the lookup value. The lookup value can contain %variable% replacements.
Enter the Note text. This can contain %variable% replacements. Xero allows notes of up to 250 characters. The text will be truncated if longer.
Add Attachment
This operation uploads a file which is added as an attachment to a Xero contact. Xero allows up to 10 attachments per contact. Attachments must be less than 3mb each.
From the Where - Field select to lookup a contact by either: Name, ContactID, EmailAddress or AccountNumber. Enter the lookup value. The lookup value can contain %variable% replacements.
In the File To Upload entry, select or enter the full path for the file to upload. You can use %variable% replacements here if you want to upload a file created from another action.
If the file name already exists for a contact it will be overwritten.
You can return the Xero URL to the file. Select from the Assign URL To list.
More Xero actions are available from the Custom Action Library.
Reads a http resource using HTTP GET or a local file path and assigns the returned HTML to a variable.
Use this Action to read any http resource (web page) or a local html file. Specify the URL Or File Path To Get (including any query string).
If the web resource requires authentication then specify the Authentication method and optionally a User Name/Password or an OAuth Auth Token retrieved from a previous OAuth SignIn action. Does not apply if reading from a local file path. You can also use Amazon AWS Signed Request authentication for signing AWS requests.
Optionally specify any Query String Parameters and Custom Headers to add to the request. Query string parameters can either be specified in the URL itself or in the Query String Parameters grid. If you specify query string parameters in the grid any %variable% replacements will be automatically URL encoded.
You can also optionally specify to Add To Local Cache. If this option is enabled, ThinkAutomation will maintain a local cached copy of the content. You can specify the number of Minutes the content should remain cached. If the same URL is requested again within this period it will be read from the cache.
You can specify the Connection Timeout (in seconds). This is the number of seconds to wait for the initial connection. The Response Timeout is the number of seconds to wait for a response after the connection has been made.
The Convert Returned Content To option enables you to convert the http response content. Options are:
Nothing : The response is returned as is.
Convert HTML To Plain Text : Removes all HTML tags and returns only readable text.
Convert HTML To Markdown : Converts the HTML to Markdown text. Images will be removed. The tags <nav>
and <footer>
will also be removed before conversion. If you need finer control over HTML to Markdown conversion, leave the HTML as is and use the Text Operation action.
Convert HTML To XML : Converts the HTML to well-formed XML allowing easier parsing.
Convert HTML To XML (Drop Formatting) : Converts the HTML to XML and drops all formatting tags, styles, images, scripts etc. This allows easier parsing of specific text elements. See: HTML To XML.
Convert HTML To Json (Drop Formatting) : Converts HTML To Json and drops all formatting tags, styles, images, scripts etc. This allows easier parsing of specific text elements. See: HTML To Json.
Convert XML To Json : Converts XML to Json. Useful if the HTTP response is XML format and you need to work with Json.
Convert CSS To Inline Styles : Moves all CSS styles sheets to inline style attributes. This enables the HTML to be sent via email as most email clients only support inline styles.
Convert Relative Links To Absolute Links : Converts all relative links to absolute links. For example, if requesting a URL from http://www.mysite.com:
<img src="image.png">
becomes <img src="http://www.mysite.com/image.png">
Convert CSS To Inline And Relative Links To Absolute : Performs both above operations.
The returned content can then be assigned to a variable. Select from the Assign Content To list. You can then make use of the returned content in subsequent Actions.
You can optionally assign any HTML <title>
tag to a variable. Select from the Assign Title To list. If the returned content is not HTML or has no <title>
tag the variable will be set to blank.
You can optionally assign any <meta description='xxx'>
description tag to a variable. Select from the Assign Description To list. If the returned content is not HTML or has no description tag then the variable will be set to blank.
Response Status
The HTTP response status code & response headers can also optionally be assigned to variables.
The status code will be the HTTP response status (200, 404 etc). A status code of <100 indicates a connection error (eg: 2 = 'DNS lookup failed', 3 = 'DNS lookup timeout', 6 = 'Connect timeout'). The error details will be added to the log.
If the Throw Error On HTTP Errors option is enabled then the Automation will log an error if the HTTP status is an error status (404, 500 etc). If this option is not enabled then an error will not be raised (the status will still be logged). This is useful if the purpose of your Automation is to check for HTTP errors. Note: Connection errors will always throw an error.
Post data to a web resource using HTTP POST/PUT/PATCH or DELETE.
Specify the Post To URL of the http resource to post to.
Note: If you use %variable% replacements inside the URL - the variable values must be URL Encoded.
If the web resource requires authentication then specify the Authentication method and optionally a User Name/Password or an OAuth Auth Token retrieved from a previous OAuth SignIn action.
Select the Post Type you wish to perform. This can be:
Regular POST - for posting form field values.
Json POST - for posting Json data.
Json PUT - for posting Json data using a HTTP PUT instead of POST.
Json PATCH - for posting Json patch data.
Custom - for performing custom HTTP Posts using data you specify.
Stream Binary File - for binary POST/PUT of files.
HTTP DELETE - for sending delete requests.
For regular Posts you can specify any number of Names and Values. The Values can be fixed or %fieldname% replacements or combinations of both. You can also specify a Type of Text (the default) or File (see Uploading Files below).
For JSON POST or PUT you must specify the JSON Text.
For Custom Posts you must specify the Custom data. This would be the body of the postdata - not the headers.
For all post types you can specify any Query String Parameters. These can either be specified in the URL itself or in the Query String Parameters grid. If you specify query string parameters in the grid any %variable% replacements will be automatically URL encoded.
For all post types you can specify any Custom Headers. Multiple header names & value pairs can be specified. Any existing HTTP headers will be replaced if you use a standard header.
You can specify the Connection Timeout (in seconds). This is the number of seconds to wait for the initial connection. The Response Timeout is the number of seconds to wait for a response after the post has been made.
The HTTP response status code, response headers & response body can also optionally be assigned to variables.
Uploading Files
You can upload files in two ways. Using the Regular Post option, or the Stream Binary File option. The choice will depend on the end point you are posting to.
Using the Regular Post option you can specify the Type as File against a specific form Post Value. The Value should then be a local file path (or a %variable% pointing to a file path). If the Name is not specified then the file name will be used. Adding files to a regular post will result in a POST content-type of 'multipart/form-data'.
Using the Stream Binary File option you specify a File Path. The file content will be posted and the content-type will be set based on the file extension.
Response Status
The HTTP response status code & response headers can also optionally be assigned to variables.
The status code will be the HTTP response status (200, 404 etc). A status code of <100 indicates a connection error (eg: 2 = 'DNS lookup failed', 3 = 'DNS lookup timeout', 6 = 'Connect timeout'). The error details will be added to the log.
If the Throw Error On HTTP Errors option is enabled then the Automation will log an error if the HTTP status is an error status (404, 500 etc). If this option is not enabled then an error will not be raised (the status will still be logged). This is useful if the purpose of your Automation is to check for HTTP errors. Note: Connection errors will always throw an error.
Download a file via HTTP from any URL.
Enter the URL To Download. This can be any HTTP or HTTPS URL that points to a downloadable file.
If the web resource requires authentication then specify the Authentication method and optionally a User Name/Password or an OAuth Auth Token retrieved from a previous OAuth SignIn action.
Optionally specify any Query String Parameters and Custom Headers to add to the request.
You can specify the Connection Timeout (in seconds). This is the number of seconds to wait for the initial connection. The Response Timeout is the number of seconds to wait for the file to be downloaded after the connection has been made.
Enter or select the Save To Folder. This is the folder on your file system that you want the downloaded file to be saved in.
Optionally enter a Use Filename. If no filename is specified then the filename will be extracted from the URL.
Enable the Make Filename Unique option to append a unique number to the filename if a file already exists in the selected folder with the same name.
Once the file is downloaded the resulting full path/filename will be assigned to the variable selected from the Assign Returned File Path To list.
You can then use this variable to perform other actions such as adding the file as an attachment to outgoing emails.
The Automation will raise an error if the download fails for any reason.
Sign in to an OAuth endpoint to obtain an authorization token.
This action can be used to obtain an authorization token from an OAuth enabled web API. The token can then be used on subsequent HTTP GET or POST actions.
Select the Type. This can be one of the ThinkAutomation connected app types, or Generic.
Enter the Name. This is simply an identifier to show in your Automation actions list. Any text can be used.
Generic OAuth
For generic OAuth you must then supply the Authorization Endpoint, Token Endpoint, Client ID, Client Secret and Scope. These settings depend on the API you want to use. Consult the API documentation for the service you want to use to obtain the correct values.
The Additional Options tab provides some additional options that your OAuth provider may require.
Some OAuth providers can provide additional parameters in the redirect request that is sent back to ThinkAutomation. One such case is for QuickBooks, which returns a realmId parameter. For these cases you can specify parameter names in the Extract Custom Redirect URL Parameters grid. In the Assign To column specify the ThinkAutomation variable to receive each parameter value. You can then use this value on subsequent actions.
Click the Sign In button to begin the sign in process. A browser session will be started to complete the sign in.
Select a variable to receive the authorization token from the Assign Authorization To list.
On any subsequent HTTP GET, HTTP POST or Read JSON Document actions you can then set the Authentication method to OAuth and then Auth Token to the variable value selected above.
ThinkAutomation will automatically refresh the authorization token when it expires.
As with all other Action settings, the Client ID and Client Secret are stored securely in the ThinkAutomation metadata database.
Download, Upload or Delete files using various cloud storage providers.
Select the Provider:
Amazon S3
Google Drive
Google Cloud Storage
Microsoft OneDrive
IBM Cloud Object Storage
Wasabi
DigitalOcean Spaces
Linode
Azure Blob
Azure File
Depending on the provider, click the Sign In button or enter your Access Key and Secret Key (Amazon S3, Google Cloud Storage, IBM, Wasabi, DigitalOcean Spaces & Linode will also need the Region) and click the Connect button to connect.
You can create Global or Solution constants for your Access Key/Secret Keys so they can be used on multiple actions.
Select Upload, Download or Delete from the Operation selector.
Downloading
In the Remote Files navigator you can navigate folders and files. Double-click a file to add it to the Download Files entry. Multiple files can be downloaded within the same action. Separate each file with a comma.
You can also specify the Downloaded Files directly by entering the paths (or use %variable% replacements). Each file must specify the full path (beginning with /). For S3 compatible providers (Amazon S3, Wasabi, IBM, DigitalOcean, Linode) the Bucket Name must be the first part of the path (Eg: /bucketname/docs/quote1.pdf).
Wildcards
Download paths can contain wildcards (Eg: /myfiles/docs/*.pdf). Each file in the folder matching the mask will be downloaded. You can specify multiple download masks separated by commas (Eg: /myfiles/docs/*.pdf, /myfiles/docs/*.docx)
Specify the Save To folder where you want the downloaded files saved to.
The Assign To variable will receive the local path/filename where the file(s) have been downloaded to. Multiple files will be separated by commas.
Uploading
In the Remote Files navigator you can navigate folders and files. Select the folder where you want to upload files to.
You can optionally specify an Append To Remote Path folder. If a path is specified here then files will be uploaded to Remote Path + Append To Remote Path. For example: If you selected a remote path of '/Documents/' and the Append To Remote Path was set to 'Attachments\PDF' then files will be uploaded to '/Documents/Attachments/PDF'. You can use %variables% in the Append To Remote Path entry.
In the Upload Files entry enter or select the local files to upload (use %variable% replacements if required). Multiple files should be separated by commas.
You also have the option of uploading Attachments. Select the Include Incoming Attachments option and specify the Mask.
The Assign To variable be receive the remote path names for the uploaded files(s). Multiple files will be separated by commas.
Deleting
In the Remote Files navigator you can navigate folders and files. Double-click a file to add it to the Delete Files entry. Multiple files can be downloaded within the same action. Separate each file with a comma.
You can also specify the Delete Files directly by entering the paths (or use %variable% replacements). Each file must specify the full path (beginning with /). For S3 compatible providers (Amazon S3, Wasabi, IBM, DigitalOcean, Linode) the Bucket Name must be the first part of the path (Eg: /bucketname/docs/quote1.pdf).
Wildcards
Delete paths can contain wildcards (Eg: /myfiles/docs/*.pdf). Each file in the folder matching the mask will be deleted. You can specify multiple delete masks separated by commas (Eg: /myfiles/docs/*.pdf, /myfiles/docs/*.docx.
The Assign To variable will receive the remote path/filename for each deleted file. Multiple files will be separated by commas.
Pauses execution of the Automation until a webhook callback is made from a 3rd party web service.
This action can be used to integrate with external web API's. Each processed message has a unique callback URL. This is available via the %Msg_WebCallbackUrl% built-in variable.
If you pass this variable via any HTTP Get or HTTP Post actions to a 3rd party API that offers a webhook response, then you can use this action to pause execution of the current message until the webhook response is received. You can then assign any of the parameters passed back with the webhook to variables in your Automation.
Enter the Name. The name shows in the actions list - but is not used otherwise.
Specify the Maximum Wait in minutes. If a response is not received before this time the Automation will continue.
You can send a response to the webhook call. Specify the Response Type and Response Data. This is optional and will depend on the 3rd party API.
The Request Parameter Assignments grid can be used to map parameters sent by the webhook to fields & variables in your Automation.
To use this action you would first use the HTTP Get or HTTP Post actions to make a request to the 3rd party web API. As part of the request you would include the %Msg_WebCallbackUrl% variable. This will tell the API the URL to use to make the webhook callback. Consult the API documentation for the parameter name to use.
After the HTTP Get/Post action you would add a Wait For Webhook action to pause execution until the webhook callback is received.
Executes a SOAP or .NET Web Service and returns the results to ThinkAutomation variables.
Method URI (Namespace)
This is the namespace of the web service. You can find the namespace by viewing the Web Service Definition (WSDL). For .NET Web Services view the .asmx page and click the Service Description link. The namespace will be shown in the targetNamespace element. .NET Web Services have a default namespace of http://tempuri.org. You should change this before making your web services public.
Method Name
This is the name of the method you want to call. You can view a list of available methods provided by the web service by viewing the asmx file.
Action URI
This defaults to the Method URI/Method name.
URL (asmx)
Enter the full public URL to the asmx page. You can use a secure address (https://) if required.
If your web services require a login before being accessed enter the User Name & Password and the Authentication type.
You must specify a value for all of the Parameters that the web service method expects. Enter the parameter Name and Value. For the value you can use %variable% replacements.
Assign Returned Value To
You can assign the returned value to a ThinkAutomation variable. Select the variable from the drop down list. If the web service returns a single value then this will be assigned to the variable. If the web service returns a complex data type - such as a DataSet - then then entire XML response will be assigned.
Output Parameters
If the web service returns output parameters then you can assign individual parameter values to ThinkAutomation fields or variables. If a parameter name specified is not returned as an output parameter then ThinkAutomation will scan the returned XML and extract the specified parameter name as a tag and assign to the tag value to the ThinkAutomation variable.
Checks the validity and expiry date for the SSL certificate used on any host/URL.
This action can be used to monitor the SSL certificates used on your web sites. For example, your Automation could send a notification email or SMS when a certificate is about to expire.
Specify the Host Name. This would normally be the root web address, eg: thinkautomation.com. If you specify a full URL then the host name will be extracted. Use %variable% replacements if required. Specify the Port. This would normally be 443.
You can specify the Connection Timeout (in seconds). This is the number of seconds to wait for the initial connection.
In the Expiry Days entry, specify the number of days before the certificate expiry date where the status should be set to 'expiring'.
Select the variable to receive the certificate status from the Assign Certificate Status to list. The status will be set to valid, invalid, expired, expiring, none or an error message:
valid - the certificate is valid and not about to expire within the Expiry Days.
invalid - the certificate is invalid.
expired - the certificate has expired.
expiring - the certificate is about to expire (within the Expiry Days).
none - no certificates.
error: {message} - if the host cannot be reached.
If the host cannot be reached, then the status will be set to 'error: {error description}' (eg: 'error: DNS lookup failed').
Select the variable to receive the expiry date from the Assign Expiry Date To list.
The complete certificate chain can also be assigned to a variable in Json format:
xxxxxxxxxx
[
{
"subject": "CN=mydomain.com",
"issuer": "C=US, O=DigiCert Inc, OU=www.digicert.com, CN=RapidSSL TLS RSA CA G1",
"validFrom": "2023-11-02T00:00:00",
"validTo": "2024-11-01T23:59:59",
"usage": "serverAuth,clientAuth",
"root": false
},
{
"subject": "C=US, O=DigiCert Inc, OU=www.digicert.com, CN=RapidSSL TLS RSA CA G1",
"issuer": "C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Global Root G2",
"validFrom": "2017-11-02T12:24:33",
"validTo": "2027-11-02T12:24:33",
"usage": "serverAuth,clientAuth",
"root": false
},
{
"subject": "C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Global Root G2",
"issuer": "C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Global Root G2",
"validFrom": "2013-08-01T12:00:00",
"validTo": "2038-01-15T12:00:00",
"usage": "",
"root": true
}
]
Select the variable to receive the Json from the Assign Json to list. This is optional, but allows you to examine the certificate chain further in your Automation.
Uploads files or attachments to an FTP or SFTP server.
First select FTP or SFTP.
Enter your FTP/STFP Host, User Name & Password.
Click the Connect button to connect to your FTP/SFTP Server.
For FTP servers: You may need to uncheck the Passive Mode option if your FTP server doesn't support passive mode. You can select the Secure Mode of 'Auth TLS', 'SSL' & 'None' if your FTP server requires a secure connection.
You can then select a Remote Path to upload your files to.
Instead of selecting a remote path you can specify a path in the Force Remote Path To entry. You can manually enter a path or use a %variable% (or combination). Enable the Create If Missing option if the path should be created on the remote sever if it does not exist.
Syncing A Local Folder
To sync a local folder, select the folder in the Sync From Local Folder entry. Enable Include Sub Folders to include all sub-folders. Enter any Sync Masks. This is a comma separated list of file masks to include in the Sync Folder upload. For example: "*.html,*.css" would only upload files with html or css extensions. Leave blank or set to *.* for all file types. Enable the Skip Upload If Existing File Is The Same Size & Date option to only upload new/updated files during the folder sync.
Uploading Individual Files
The Upload Local Files can be used to select individual local files to upload. Multiple files can be added, separated by commas. You can use %variable% replacements for filenames if required.
Uploading Attachments
To upload attachments enable the Include Incoming Attachments option and specify the Attachment Mask.
In all upload cases the Skip Upload If Existing File Is The Same Size & Date option can be enabled to prevent files that already exist in the Remote Path from being uploaded again if the file size and date are the same.
Enable the Show Progress In Log option to add log entries to show the progress of the upload.
The number of files uploaded can be returned to a variable. Select the variable from the Assign Results To list.
Download files from an FTP or SFTP server.
First select FTP or SFTP.
Enter your FTP Host, User Name & Password.
Click the Connect button to connect to your FTP Server. You may need to uncheck the Passive Mode option if your FTP server doesn't support passive mode.
You can select the Secure Mode of 'Auth TLS', 'SSL' & 'None' if your FTP server requires a secure connection.
You can then select a Remote Path to download files from.
Download Or Sync
From the Download Or Sync option select:
Download Files
Select or enter the Remote File Or Mask to download. You can specify a remote file or a mask (eg: *.pdf)
Select the Save To folder to save the downloaded files to.
If Delete Downloaded Files After Message Is Processed is enabled then ThinkAutomation will remove the file when the Automation completes for the current message. This is useful if you wish to use the file in the Automation (for example, to send the document as an attachment with the Send Email action), but do not need to keep a local copy afterwards.
The Assign Downloaded Files To variable will receive a comma separated list of local file paths.
Sync Local Folder
This option allows you to synchronize a remote path to a local folder (and optionally all sub folders). All new and changed files in the specified remote path will be downloaded to the specified local folder.
To sync a local folder, select the local folder in the Local Folder entry. Enable Include Sub Folders to include all sub-folders. Enter any Sync Masks. This is a comma separated list of file masks to include in the Sync Folder download. For example: "*.html,*.css" would only sync files with html or css extensions. Leave blank or set to *.* for all file types.
When the Automation executes, the Remote Path will be scanned and compared to the Local Folder. Any missing files, newer files or files with size differences will be downloaded. Any new remote sub folders will be created in the local folder (if the Include Sub Folders option is enabled).
The Assign Downloaded Files To variable will receive a comma separated list of local file paths for all new/changed files downloaded for the current sync. If no new or changed files are downloaded then the assign to variable will be blank.
Extracts browser name, version & operating system information from a User Agent string.
Specify a user agent or %variable% in the Get Browser Info For User Agent entry.
You can the select variables to receive:
Browser Name
Version
Operating System
Is Mobile (true or false)
Is Spider (true or false)
This Action is useful when receiving messages via the API - from web forms, or web requests. It allows you to obtain browser information for the user making the request.
For API received messages the originating user-agent is added to the Message Headers. You can extract this using the Set Variable action with the Extract Header Value operation and the Value set to User-Agent.
Wraps text content inside HTML tags to create a viewable HTML page. This action is useful if you have content that you have created earlier in your Automation that you then want to wrap inside a HTML page. The resulting HTML can then be used for outgoing emails, API responses or for any other purpose.
Specify the Content To Wrap. This can contain %variable% replacements. You can use Markdown to easily render tables etc. The Markdown will be converted to HTML before being wrapped. You can also specify HTML directly (HTML should not include the body tags). You should not use HTML and Markdown combined.
You can also specify a Title, Header and Footer. These are optional. The Header and Footer can contain Markdown or HTML.
Styling
On the Style tab you can specify various styling options:
None - no styling will be added.
Default - a simple stylesheet will be added (you can edit the default stylesheet in the Server Settings).
Bootstrap - the page will use Bootstrap styles.
You can also specify the page Background and Foreground colors and optionally a Header Image URL.
You can optionally specify your own Style Sheet Path Or URL. If a file path is used then the file will be read and added to the page. If a URL is specified then a link to it will be added.
If the Convert CSS To Inline option is enabled then any stylesheets to will be converted to inline style attributes and the stylesheets removed. This enables the HTML to be sent via email as most email clients only support inline styles (this option cannot be used if you select the Bootstrap style option).
Meta Tags
Click the Meta Tags tab to add any Meta Tags (description, keywords, author etc). Tag values can use %variable% replacements.
Click the Preview button to preview the results.
Select the variable to receive the new HTML from the Assign To list.
Example:
xxxxxxxxxx
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" value="width=device-width, initial-scale=1.0">
<meta name="description" value="Test Page">
<meta name="author" value="Parker Software">
<title>Title</title>
</head>
<body style="color:#262626">
<div class="container">
<div>
<h2>Title</h2>
<div class="header">
<p>Header</p>
</div>
<div id="ta_mainDiv">
Hello World
</div>
</div>
<div class="footer">Footer</div>
</div>
</body>
</html>
The above example uses no styling. If you wanted to create your own stylesheet then you would create classes for h2
and the header
& footer
classes. The class ta_mainDiv
will contain the wrapped content.
Crawls (spider's) a URL and returns a list of all URLs found. The list can either be returned as a text with one URL per line or as CSV or Json containing each URL, Title, Description and Keywords.
The Web Spider Action only crawls the specified URL. It does not crawl outbound links.
Specify the URL to spider.
Specify any Avoid Patterns (separated by semi colons). Adds wildcard patterns to prevent spidering matching URLs. For example, if "*/assets/*" is added, then any URL containing "/assets/" is not spidered. The "*" character matches zero or more of any character.
Set the Maximum URLs that you want to spider for the site.
Enable the Chop Querystrings to remove the ?query portion from any URLs. This can be done to avoid auto-generated content.
The Web Spider Action will check any robots.txt file. It will not download pages denied by robots.txt
The Return As option can be set to:
URLs one per line
For example:
xxxxxxxxxx
https://www.testsite.com/
https://www.testsite.com/page2.htm
CSV Containing URL, Title, Description, Keywords
For example:
xxxxxxxxxx
URL,Title,Description,Keywords
https://www.testsite.com/,Title1,Test Description 1,"keyword1,keyword2"
https://www.testsite.com/page2.htm,Title 2,Test Description 2,"keyword1,keyword2"
JSON Array Containing, URL, Title, Description, Keywords
For example:
xxxxxxxxxx
[
{
"URL": "https://www.testsite.com/",
"Title": "Title 1",
"Description": "Test Description 1",
"Keywords": "keyword1,keyword2"
},
{
"URL": "https://www.testsite.com/page2",
"Title": "Title 2",
"Description": "Test Description 2",
"Keywords": "keyword1,keyword2"
}
]
Select the variable to receive the results from the Assign To list.
You can also assign a list of outbound links found across all URLs spidered. Select the variable to receive outbound links from the Assign Outbound Links to list. Outbound links are returned as a text string with one link per line.
This Action is useful when you need to load content for an entire site - for example: If loading a site to add to a Knowledge Store. You could first spider a site and then use the For..Each.. Line In action to loop through the site adding each page content to a Knowledge Store Collection, using the page title as the article titles. For example:
xxxxxxxxxx
// add site to knowledge store
URL =
URLS =
Title =
Content =
URLS = Web Spider URL https://www.mysite.com Avoid *.js;*/assets/*
For Each Line In %URLS% [Assign To URL]
Content = HTTP Get From %URL% Convert To Markdown [Assign Title To: Title]
If %Title% Is Not Blank Then
Embedded Knowledge Store MyKnowledgeBase Update Title = %Title% %Content%
End If
Next Loop
Note: This action may take several minutes for large sites.
Create Json text and assign variables to each Json element. The resulting Json text can be assigned to a variable for use on subsequent actions.
You first need to enter or paste valid Json text in the Enter Or Paste Json Here To Parse entry. You need to obtain the Json schema that you want to update and copy/paste into this entry. Then click the Parse > button.
The Json will be parsed and all elements will be listed in a tree structure.
Select each line in the tree in turn. The Selected XPath, Element and Type will be shown as you select each entry.
In the Set To Value entry enter or specify the data that you want to be assigned to the selected entry. Fields/Variables can be specified here. Then click the Update button. The updated Json will be shown in the Preview Result view. Repeat for each element that you want to update.
In the Assign Json To list select the variable you want to resulting Json assigned to. If the Compact option is enabled then the Json will be returned in compact format, otherwise it will be formatted and indented.
When the message is processed each element in the Json will be assigned the value you specify and the resulting Json assigned to the specified variable.
This Json can then be used on other actions by referencing this variable.
You can also use the Update Json and Set Variable actions to manually create Json. The Set variable text can contain %variable% replacements. When ThinkAutomation replaces values during Automation execution it checks if the value is being replaced inside Json - and if so the replaced value will be Json 'escaped'. See: Json Notes.
Update Json text. Create or update multiple Json paths within Json text and return the updated Json to a variable.
In the Existing Json entry, enter any valid json text or use a %variable% replacement containing Json. If this entry is blank a new Json document will be created.
You can now use the Set Paths grid to update specific Json paths. If the specified path already exists, it's value will be updated with the value in the Set To column. If the path does not exist it will be added.
Note: Paths are JsonPath format which uses dot notation and array indexes starting at zero (eg: name.Department). This differs from the Create Json and Read Json Document actions which use XPath notation.
The Set To column can contain fixed value or %variable% replacement or combination.
The Type column can be used to force the Json type at the specified path. If the Type is set to Auto or blank then the type will be automatically chosen based on the Set To value.
For example, suppose we have the following Json:
xxxxxxxxxx
{
"Name": "",
"StartDate": "",
"Age": 0,
"Started": true,
"Department": {
"Name": "",
"Manager": ""
}
}
If the Set Paths are set to:
Path | Value | Type |
---|---|---|
Name | Nathan Walters | String |
StartDate | %Msg_Date% | DateTime |
Age | 30 | Number |
Department.Name | Marketing | String |
Department.Manager | Howard Williams | String |
The resulting Json would be returned as:
xxxxxxxxxx
{
"Name": "Nathan Walters",
"StartDate": "2021-10-11T15:52:36Z",
"Age": 30,
"Started": true,
"Department": {
"Name": "Sales",
"Manager": "Howard Williams"
}
}
If the Existing Json was blank it would be returned as:
xxxxxxxxxx
{
"Name": "Nathan Walters",
"StartDate": "2021-10-11T15:56:53Z",
"Age": 30,
"Department": {
"Name": "Sales",
"Manager": "Howard Williams"
}
}
Since all the paths are new - and so all the Set Paths will be added.
Paths use dot notation to reference nested objects. You can also use [index] to reference specific array items (eg: object.nestedobject.array[1].value). Index numbers start at zero.
Paths are case sensitive.
Removing Paths
You can also use this action to remove paths from existing Json. In the Remove Paths grid enter the paths that you want to remove.
To remove individual array items the path must end with the index enclosed in square brackets (eg: object.array[1]). Array indexes start at zero. When removing multiple array items from the same array the index will change after each deletion. So to remove the first two array items you would set the Remove Paths to:
xxxxxxxxxx
object.array[0] ' after this deletion the second item will be move to 0
object.array[0] ' so we need to delete zero again
Assign To
Select the variable to receive the updated Json from the Assign To list. If the Compact option is enabled then the Json will be returned in compact format, otherwise it will be formatted and indented.
Parses a Json formatted document from any URL or text/variable and assigns element values to variables.
Parsing Json From Web Responses
Select the Get Json From URL tab to read a Json document from a URL.
Enter the Json Document URL to read. This can be a secure HTTPS URL if required.
If the web resource requires authentication then specify the Authentication method and optionally a User Name/Password or an OAuth Auth Token retrieved from a previous OAuth SignIn action.
The HTTP status code can be assigned to a variable from the Assign Status Code To list.
The full Json text returned from the URL can be assigned to a variable. Select from the Assign Returned JSON To list.
You can also map specific path values to ThinkAutomation variables by entering the Full Path and selecting the variable from the Assign Value To column.
The Full Path entries used when extracting specific attributes can contain %variable% replacements.
Note: The paths used are XPath notation.
Click the Test button to parse the response from current URL or text. This results will be shown in the tree. Click each node to expand the child nodes. The Selected Path & Selected Value entries will show the value for the currently selected Path. You can copy/paste the Selected Path into the Assign grid.
Parsing Json Text
You can also specify any Json text directly instead of reading from a URL. This can be a variable from a previous action. Select the Json Text tab.
Enter or paste the Json text or specify a %fieldname%. When developing your Automation you can paste some sample Json text into the Json Text entry & click Test to parse and view the paths. Then remove the sample Json text or replace it with a %variable% replacement.
Converts any Json text to a HTML table.
This action is useful when you read Json data from a database, web resource or web API etc., and you need to easily convert the content to readable HTML. The HTML can then be included on outgoing emails or used as a return value for webform Message Sources.
In the Json editor, enter or paste the Json text, or use a %variable% replacement for Json created from an earlier action.
The Preview window will show a preview of the HTML created. The Json will be converted to a HTML table. Sub-objects/arrays etc will be converted into nested tables.
You can optionally add a Title which will appear above the table.
Enable the Convert Property Names option to convert camelCase property names into separate words. For example: customerName will appear as Customer Name.
If the Return Full Page option is enabled then the returned HTML will include html, body, head tags. Otherwise only the table html will be returned. This is useful if you are embedding the table into an existing HTML document.
If the Use Default Styles option is enabled then the table will have a default style sheet applied.
You can also optionally add any custom CSS (eg: body {background-color: lightblue;}).
Select the ThinkAutomation variable to receive the HTML from the Assign Html To list.
Example:
The following Json:
xxxxxxxxxx
{
"Name": "ABC Limited",
"EmailAddress": "a.dutchess@abclimited.com",
"Address": {
"AddressType": "POBOX",
"AddressLine1": "P O Box 123",
"City": "Wellington",
"PostalCode": "6011",
"AttentionTo": "Andrea"
},
"Currency": "NZD"
}
Would be converted to:
xxxxxxxxxx
<table>
<tbody>
<tr>
<td><b>Name</b></td>
<td>
ABC Limited
</td>
</tr>
<tr>
<td><b>Email Address</b></td>
<td>
<a href='mailto:a.dutchess@abclimited.com' target='_blank'>a.dutchess@abclimited.com</a>
</td>
</tr>
<tr>
<td><b>Address</b></td>
<td>
<table>
<thead>
<tr>
<th>Address Type</th>
<th>Address Line1</th>
<th>City</th>
<th>Postal Code</th>
<th>Attention To</th>
</tr>
</thead>
<tbody>
<tr>
<td>POBOX</td>
<td>P O Box 123</td>
<td>Wellington</td>
<td>6011</td>
<td>Andrea</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td><b>Currency</b></td>
<td>
NZD
</td>
</tr>
</tbody>
</table>
Create or update a comma separated values (CSV) file or CSV data.
You can either update a CSV File or a variable containing CSV data.
Enter or select the CSV File Name to update. This is the full path and filename of the CSV file you want to update. This is optional. If no file name is specified then the created CSV data will be assigned to the variable selected from the Assign To list.
ThinkAutomation will create the path and file if it does not already exist. Column names will be written to the header line of the new file (unless the Don't Add Field Header Line When Creating option is enabled).
Select the file Format of the CSV file. This can be ASCII, Unicode or UTF-8 (default).
Select the Column Delimiter. This is normally a comma, but can be any character. You can select select a | (pipe) character, semi-colon or TAB from the drop down.
Select the Line Terminator. This can be CRLF (Carriage Return/Line Feed), LF (Line Feed Only). CRLF is the default.
Select Don't Add Field Header Line When Creating if you want the CSV data to contain data lines only. By default, when the CSV file is first created the first line will contain the column headers.
Use Custom Columns List
By default ThinkAutomation will create CSV data with a column for each Extract Field action in your Automation. Enable Use Custom Columns List to specify a list of %variables% to include in each column. You can also specify the column header names.
Optionally select a variable from the Assign CSV Data To list to receive the updated CSV data.
Read a CSV file or %variable% containing CSV data and assign the CSV data to a variable.
This action allows you to read a CSV file (or a %variable% containing CSV data). You can optionally delete columns from then returned CSV data and sort by a column. The column delimiter character and line endings will be automatically detected when the CSV is loaded. However the returned CSV data will always use a comma as the delimiter. Any date & datetime values will be automatically normalized to date format yyyy-MM-dd HH:mm:ss in the returned CSV data.
Specify the CSV File Name or Variable. This field can contain a file path (or %variable% containing a file path) or a %variable% containing CSV data.
Enable the Has Header Row if the CSV data contains column headers on the first row.
Deleting Columns
You can optionally delete columns from the returned CSV data. Specify a comma separated list of column header names, or column numbers (starting at 1). The source CSV file/data is not changed - this setting only affects the CSV data that is returned.
Deleting Last Rows
You can optionally delete the last x rows from the returned CSV data. Specify the number of rows to remove in the Delete Last Rows entry. For example, if this is set to 2 then the last 2 rows will be removed (before any sorting). This can be useful if you have extracted the CSV data from an Excel file (using the Lookup From Excel action) and the CSV data contains additional summary rows at the end. The source CSV file/data is not changed.
Sorting
You can sort the returned CSV data by a column. Specify the column header name or column number (starting at 1) in the Return Sorted By Column entry. You can select to sort Ascending or Descending. If you use column number here then the number relates to the new CSV columns after any columns have been deleted.
Return Top Rows
You can choose to only return the first x rows (after any sorting). Leave this entry at zero for all rows.
Return Header Row
Disable this setting if you do not want the column header row included in the returned CSV data.
Select the %variable% to receive the CSV data from the Assign CSV Data To list.
Extract values from comma separated text.
Select the CSV value to parse from the Parse CSV Line In list.
In the Column Assignments grid, for each column you want to extract enter the Column Number and select the Assign Value To variable to receive the column value.
Column numbers are 1 based.
This action will correctly handle quoted values.
This action is useful when used with the For..Each loop, looping on Line. This enables you to read a CSV file (or Attachment) and loop on each line. Inside the loop use this action to parse each CSV line.
Converts any CSV text to a HTML table.
This action is useful when you read CSV data from a database lookup and you need to easily convert the content to readable HTML. The HTML can then be included on outgoing emails or used as a return value for webform Message Sources.
In the CSV editor, enter or paste the CSV text, or use a %variable% replacement for CSV data created from an earlier action.
The Preview window will show a preview of the HTML created. The CSV will be converted to a HTML table.
You can optionally add a Title which will appear above the table.
If the Return Full Page option is enabled then the returned HTML will include html, body, head tags. Otherwise only the table html will be returned. This is useful if you are embedding the table into an existing HTML document.
If the Use Default Styles option is enabled then the table will have a default style sheet applied.
You can also optionally add any custom CSS (eg: body {background-color: lightblue;}).
Enable the Add Bootstrap Classes to add Bootstrap class names to the table. You can then enable other Bootstrap classes: Bordered, Hoverable, Responsive, Small & Striped Rows. You can also select the Bootstrap Color.
Select the ThinkAutomation variable to receive the HTML from the Assign Html To list.
Example:
The following CSV:
xxxxxxxxxx
year,color,country,food
2001,red,France,cheese
2005,blue,"United States",hamburger
2008,green,Italy,pasta
Would be converted to:
xxxxxxxxxx
<table>
<col style="width:15.38%" />
<col style="width:17.95%" />
<col style="width:38.46%" />
<col style="width:28.21%" />
<thead>
<tr>
<th style="text-align: right;">Year</th>
<th>Color</th>
<th>Country</th>
<th>Food</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: right;">2001</td>
<td>red</td>
<td>France</td>
<td>cheese</td>
</tr>
<tr>
<td style="text-align: right;">2005</td>
<td>blue</td>
<td>United States</td>
<td>hamburger</td>
</tr>
<tr>
<td style="text-align: right;">2008</td>
<td>green</td>
<td>Italy</td>
<td>pasta</td>
</tr>
</tbody>
</table>
Translates text from one language to another and returns the result to a variable.
Enter or select the From Language. If blank the language will be automatically detected (if possible).
Enter or select the To Language. This is required.
Enter the Text To Translate. This is limited to 10000 characters.
Enable Is HTML if the text will contain HTML tags. Passing the built-in variable %msg_html% would pass the entire HTML of the incoming message.
Enable Preserve Layout In Plaintext if you are passing none HTML (for example, the %msg_body% field contains the plain-text version of the incoming message). If this option is enabled then any carriage return/line feed characters and any white space will be preserved. Otherwise all control characters and white space is removed from the text before translation.
Select the variable you want the translated text assigned to from the Assign Translated Text To dropdown.
Translation requires a Translation account. This is configured in the Server Settings - Translation.
You can also use the ChatGPT action to translate any text. Simply send a prompt such as:
xxxxxxxxxx
Please translate the following to French:
%Msg_Body%
You can send any ThinkAutomation variable(s) with the prompt.
Detects the language for any text and returns the language code to a variable.
Enter the Text To Detect. This field is limited to 10000 characters.
Select the variable you want the language code assigned to from the Assign Language Code To Variable list.
Translation requires a Translation account. This is configured in the Server Settings - Translation.
You can also use the ChatGPT action to detect the language of any text. Simply send a prompt such as:
xxxxxxxxxx
What language is this?
%Msg_Body%
Just return the language ISO 2 letter code.
You can send any ThinkAutomation variable(s) with the prompt.
Returns a URL of a WAV or MP3 file containing spoken text in the desired language. This action is designed to translate and then speak text in a different language. If you simply want to convert text to speech, use the Text To Speech action - which performs the conversion locally and does not require a Translation account.
Enter the Text To Speak. This is limited to 2000 characters.
Enter or select the Speak In Language. This can be the same as the input language if you just want to speak the text as is.
Select the Sound File Format (WAV or MP3).
Select the variable you want the URL to be assigned to from the Assign Sound File URL To Variable list.
You can use the Download Action if you want to download the file to your system.
Translation requires a Translation account. This is configured in the Server Settings - Translation.
Performs a Geo IP lookup for any IP address, domain name, email address or URL. The Geo IP lookup returns the City, Region & Country for any IP address. Also returns the Organization name.
In the Lookup field enter any text or %variable%. If the field contains an IP address then this will be used. If no IP address is found then the first email address will be used. If no email address then the first URL. If an email address/domain name is used then ThinkAutomation will first perform a reverse DNS lookup to find the IP address and then use that to do the Geo IP lookup.
You can then assign the Country, Region, City & Organization to variables.
This action is useful for validating customer details - for instance you can check that the GeoIP Country of the customers email address matches the country they specify on an order form.
This Action is also useful when receiving messages via the API - from web forms, or web requests. It allows you to obtain Geo IP information for the user making the request.
For API received messages the remote host (IP Address) is added to the Message Headers. You can access this using the built-in variable %Msg_FromIP%.
This Action uses ThinkAutomation's own GeoIP database installed locally. This is updated on a regular basis.
Finds country information by country name, country code (2 or 3 letter) or country telephone dial code.
In the Lookup field any text or %variable%. You can search by country name, country code (ISO 3166 2 or 3 letter), dial code or country name in French.
You can then assign the Country Name, Two Letter Code, Three Letter Code, Country Dial Code, Dial Prefix, Currency Code and French Name to variables.
If no country is found then the variables will be assigned blank values. However an error will be thrown if the search text is blank.
This action is useful for validating customer details - for example if you only have a telephone number with the country code you can find the country (eg: searching for '44' or '+44' will return 'United Kingdom') or for finding the currency code when you only have the country name/code etc.
This action enables you to call any telephone number. Once answered, ThinkAutomation can speak custom text to the receiver and/or connect the call to another number.
Makes an outbound voice call using the Twilio API. Twilio is a cloud-based telephony provider.
See: https://www.twilio.com for more information.
Before using this action you need to create a Twilio Account. Once you have created an account, login and select Dashboard. Select Show API Credentials - this will display the Account SID and Account Token. Enter these into ThinkAutomation Server Settings - Twilio Tab.
You must specify the From Twilio Number. This is the phone number that will be displayed on the receivers phone. In your Twilio Account you can create a new phone number, or you can verify one of your existing phone numbers with Twilio. Once verified it can be used as the From Number.
Enter the phone number to call in the Call Number entry. This must be the full international number. You can use the Normalize Phone Number action to correctly format a phone number for a given country.
Select the Ring For (Seconds). This defaults to 30 seconds. If the call is not answered within this time the call will be closed.
On Call Answer
Once the receiver has answered the call you can choose to:
Say Text
This will read the specified text to the receiver. You can specify up to 4096 characters. The text can include %variable% replacements.
Say In Voice/Language
The Say In Voice option allows you to select a voice (Woman, Man or Alice). The Say In Language can be used to select the language for the text being read. The Woman/Man voice can use languages: English US, English UK, French, German, Spanish or Italian. The Alice voice has a choice for more languages.
Play Audio File URL
You can also have an audio file played to the receiver. Specify the URL to the audio file to be played.
Hang Up If Machine Answers
Enable this option if the call should be stopped if an answering machine or voice mail system picks up the call.
Record Call
Enable this option if you want the call to be recorded. The URL of the recording can be returned to a ThinkAutomation field or variable on completion of the call.
Connect Call To
Enable this option if you want the call to be connected to another number once it has been answered and the Say Text/Play Audio has completed (if any). Specify the Connect To Number. This other number will then be called and the two calls connected. If you do not use the call connect then the call will end once the Say Text/Play Audio has completed.
On Call Completion
Once the call has ended the Call Duration, Call Status and Recording URL can be returned to ThinkAutomation variables.
The Call Status will be one of: completed, busy, failed or no-answer
Automation Processing
When ThinkAutomation starts the call the message processing for the current message will pause until the call completes (or fails). Other messages will be processed whilst the call is active. Once the call is complete the remaining actions in the Automation will execute.
Phone Number Formats
All phone numbers must include the country code preceded by + so 800 680 7712 would be +18006807712. For UK numbers the first 0 of the number is omitted. For example 01782 822577 would be +441782822577. ThinkAutomation will remove any spaces and add the + sign itself if required. Use the Normalize Phone Number Action to correctly format a phone number.
Sends an SMS text message to any phone using the Twilio API. Twilio is a cloud-based telephony provider.
See: https://www.twilio.com for more information.
Before using this action you need to create a Twilio Account. Once you have created an account, login and select Dashboard. Select Show API Credentials - this will display the Account SID and Account Token. Enter these into ThinkAutomation Server Settings - Twilio tab.
From Twilio Number Or Messaging Service SID
Messages can be sent from a specific Twilio Number. This is the phone number that will be displayed on the receivers phone. In your Twilio Account you can create a new phone number, or you can verify one of your existing phone numbers with Twilio. Once verified it can be used as the from number.
You can also specify a Messaging Service SID. In your Twilio Console you can create Messaging Services. The From number will then be automatically selected when the message is sent based on rules you define.
Enter the To number and Message Body.
The To number must include the country code.
You can also specify a Media URL if you want to send a Multi-Media Message (MMS). You can specify a URL to a Gif, Png or Jpeg image. This will be rendered on the receivers phone. The image must be less than 5mb.
MMS messages are only supported for USA and Canada numbers. Regular text messages can be sent to any number in the world.
Waiting For Delivery Status
Once the message is sent the sent status can be assigned to a ThinkAutomation variable. This status will be set to 'delivered' if the message has been successfully sent. Otherwise it will be set to 'undelivered', or 'failed: {error message}' for failed messages. If you assign the status to a variable then ThinkAutomation will wait until the SMS has been sent (or failed) before assigning the status and proceeding with the remaining actions for the Automation. Automations will still execute on other messages during this waiting phase (normally only a few seconds). ThinkAutomation will wait for up to 3 minutes for the status.
Waiting for delivery status requires the Web API to be enabled.
If you want to use the Wait For SMS Reply action to wait for a reply to this message you should always check the Assign Status To variable and only wait for the response if the sent status is 'delivered'. This ensures that the message has been sent before you start waiting for a response.
Automation Processing
When ThinkAutomation sends the text message the message processing for the current ThinkAutomation message will pause until the SMS text is sent (or fails). Other messages will be processed during this time. Once the SMS message has been sent the remaining actions in the Automation will execute.
Phone Number Formats
All phone numbers must include the country code preceded by + so 800 680 7712 would be +18006807712. For UK numbers the first 0 of the number is omitted. For example 01782 822577 would be +441782822577. ThinkAutomation will remove any spaces and add the + sign itself if required. Use the Normalize Phone Number Action to correctly format a phone number.
This Action will wait to receive an SMS text message from a specific number. Normally this action would be used to wait for a response to a previously sent SMS message.
Set the From Number to the number you want to wait to receive a message from. Leave this blank to use the number from the last Twilio SMS Message action.
Set the Wait For to the number of seconds you want to wait for. If a message is not received after this time then the message text will be blank and Automation execution will continue. The maximum value for this is 9999 seconds (166 Minutes).
Set the Assign Message Text to a variable that you want to reply text to be set to.
When this action executes, ThinkAutomation will pause execution of the current Automation Message execution until the reply is received (or the timeout seconds has elapsed). Other ThinkAutomation messages will be processed during this waiting period. When the reply is received the remaining Automation actions for the current message will be executed.
You can have multiple send/wait for reply actions within a single Automation, allowing you to construct automated SMS text conversations and performing different actions based on the reply results.
Formats a phone number for international or domestic use.
Takes any phone number and adds or removes the international dialing code for the specified country. It also removes any spaces, dashes or parenthesis.
Specify the Phone Number. This can be a field or variable. The first phone number found in the text specified will be used.
Specify the Country Code/Name. This can also be a variable. You can use the full country name eg: United Kingdom, or the country code, eg: GB
Enable the Make International option to return the full international phone number. Otherwise the domestic number will be returned.
Select the variable to assign the result to from the Assign To list.
This action is useful when using the Twilio actions, or for normalizing phone numbers before being recorded in a database.
International phone numbers will be returned in the format:
+{countrycode}{number}
Eg:
(407) 488 2019
for United States becomes: +14074882019
01782-822577
for United Kingdom becomes: +441782822577
Eg for domestic numbers:
+44 1782 822577
for United Kingdom becomes: 01782822577
If the country specified does not exist then the phone number will be returned blank.
Actions for integrating with ChatGPT or OptimaGPT and for using the built-in Sentiment Analyzer.
Train, Score & Classify messages for sentiment using the built-in Sentiment Analyzer. The ThinkAutomation Sentiment Analyzer does not use any 3rd party API's and so is free to use with any number of messages.
Send a prompt to OpenAI ChatGPT or a local OptimaGPT server, and assign the response to a variable. You can send single one-off prompts or prompts that are part of a conversation. The ThinkAutomation ChatGPT action enables you to automate AI requests and then use the response further in your Automation.
Before you can use this action you must create an account with OpenAI or install a local OptimaGPT server. To create an OpenAI account, go to OpenAI and click the Get Started link to create an account. On your account page select API Keys and generate a new secret key. Make a note of this key as it is only displayed once. This is your OpenAI API Key.
See OptimaGPT if you prefer to use an on-premises or private-cloud AI server.
If OptimaGPT is enabled then you can enable the Use OptimaGPT Local AI Server Instead Of ChatGPT option.
Specify the Operation:
Ask ChatGPT/OptimaGPT To Respond To A Prompt
Add Context To A Conversation
Clear Conversation Context
Ask ChatGPT To Respond To A Prompt With An Image
The System Message is optional. This can help to set the behavior of the assistant. For example: 'You are a helpful assistant'.
The Prompt is the text you want a response to.
Examples:
xxxxxxxxxx
What category is the email below? Is it sales, marketing, support or spam?
Respond with 'sales', 'marketing', 'support' or 'spam' only.
If it is a support email and it appears to be urgent, respond with 'support:urgent'.
Subject: %Msg_Subject%
%Msg_Digest%
Response: sales
xxxxxxxxxx
Extract the name and mailing address from this email:
Dear Kelly,
It was great to talk to you at the seminar. I thought Jane's talk was quite good.
Thank you for the book. Here's my address 2111 Ash Lane, Crestview CA 92002
Best,
Maya
Response:
Name: Maya
Mailing Address: 2111 Ash Lane, Crestview CA 92002
xxxxxxxxxx
I am flying from Manchester (UK) to Orlando.
What are the airport codes? Respond with just the codes separated by comma.
Response:
MAN,MCO
Prompts you send to ChatGPT have a limit of approximately 2000 words (depending on the Model).
Tip: When using AI to analyze incoming emails, you can use the %Msg_Digest% built-in variable instead of %Msg_Body%. The %Msg_Digest% variable contains the last reply text only, with all blank lines and extra whitespace removed. It is also trimmed to the first 750 characters. This is usually enough to categorize the text and will ensure the prompt does not exceed the token limit.
Tip: If you want to use AI to automatically respond to incoming emails you should use the %Msg_LastReplyBody% built-in variable instead of the %Msg_Body%. The %Msg_LastReplyBody% variable contains only the current reply, without any quoted text & previous replies. This ensures only the current message and not the entire email thread is sent.
The Open AI Model entry allows you to select the OpenAI Model to use. You can select from:
gpt-3.5-turbo-16k (max tokens 16384)
gpt-3.5-turbo (max tokens 4096)
gpt-4 (max tokens 8192)
gpt-4o (max tokens 128000)
Or your own fine-tuned model name
See the OpenAI documentation for details about the different models. GPT-3.5-turbo-16k is the default and works for most scenarios.
Specify the variable to receive the response from the Assign Response To list.
You can also optionally assign the number of tokens used for the prompt/response. Select the variable to receive the tokens used from the Assign Used Token Count To list. OpenAI charges are based on tokens used. For example, the current pricing for gpt-3.5-turbo is $0.002 per 1000 tokens (roughly 4k of text).
If the Requires Moderation option is enabled then the prompt text will be validated against the OpenAI moderation endpoint before being sent. This ensures that the prompt text complies with OpenAI's usage policies. This no-cost check takes some additional time. You should enable this option if you will be sending any public-generated content (for example, from a public facing chat bot or public receiving email responder). It ensures that no prompt text can be sent that violates OpenAI usage policies.
You can optionally specify a Conversation Id. This is useful if multiple ChatGPT requests will be made and you want to include previous prompts/responses for context, or if you want to add your own context prior to asking ChatGPT for a response.
The Conversation Id can be any text. For example, setting it to %Msg_FromEmail% will link any requests for the same incoming email address. The built-in variable %Msg_ConversationId% can be used for the Conversation Id. This is a hash of the from/to addresses and subject.
The Max Conversation Lines entry controls the maximum number of previous prompts/response pairs that are included with each request. For example, if the Max Conversation Lines is set to 25 then the last (most recent) 25 prompt/response pairs will be sent prior to the current prompt. As the conversation grows, the oldest items will be removed to prevent the total prompt text going over the Open AI token limit.
Conversations are shared by all Automations within a Solution and conversation lines older than 48 hours are removed.
For example:
Suppose you send 'What is the capital city of France?' in one prompt and receive a response. If you then send another separate prompt of 'What is the population?' with the same conversation id then you will receive a correct response about the population of Paris because ChatGPT already knows the context. This would work across multiple Automation executions for up to 48 hours, as long as the conversation id is the same.
You can add context to a conversation. Context is used to help ChatGPT give the correct answer to a question based on the context you have provided. This can be static text, or you can search articles related to the incoming message from the Embedded Knowledge Store and add the most relevant articles. Using the ChatGPT action along with the Add Context operations enables you to create bots that can answer business specific questions - even when ChatGPT itself has no knowledge of the subject matter.
Using the Embedded Knowledge Store enables you to add text and documents (PDF, Word, HTML etc) as articles to a Knowledge Store collection. You can then search the knowledge store using the incoming message as the Search Text. This will return the Top x most relevant articles from the specified Knowledge Store Collection.
The Relevancy Threshold setting controls the relevancy level. Articles below the relevancy % will not be included. This value defaults to 75%.
The Return Max Tokens entry should be set to a value lower than the maximum tokens that the OpenAI model supports (see above). It is recommended to keep this at approximately 50% of the model maximum. For example, if you will be using the gpt-3.5-turbo-16k model, then this allows 16384 tokens, so the Return Max Tokens entry should be no higher than 8192. This will ensure that there is enough tokens remaining for the prompt text and the ChatGPT response itself.
The returned articles will each be added as context, allowing ChatGPT to use this information when responding to the incoming message.
If you want to add a specific article from a Knowledge Store collection, rather than relying on a search (for example, based on specific keywords found in the incoming message), use the Embedded Knowledge Store action to lookup a specific article (using the Get operation). Set the Return As to Json, assign the returned article to a %variable%, then add this variable to the Add Static Context tab.
Top Title/Tag
You can optionally assign the Top Title and/or Top Tag to variables. The first (most relevant) article Title and Tag will be assigned. This can be used further in your Automation. For example: Suppose we have a number of articles relating to 'pricing' or 'quotes' or 'sales'. We could tag all of these with a 'sales' tag. At the end of the Automation we could check the Top Tag %variable%. If this is equal to 'sales' we could send an email to the sales team informing them that someone has asked something sales related - we could send the question and ChatGPT response with this email.
You can also add Static Context. This can be any text (which can contain %variable% replacements). This can be used to provide default context, for example:
xxxxxxxxxx
You are a very enthusiastic representative working at {your company}.
Given the following sections from our documentation, answer the user's question using only that information, outputted in markdown format.
If you are unsure and the answer is not explicitly written in the documentation, say "Sorry, I don't know how to help with that."
You should always add some default context, this should be used to tell ChatGPT who and what it is and how it should respond. You can also provide some general information about your business.
For email responder bots you can use default context such as:
xxxxxxxxxx
Your name is '{bot name}' and you are a very enthusiastic representative working at {your company} answering emails. Given the provided sections from our documentation, answer the question using only that information, outputted in markdown format.
If an answer cannot be found in the information provided, respond with 'I cannot help with that' only.
Do not try and answer the question if the information is not provided.
Add a friendly greeting and sign off message to your response. Your email address is '{bot email address}'.
My email address is %Msg_FromEmail%
This tells ChatGPT that it's responding to emails and to include a greeting and sign off message with its response.
If the Required option is enabled then the context text will remain in the conversation. This option can be used to ensure that the default or important context is always part of the conversation.
You could also lookup static context via a database or web lookup. For example: If the customer provides an email at the start of the chat, or you are responding to incoming emails, you could lookup customer & accounting/order information and add this to the context in case the customer asks about outstanding orders. Or you could lookup current service status if the user wants live status information.
Regardless of how the context is added, the same context wont be added to a conversation if the conversation already has it. So you can add standard context (for example, general information about your business) along with searched for context within your Automation prior to asking ChatGPT to a response.
You can add multiple ChatGPT - Add Context To A Conversation actions in your Automation prior to the ChatGPT - Ask ChatGPT To Respond To A Prompt action.
For example: Suppose you have a company chat bot on your website using the Web Chat message source. A user asks 'What are the benefits of widgets, and can you tell me the current price?'. You first add default context, you then do a knowledge base search with the Search Text set to the incoming question. This adds the most relevant articles relating to widgets to the conversation as context. If the incoming message contains 'widgets', you could then do a database lookup to get the current price for Widgets and add 'The current price for Widgets is %Price%' as static context. ChatGPT will then be able to answer the user's questions from the context you provided.
The context itself does not appear in the chat and it is not saved by OpenAI. It is only added to the prompt sent to ChatGPT to provide context to help ChatGPT answer that specific question. The benefit of this is that you can use the standard ChatGPT models without training - and you can provide up to date context by keeping your local knowledge base updated or looking up context from your own database. It allows you to quickly create working bots, maintain up-to-date information, and harness the full potential of ChatGPT while maintaining control over their data and data privacy.
Note: ChatGPT has a limit of 4096 tokens per request (or 16384 tokens for the newer gpt-3.5-turbo-16k model). Typically a token corresponds to about 4 characters of text. Prompt text includes any context added and the response from ChatGPT itself. ThinkAutomation automatically removes older context to ensure the token limit is not exceeded. If you add too much context, some of it may not be included.
You can add tabular context to a conversation. A user can then ask questions relating to the data.
For example, you could lookup invoices for a customer (based on the email address provided) from a database and return the data in CSV format:
xxxxxxxxxx
invoice_number,invoice_date,product,amount_due
INV-2023351,2023-01-05,Plain Widgets,1500.00
INV-2023387,2023-01-10,Orange Niblets,2500.00
INV-2023421,2023-01-15,Flat Widgets,1800.00
INV-2023479,2023-01-20,Flat Widgets,3500.00
INV-2023521,2023-01-25,Round Niblets,1200.00
You would assign the CSV data to a %variable% and then add Static Context:
xxxxxxxxxx
Given the following list of invoices in CSV format for the user, answer questions about this data. The 'amount_due' column gives the outstanding balance for the invoice in dollars.
%CSVData%
The chat user could then ask questions such as:
What is the date of my most recent invoice?
or Can you show me a list of my invoices?
When adding context as tabular data, you need to proceed the data with a clear instruction of what the data is. You would need to experiment with the prompt text to ensure ChatGPT responds correctly.
This operation will clear any Context added to a conversation. Specify the Conversation Id.
This operation can be used to ask a question about an image. The image can be a local file or a URL. The System Message is optional. This can help to set the behavior of the assistant. For example: 'You are a helpful assistant'.
The Prompt is the text is the question you want to ask about the provided image.
In the Image Path Or URL entry, specify a local file path or URL for the image. You can use %variable% replacements. The following image types are supported: PNG, JPEG, WEBP & GIF.
Select the variable to receive the response from the Assign ChatGPT Response To list.
Examples:
You can ask general questions about the image, such as 'What is in this image?' or 'Is this image an animal?'. You can also perform OCR, for example: 'Convert the image to text.' or 'The image is a receipt. What is the total paid and the tax?'.
Note: The OpenAI Vision API is currently in preview.
Your OpenAI account will set a rate limit for the maximum requests per minute. The Open AI API Key - Rate Limit Retries setting determines how many times ThinkAutomation will retry the request if a rate limit error is returned. It will automatically increase the wait time for each retry. The default wait period is 30 seconds. If the request still fails after the retries then an error will be raised.
If your ChatGPT action is timing out then your OpenAI account may be rate limited. You can increase the rate limit by adding pre-payment funds to your OpenAI account. This will move your account to then next usage tier. For example, adding a $50 pre-payment will move your account to usage tier 2 - which will have a higher rate limit and faster responses. See: OpenAI Rate Limits for more information.
Using AI with ThinkAutomation has many uses. Other than being a regular chat bot that has knowledge of many subjects, you can use it to:
Create a Chat Bot using the Web Chat Message Source type that can answer specific questions about your business by adding private context using the Embedded Knowledge Store.
Provide automated responses to incoming emails or SMS messages, utilizing the Embedded Knowledge Store.
Create a Teams Message Source type so that Microsoft Teams users can ask your bot questions.
Create a Chat Bot Automation that uses the API Message Source type. This can be the same type of Automation that you would use for the Web Chat Message Source type - but called via the API. This would allow you to use ThinkAutomation from your own chat web app or external chat apps/products.
Parse unstructured text and extract key information.
Summarize text.
Anonymize text.
Classify text.
Translate text.
Sentiment analysis.
Correct grammar/spelling.
Convert natural language into code (SQL, PowerShell etc).
Ask questions about images or extract text from images.
and much more. See: Examples - OpenAI
Performs Sentiment Analysis on any text and returns the Sentiment Score to a variable. The ThinkAutomation Sentiment Analyzer is able to detect if text is either positive or negative in sentiment or any other yes/no, positive/negative construct. You could then use the result to perform specific actions, for example, to send alert emails or SMS texts if an incoming email contains a high negative sentiment score.
Before Sentiment Analysis can work the ThinkAutomation Sentiment Analyzer must be 'trained'. The Sentiment Analyzer accuracy will improve the more it is trained. See: Train Sentiment
In the Get Sentiment Score For entry enter the text you want to analyze. Any text can be entered including %variable% replacements. To analyze the incoming message body set the value to %Msg_Body%.
The Sentiment Class Name is used to categorize the Sentiment Analysis database. For example: "Sales", "Spam" etc. Each class name stores training data separately. Class names are global to your ThinkAutomation instance. For example, a '"Sales" class name would contain the same training data across all of your Solutions.
In the Assign Sentiment Score To list select variable to assign the sentiment analysis score to.
The result will be returned as a number between 1 and 100. 100 being maximum positive sentiment and 1 being maximum negative sentiment. A result of 50 indicates neutral sentiment.
You can optionally also get a list of the most relevant tokens used in the scoring process. Select a field or variable to assign the list to from the Assign Relevant Tokens List To list.
The list is returned as a string. Each token on its own line as:
xxxxxxxxxx
token=score,count
token=score,count
...
Where score between 1 and 100. Count shows the number of occurrences of the token in the text analyzed. This list shows the tokens that have had the most effect (positive or negative) on the sentiment score.
Sentiment Analysis can be used to classify a message for any construct - not just Positive or Negative sentiment. For example, it could be used to classify a message as a sales inquiry or not. The construct is defined only by the training data. So if you trained the Sentiment Analyzer with 1000 sales inquiries and 1000 non-sales inquiry messages then it could be used to classify incoming messages as sales inquiries and then take appropriate action.
Sentiment Analyzer Control Panel
You can also use the included Sentiment Analyzer Control Panel to add training data and run run tests. See: Sentiment Analyzer Control Panel
This action uses the ThinkAutomation built-in sentiment analyzer - which requires training before it will return accurate scores but is free to use. The online Custom Action library also includes an Azure Sentiment action. This uses the pre-trained Sentiment Analyzer provided by Microsoft Cognitive Services (however this will require an Azure subscription).
You can also use the ChatGPT action to perform sentiment analysis.
Trains the ThinkAutomation Sentiment Analyzer with positive or negative sentiment text. The ThinkAutomation Sentiment Analyzer should be trained with Positive and Negative sentiment messages to improve sentiment analysis accuracy.
In the Train Sentiment Analyzer With entry enter the text you want to use. This can contain %variable% replacements. To train the incoming message body set the value to %Msg_Body%.
Select Positive, Negative or Add Ignore Words from the Train As drop down.
The Sentiment Class Name is used to categorize the Sentiment Analysis database. For example, you could have "Sales" and "Spam" class names. Each would produce their own specific results. Class names are global to your ThinkAutomation instance. For example, a "Sales" class name would contain the same training data across all of your Solutions.
The number of tokens added to the Sentiment Analysis database can be returned to a variable. Select the variable to use from the Assign Result To list.
Training Process
The Sentiment Analysis accuracy will improve with more training data. The Sentiment Analyzer includes built-in training data for common English positive and negative words. For best results you should also train the Sentiment Analyzer with your own training data. Train roughly equal numbers of Positive and Negative messages. You should where possible use actual positive and negative messages rather than just individual positive/negative keywords.
Ignore Words
In addition to adding positive and negative sentiment messages you can use this action to add 'Ignore Words'. Select Add Ignore Words from the Train As option. The text used will be split into words and each added separately to the Sentiment Database. When Sentiment Analysis is performed any words in the Ignore list wont be used to in the sentiment scoring process. You can add email address, links and any other words/text. The number of unique ignore words added will be returned to the Assign To Variable.
Sentiment Analyzer Control Panel
You can also use the included Sentiment Analyzer Control Panel to add training data and run run tests. See: Sentiment Analyzer Control Panel
Parker Software Professional Services team can assist in creating a training plan. Contact our Professional Services team for more information.
Finds the most relevant class name for any text.
In the Get Sentiment Classification For entry enter the text you want to use. This can contain %variable% replacements. To classify the incoming message body set the value to %Msg_Body%.
This action will score the given text against all class names that you have created training data for. The class name with the score furthest from neutral will be returned.
In the Assign Class Name To list select variable to assign the class name to.
For example: Suppose you have training data for class names 'Sales' & 'Support'. You can use this action to classify a new message as either 'Sales' or 'Support' depending on the class that scores furthest from neutral (IE: The class that ThinkAutomation thinks is the most likely).
Before Classification can work the ThinkAutomation Sentiment Analyzer must be 'trained'. The Sentiment Analyzer accuracy will improve the more it is trained. See: Train Sentiment
You can also use the ChatGPT action to classify any text. This will work without training.
Actions for interacting with Microsoft Azure Table, Blob, Queue, File & Cosmos storage and the Azure Form Recognizer service.
Download or Upload files to Azure Storage shares.
Specify your Azure Storage Account Name and Access Key and click the Connect button to connect.
Select the Share that you want to upload to or download from.
Select Upload or Download from the Operation selector.
Downloading
In the Remote Files navigator you can navigate folders and files in the Azure Share. Double-click a file to add it to the Download Files entry. Multiple files can be downloaded within the same action. Separate each file with a comma.
You can also specify the Downloaded Files directly by entering the paths (or use %variable% replacements). Each file must specify the full path (beginning with /).
Specify the Save To folder where you want the downloaded files saved to.
The Assign To variable will receive the local path/filename where the file(s) have been downloaded to. Multiple files will be separated by commas.
Uploading
In the Remote Files navigator you can navigate folders and files in the Azure Share. Select the folder where you want to upload files to.
In the Upload Files entry enter or select the local files to upload (use %variable% replacements if required). Multiple files should be separated by commas.
You also have the option of uploading Attachments. Select the Include Incoming Attachments option and specify the Mask.
The Assign To variable be receive the Azure path names for the uploaded files(s). Multiple files will be separated by commas.
Get URLs to files in an Azure Storage share.
This action can be used to generate a read-only URL to a file in an Azure Share. You can specify the number of minutes that the URL will be active for.
Specify your Azure Storage Account Name and Access Key and click the Connect button to connect.
Select the Share that you want to use.
In the Remote Files navigator you can navigate folders and files in the Azure Share. Double-click a file to add it to the Get Link(s) For Files entry. Multiple URLs can be generated within the same action.
You can also specify the Get Link(s) For Files directly by entering the paths (or use %variable% replacements). Each file must specify the full path (beginning with /). If using this action after the Azure File - Upload action you can use the %variable% previously returned from the Upload - this will then get links to the files just uploaded.
In the Links Valid For Minutes entry, specify the number of minutes that the link is usable for. This defaults to 1440 (24 hours).
In the Links Valid Only For IP Addresses entry you can optionally specify an IP address or range. The link will then only work when requested from the IP. IP ranges should be in the format (for example): 168.1.5.60-168.1.5.70
The Assign Links To variable will receive the URL. If multiple files are used then each URL will be separated with a comma.
You can then send this URL with an outgoing email to give the recipient time-limited access to the file(s).
Update or query Json documents from an Azure Cosmos DB.
Specify your Azure Cosmos DB Endpoint and Access Key and click the Connect button to connect.
Enter or select the Database and Container within the selected database.
Enter the Partition Key that you have defined for the Database\Container.
If the database or container do not exist they will be created if the Create option is enabled.
Operation
Insert or Update Document
This option will add a new document or update an existing one.
Set the Document Json to the Json text for the document. If the Json contains an id field then an existing document will be updated if one exists with the same id. If no id field is specified in the Json document the Cosmos will insert a new record and add the id field to the Json stored in the database.
You can build Json using the Create Json action and then set the Document Json to the %variable% name containing the Json, or you can specify it directly.
To store the incoming message you can set the Document Json to %Msg_Json%. The %Msg_Json% built-in variable returns a Json document representing the incoming message (including attachments).
Query Document
This option will query the selected database/container. The returned query results (in Json format) can be assigned to a variable from the Assign To list.
Enter the Query SQL Select Statement, for example:
xxxxxxxxxx
SELECT *
FROM Families f
WHERE f.id = "AndersenFamily"
The SQL statement must be compatible with the Cosmos SQL specifications.
You can use %variable% replacements:
xxxxxxxxxx
SELECT *
FROM Families f
WHERE f.id = "%FamilyId%"
You can also use parameters:
xxxxxxxxxx
SELECT *
FROM Families f
WHERE f.id = @id
If parameters are used you must the assign each parameter name a type and value in the Parameters grid.
When the Automation executes the Json returned from the query will be assigned to the variable specified. If multiple documents are returned the Json will contain an array of documents. If a single document is returned then the Json will be set to the document json.
You can assign the count of documents returned to a variable from the Assign Count To list.
Read from or write to Azure Blob Storage.
Specify your Azure Storage Account Name and Access Key and click the Connect button to connect.
Select the blob Container to read from or write to.
Select the Operation - Get Blob to read a blob or Put Blob to upload new blobs.
Get
Enter the Blob Name to read. This can contain %variable% replacements.
You can specify a Save To where the Blob will be saved. The saved blob path & name can then be assigned to a variable from the Assign To list.
If no Save To path is specified then the blob data itself will be assigned to the Assign To variable without being saved to a file.
Put
You can Put either Files & Attachments or Blob Data:
Files & Attachments
Enter a Blob Name - this is optional. If no name is specified then the file names will be used.
In the Upload Files entry, specify local files to upload. You can specify multiple files separated by commas. Leave blank to only upload attachments
Enable the Include Incoming Attachments to upload attachments and specify the Matching Mask (eg: *.pdf).
Enable the Ensure Unique option to append a timestamp to the uploaded file names to ensure they are unique. Otherwise any existing blob with the same name will be overwritten.
Enable the Append Filenames To Blob Name option to append uploaded file names to the Blob Name specified. This is only applicable if a Blob Name has been specified. For example: If the Blob Name is set to 'orders' and the attachment '1234.pdf' is uploaded, then the Blob name in your storage account will be set to 'orders1234.pdf'.
Each uploaded Blob is given a unique URL. You can assign the URL to a variable from the Assign Url(s) To list. If multiple files are uploaded then the multiple URL's will be returned, separated by commas.
Blob Data
This option allows you to upload raw blob data. The Blob Name & Blob Data must be specified. Any existing Blob with the same name will be overwritten.
Read from or write to Azure Table Storage.
Specify your Azure Storage Account Name and Access Key and click the Connect button to connect.
Select the Table Name to read from or write to.
Select the Operation - Get Entity to read a table row or Put Entity to write a new table row.
Get
Specify the Partition Key and Row Key for the table entity you want to read. These can contain %variable% replacements.
Once the table entity has been read you can then map entity property names to ThinkAutomation variables. Select the ThinkAutomation variable name from the Assign To list - and then enter or select the table entity property name in the Assign From column.
Put
Specify the Partition Key and Row Key for the new table entity you want to write. These can contain %variable% replacements.
You must then map entity property names to ThinkAutomation variables. Select the ThinkAutomation variable name from the Assign From list. Select the property Type, and then enter or select the table entity property name in the Assign To column.
You can also assign the URL to the newly created Table entity by selecting from the Assign Url To list.
Get or Add to an Azure Queue.
Specify your Azure Storage Account Name and Access Key and click the Connect button to connect.
Select the Queue Name to use.
Select the Operation - Get Message to take the next message from the queue or Put Message to add to the queue.
Get Message
This will take the next message from the queue. Select the variable to receive the queue message from the Assign To list.
Put Message
This will add a message to the queue. Specify the Message Data.
Extract text, key-value pairs and tables from documents, forms, receipts, invoices and business cards without manual labelling using the Azure Form Recognizer service. See: Form Recogniser – Automated Data Processing Systems | Microsoft Azure
Specify your Azure Form Recognizer Endpoint and Access Key.
Select the Model. This can be:
Layout - for generic documents.
Invoice - for invoices.
Business Card - for business cards and ID documents.
Receipt - for paper receipts.
Select the Locale/Language.
For the Layout model you can select a Pages range. This can be in the format 1-3, or 1,3,5. Leave blank for all pages.
Select the Analyze File. This can be any local file or a %variable% replacement. The following file types are supported: PDF, BMP, PNG, JPEG or TIF.
Select the variable to receive the result from the Assign Result To list.
Executes a Windows PowerShell command or script. Returns the response to a ThinkAutomation variable.
Enter the PowerShell Command or Script or specify PowerShell Script File.
In the PowerShell Command or Script you can either specify the command and it's parameters or you can specify the command only and then provide parameter names, values & types in the Parameters Grid.
Example - Single Command With Parameters
To get the current Windows version. Set the PowerShell Command to Get-ItemProperty
and add parameters:
Parameter Name | Value | Type |
---|---|---|
Path | HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion | String |
Name | ReleaseId | String |
You can use %variable% replacements for parameter values (or part of).
If you need to pass multiple values to a single parameter, you need to send through a special ThinkAutomation array type. To do this, prefix your parameter value with the word ARRAY: followed by comma-separated values.
This will return:
xxxxxxxxxx
ReleaseId : 2009
PSPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT
PSChildName : CurrentVersion
PSDrive : HKLM
PSProvider : Microsoft.PowerShell.Core\Registry
Example - Command
You can also execute a PowerShell command/script. Set the Command to:
(Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ReleaseId).ReleaseId
You can use %variable% replacements inside the Command, eg:
(Get-ItemProperty -Path "%RegKey%" -Name ReleaseId).ReleaseId
Nothing should be specified in the Parameters grid.
The above will return 2009
.
Remember to enclose string parameters in quotes.
Wait Max (Seconds)
Specify the maximum seconds to wait for the command or script to execute. If the command or script does not complete within the specified number of seconds then an error will be raised. This setting prevents scripts that do not properly handle timeouts from halting execution of the Automation.
Assign To
Select the variable that you want the Response to be assigned to. The entire PowerShell command response will be assigned to the field/variable.
Testing
You can use the Test button to test the Command/Script. The response will be displayed and also copied to the clipboard.
External Modules
If your PowerShell command or script uses external modules/cmdlets you need to enter the module names in the Import Module Names entry. Separate multiple modules with commas. You can use the module name or path.
In order to be able to run the PowerShell script you need to set an appropriate PowerShell Execution Policy. For guidance on this from Microsoft, see: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-6
Execute any Windows program or command with optional parameters. The Output of the program can be assigned to a variable.
Enter the Program Or Command To Run and any Parameters. You can use %fieldname% replacements in both entries.
Run Via
This option defines which process runs the program:
Run Via: Message Processor Service
The Message Processor service itself runs the program. You can optionally specify user Credentials that the program should execute as.
Run Via: ThinkAutomation Studio Or Desktop Connector On Behalf Of The Message Processor Service
The message processor service sends a request to the ThinkAutomation Studio or Desktop Connector to start the program on it's behalf. The Studio/Desktop Connector executes the program and sends the results back to the message processor.
You also have the option to specify a ThinkAutomation User Name if you want the program to be executed by a specific logged in Studio/Desktop connector user (for example a user running the Studio on a remote machine). If no user is specified then the process will be executed by the first running instance of the Studio/Desktop connector.
This option can be used in instances where the program you want to run needs to execute under the security context of the logged in Windows user rather than under the security context of a running service. For example, you may have an AutoIt script that interacts with the user's desktop applications. However for this to work the ThinkAutomation Studio or Desktop Connector applications must be running when the Automation executes.
Redirect Output
Select the Redirect Output if you want to receive the output of the program. The output can then be assigned to a variable selected from the Assign Output To list.
Wait For Exit
Select the Wait For Exit option if you want ThinkAutomation to wait for the program to complete before continuing with the remaining actions on the Automation. You can also specify a Wait Max in milliseconds.
The ThinkAutomation Professional Edition includes a Custom Action Designer. This allows you to create your own Custom Action types. The Custom Action Designer includes a UI builder for configuring the Action settings and a C# or Visual Basic .NET code editor for editing the execution code. Once a Custom Action has been created it appears in the available actions toolbox and can be used like any other action on any of your Automations.
Select the Custom Actions tab on the ThinkAutomation Studio Ribbon.
Click Add Action to add a new custom action.
Each action must have a unique Class Name. This must be less than 100 characters and must not contain spaces or special characters. The Class Description is the text that will show in the Actions toolbox. The Group Name is the section the action should appear in the Actions toolbox. You can select an existing group or create a new one. The Default Height/Width define the size of the Action property page.
You can create any number of settings. These are the Action Settings that appear when the Action is added to an Automation. Your custom action execution code can access these setting values at runtime.
Click Add to add a setting.
Each setting must have a unique Setting Name (unique within the custom action). You will use this name when accessing setting values inside your custom action code.
You must then select the Field Type:
Type | Details |
---|---|
TextBox | A regular textbox for text settings. |
Numeric Integer | A textbox that only allows integer values. |
Numeric Decimal | A textbox that only allows decimal values. |
Date | A date picker (setting value will be a string in 'yyyy-MM-dd HH:mm:ss' format). |
CheckBox | A boolean checkbox (setting value will be 'true' or 'false'). |
ComboBox | A combo box with a list of possible values. |
ListBox | A List box with a list of possible values. |
TreeView | A tree view with a list of possible values organized with parent/child hierarchy. |
Assign To Field Picker | A combo box already populated with all other variables in the Automation. |
File Picker | A textbox with a button to select a local file. |
Folder Picker | A textbox with a button to select a local folder. |
Grid | A simple grid for editing rows & columns of data. |
Plain Text Editor | An editor for editing plain text. |
Html Editor | An editor for editing HTML. |
SQL Editor | An editor for editing SQL. |
Json Editor | An editor for editing Json text. |
Label | Display a text label - no data input. |
Button | A simple button. Allows you to execute code on button click via Settings Form Code. |
OAuth Sign-In Button | A button to sign in to a web resource that supports OAuth 2.0. |
Microsoft Graph Sign-In Button | A button to sign in to Office 365/Microsoft Graph. |
Google Sign-In Button | A button to sign in to Google API's. |
Xero Sign-In Button | A button to sign in to Xero Accounts. |
Hidden | A hidden setting. Allows you to store values against the custom action via Settings Form Code. The values will be stored with the Automation. |
Setting Input Fields have additional properties depending on the field type, such as Default Value, Is Required, Is Password, Max Length, Numeric Range.
You can add multiple setting fields depending on the type of settings you need to store with your custom action when it is used on Automations.
You can change the order that settings appear on the settings form using the Up/Down buttons.
After you have created your input fields, click Preview to see how the custom action properties form will appear when it is used on an Automation.
An 'Assign Return Value To' Assign To Field picker setting is added automatically.
For ComboBox or ListBox setting types you define a list of Items containing Display Names and optional Values. The user can then select one of the items. If the ComboBox Is Editable is enabled then the user can also type any value. If Values are specified then the Value will be assigned to the setting value rather than the Display Name. If the Value is blank then the Display Name will be assigned to the setting value.
For TreeView setting type you define a list of Items containing Display Names, Values and Parent Values. The display names are then arranged in a tree based on the Parent Values. The setting value will be assigned to the selected node's Value.
For Grid field types you define the columns in your grid. For each column you set the allowed type (String, Integer, Decimal, Date, Time, Boolean or Memo). You can also mark a column as a Field Combo. Columns marked as field combo will automatically show a drop down list of all ThinkAutomation variables when data is entered in that column.
For each string type column you can optionally also assign a list of Choices. Each choice should be separated by a | character. If Choices are specified then the column will show a drop down list. If the Choices entry starts with a | character then the grid column value can only be selected from the choices list - a different value cannot be typed. For Example: If the Choices is set to 'Red|Green|Blue' then the user can select from the list but also type in another value. If Choices is set to '|Red|Green|Blue' then the user can only select one of Red, Green or Blue. If the Choices value is set to '%variables%' then the choices will be automatically populated with all variable names used on the Automation.
This Input Field type can be used if your custom action code needs to access a web API that requires an OAuth 2.0 Authorization token. You must set the additional properties of Authorization Endpoint, Token Endpoint, Client ID, Client Secret & optional Scope, depending on the OAuth service you want to sign in to.
When the Action is used on an Automation and the ThinkAutomation Studio user clicks the Sign-In button, a web browser window will start the sign-in process and return an Authorization token. The Authorization token is assigned to the input field value. Which can then be used inside your action execution code. ThinkAutomation will refresh expired tokens automatically before your custom action executes (if your sign-in provides a refresh token).
Inside your action execution code when making HTTP requests to a web API you must add the 'Authorization' header and set the value to the setting value. For Example:
xxxxxxxxxx
string Authorization = settings.value("MySignInSettingName");
WebClient Client = New WebClient();
Client.Headers.Add("Authorization",Authorization)
You can also use the httpHelper class which simplifies http calls. See: Using The Http Helper Class
This Input Field type can be used if your custom action code needs to access the Microsoft Graph API. You must set the Scope depending on the resources you need to access. The User.Read & offline_access scopes are added automatically. The sign in uses the ThinkAutomation app clientid.
When the Action is used on an Automation and the ThinkAutomation Studio user clicks the Sign-In button, a web browser window will start the sign-in process and return an Authorization token. The Authorization token is assigned to the input field value. Which can then be used inside your action execution code. ThinkAutomation will refresh expired tokens automatically before your custom action executes.
Inside your action execution code when making HTTP requests to Microsoft Graph you must add the 'Authorization' header and set the value to the setting value.
You can also use the httpHelper class which simplifies http calls. See: Using The Http Helper Class
This Input Field type can be used if your custom action code needs to access the Google API. You must set the Scope depending on the resources you need to access. The sign in uses the ThinkAutomation app clientid. The Authorization token is assigned to the input field value.
This Input Field type can be used if your custom action code needs to access the Xero Accounts API. You must set the Scope depending on the resources you need to access. The accounting.contacts & offline_access scopes are added automatically. The sign in uses the ThinkAutomation app clientid. See: https://developer.xero.com for more information.
The input field value is assigned the Authorization token and the selected Xero Tenant ID in the following format:
xxxxxxxxxx
{
"Authorization": "xxx",
"Xero-Tenant-Id": "xxx"
}
Inside your action execution code when making HTTP requests to the Xero API you must add the 'Authorization' and 'Xero-Tenant-Id' HTTP headers.
If you use the httpHelper class to make calls to the Xero API, then both headers are added automatically. For example:
xxxxxxxxxx
Dim Http As New helpersHttp
' the Authorization & xero-tenent-id headers are set automatically
http.AuthorizationToken = settings.value("XeroSignInButton")
http.URL = "https://api.xero.com/api.xro/2.0/Contacts/" & _
settings.value("ContactID") & "/History"
Return http.SendRequest
The Label is the text that should appear next to the setting. The Label Position can be set to the Left or Top of the setting input. The Label Group Name is optional and allows you to group settings on the settings form. All settings with the same Group Name will appear together in a bordered group.
The Execution Code pane is used to create the C# or Visual Basic .NET code that will execute when the custom action is executed for an Automation by the Message Processor. You should decide on the language (C# or Visual Basic .NET) before you start coding, since changing it will reset the code. Each separate custom action can use either language.
When ThinkAutomation executes the custom action it calls the execute method. This is the entry point to your execution code. You should not change the execute method name or parameters. Inside your code you can add any number of additional methods. The execute method returns a string value. The returned value will be assigned to the Assign Return Value To variable.
Custom action code is compiled by ThinkAutomation when it is executed for the first time. Therefore, once custom actions have executed once they will operate as fast as built-in actions.
You can access the current message being processed, access or update existing Automation variables and add to the Automation log in the same way as the Execute Script action.
Inside your code you can access the Settings Input Field values using:
xxxxxxxxxx
string SomeSetting = settings.value("settingname");
Where settingname is the Setting Name. You can also simply drag a setting onto the code editor to create.
All setting values are strings. So for a Numeric Integer setting it would still be returned as a string. A CheckBox value will either be 'true' or 'false'.
All settings values will have already been 'replaced'. This means that if the user had used any %variable% replacement(s) within the setting value - each will have been replaced with actual values before your code executes.
Setting Input Fields that are defined as Grid input types are accessed by row/column values. You can access the number of rows and the value at each row/column. For example:
The settings.tableDataRows("settingname")
returns the number of rows entered in the grid setting called 'settingname'. Eg:
xxxxxxxxxx
int Rows = settings.tableDataRows("GridSetting");
The settings.tableDataRowColumnValue("settingname" , row, col)
returns the grid value for a specific row & column (row & column are zero based). Eg:
xxxxxxxxxx
string Value = settings.tableDataRowColumnValue("GridSetting", 0 , 2);
Scripts can reference other .NET Framework assemblies compatible with .NET Framework 4.7 or higher. Use the References tab to add additional references. You can add any of the .NET framework System assemblies. Any other .NET referenced assembly must be located in the ThinkAutomation program files folder (unless you use a NuGet package - see below).
You can also add NuGet packages to scripts. Click the NuGet Packages button to open the NuGet Package Manager. Enter a search term and click the search button to view available packages. Select a package and click the Add Reference button to download & install the package. A reference to the package (and any dependencies) will be added to your script. See: https://www.nuget.org for more information.
Click the Check button to validate that the code compiles and executes successfully.
To assist with script development you can add data to the Output window using message.DebugPrint
:
xxxxxxxxxx
message.DebugPrint("test");
Any calls to message.DebugPrint will show in the Output window in the script editor when the Check button is used, and are ignored when the script executes during Automation execution.
You can use Microsoft Visual Studio to develop & debug your custom action code. When development is complete you can then copy/paste the code into the Custom Action code editor.
Start a new Visual Studio console application protect. Set it use use .NET Framework 4.7 or 4.8.
Add a Reference to ThinkAutomationCoreClasses.dll (located in the \Program Files\ThinkAutomation.NET\ folder) and any other references your script code will use.
Example (Visual Basic):
xxxxxxxxxx
Imports ThinkAutomationCoreClasses.ThinkAutomation
Imports ThinkAutomationCoreClasses.Scripting
Module Module1
Sub Main()
' create some test settings
Dim TestSettings As New actionSettings
TestSettings.Add("firstname", "John")
TestSettings.Add("lastname", "Smith")
' create a blank incoming message
Dim Solution As New clsSolution
Dim MessageSource As New clsMessageSource
Dim Automation As New clsAutomation
MessageSource.SetSolution(Solution)
Automation.SetSolution(Solution)
Dim IncomingMessage As New clsMessage(MessageSource, Automation)
' If you want to create a message with a body/subject etc use 'Mime' property
' IncomingMessage.Mime = [full mime text]
Dim Message As New currentMessage(IncomingMessage)
Dim MyAction As New ThinkAutomationScript
Console.WriteLine(MyAction.execute(TestSettings, Message))
Console.ReadLine()
End Sub
End Module
Public Class ThinkAutomationScript
Public Function execute(ByVal settings As actionSettings, message As currentMessage) As String
Try
' Action execution code
' Get custom action settings using settings.value("settingname")
' Get extracted fields/variable values using message.GetValue("name")
' Set extracted fields/variable values using message.SetValue("name","value")
Dim FullName As String = settings.value("firstname") & " " & settings.value("lastname")
Return FullName
Catch e As Exception
' Pass the error back to the automation log
message.AddErrorToLog(e.Message)
Return ""
End Try
End Function
End Class
First we need to create some settings to pass to the execute method. The setting names should match your Setting Input Fields. You then need to create a blank message to pass to the execute method.
You can the run & debug the execute method.
When you have completed development select the Public Class ThinkAutomationScript
code and paste it into the Custom Action code editor (replacing the existing ThinkAutomationScript code block).
When making http requests inside your execution code you can make use of the built-in helpersHttp class. This helper class simplifies making http GET, POST, PUT & DELETE requests. It also honors any proxy settings defined in your ThinkAutomation Server Settings.
Simple Get Request:
xxxxxxxxxx
Dim Http As New helpersHttp
' set the Url
http.URL = "https://graph.microsoft.com/v1.0/users/" & settings.value("Email")
' set the OAuth token if required.
http.AuthorizationToken = settings.value("SignIn")
' send the request
Dim Json As String = Http.SendRequest
If Json.Length = 0 Then
' if nothing returned then check the http status
message.AddErrorToLog(http.LastStatus.ToString & " " & http.LastError)
End If
Post Request
xxxxxxxxxx
Dim Http As New helpersHttp
' set the Url
http.URL = "https://graph.microsoft.com/v1.0/me/messages/abcd1234/move"
' set the Verb to GET (default), POST, DELETE or PUT
http.Verb = "POST"
' add any additional headers using AddHeader
http.Addheader("header","somevalue")
' add any additional querystring parameters if required
http.AddQueryStringParameter("param",settings.value("settingname"))
' set the OAuth token if required.
http.AuthorizationToken = settings.value("SignIn")
' set the content-type
http.ContentType = "application/json"
' set the post body
http.PostBody = "{""desinationid"": ""defgh67890""}"
' send the request
Dim Json As String = Http.SendRequest
If Json.Length = 0 Then
' if nothing returned then check the http status
message.AddErrorToLog(http.LastStatus.ToString & " " & http.LastError)
End If
The Settings Form Code pane is used to create C# or Visual Basic .NET code that will be executed by the ThinkAutomation Studio when your custom action is used on an Automation. Changing this code is optional and is only required if you need to fine-tune the settings form functionality within the Studio. The Settings Form Code does not affect Automation execution.
The default code contains 3 methods - Loaded, EditValueChanged & Saved. You can add code inside these methods (do not change the method names or parameters). You can add additional methods of your own that can be called from these methods, and you can add additional .NET References, or NuGet packages if required.
Loaded is called when the settings form initially loads. You can set default values for settings and show/hide or enable/disable individual settings.
To set a default value for a setting, use:
xxxxxxxxxx
settings.SetDefaultValue("settingname","initial value")
Where settingname is the name of one of your Settings Input Fields. All values are set as strings. For CheckBox type inputs you should set to 'true' or 'false. For Date inputs the date should be in yyyy-MM-dd HH:mm:ss format.
For Date inputs you can set the initial value to 'today', 'yesterday' or 'tomorrow' to have it default to todays date (or yesterday, tomorrow).
To hide a setting or mark as disabled, use:
xxxxxxxxxx
settings.Hide("settingname") ' hides a setting
settings.Disable("settingname") ' disables a setting
settings.UnHide("settingname") ' show a previously hidden setting
settings.Enable("settingname") ' enable a previosly disabled setting
Grid settings can include columns that contain drop down selectors. You can set the default values contained in the drop down selector. To set the default values for any Choices column drop down lists use:
xxxxxxxxxx
Dim values As New List(Of String)
values.Add("Value1")
values.Add("Value2")
Dim editable As Boolean = True
settings.SetDefaultGridColumnChoices("gridsettingname","columnname",editable,values)
Where settingname is the name of one of your Grid type setting, columnname is the name of the column in the grid. The editable parameter is a Boolean. Set to True if the user can also type another value (and not be restricted to the list of choices). The values parameter is a List(Of String) - containing a list of possible values for that column.
EditValueChanged is called when a setting value is changed by the user. You can use this to set values for other settings or to show/hide, enable/disable other settings. The changed setting name is passed in the SettingName parameter.
You can access the current value for any setting input field using settings.GetValue("settingname")
.
For Example:
xxxxxxxxxx
Public Sub EditValueChanged(ByVal settings As customActionDesignerSettings, ByVal SettingName As String)
If SettingName = "PostToURL" Then
Dim CurrentValue As String = settings.GetValue("PostToURL")
If CurrentValue = "true" Then
settings.UnHide("URL")
Else
settings.Hide("URL")
End If
End If
End Sub
You can set a setting value using settings.SetValue("settingname","value")
.
Button Input Type
For the Button input type the EditValueChanged will be called when the button is clicked. The button setting name will be passed in the SettingName parameter. You can use this to execute custom code on button clicks.
Setting ComboBox & ListBox Setting Values
ComboBox and ListBox input types are set as a list of Display Name/Value pairs. You can either set the currently selected item or replace all ComboBox/ListBox items.
To set the currently selected item in a ComboBox/ListBox setting, simply set its value, for example:
xxxxxxxxxx
settings.SetValue("ListBoxSetting","value2")
Will set the ListBox with setting name 'ListBoxSetting' to the item with value 'value2'.
To replace all items in a ComboxBox or ListBox use:
xxxxxxxxxx
Dim ListItems As New List(Of String) ' create a List(Of String)
ListItems.Add("List item 1|value1") ' Add items. Separate Display Name & Value with |
ListItems.Add("List item 2|value2")
ListItems.Add("List item 3|value3")
' Use SetValue and pass settings.KeyValuePairs(List)
settings.SetValue("ListBoxSetting",settings.KeyValuePairs(ListItems))
' You can also set the currently selected item when building a ComboBox/ListBox
settings.SetValue("ListBoxSetting",settings.KeyValuePairs(ListItems,"value2"))
When using ComboBox/ListBox input types, the settings.GetValue("settingname")
will return the currently selected value.
To get the currently selected DisplayName use settings.GetDisplayName("settingname")
.
Setting Grid Choices Column Values
Grid settings can include columns that contain drop down selectors. You can set the values contained in the drop down selector using:
xxxxxxxxxx
Dim Choices As New List(Of String) ' create a List(Of String)
Choices.Add("Choice 1") ' populate the list with available choices
Choices.Add("Choice 2")
Choices.Add("Choice 3")
' Use SetValue and pass settings.GridColumnValues('ColumnName',IsEditable,ChoicesList)
settings.SetValue("GridSettingName",settings.GridColumnValues("Choices Col",False,Choices))
Getting Grid Row & Column Values
You can access the current row/column value for a grid setting using: settings.GetGridRowColumnValue("settingname", Row, Column)
Row & Column are zero based. To get the number of rows use: settings.GetGridRows("settingname")
OAuth SignIn Buttons
The EditValueChanged method will be called when the OAuth or Microsoft Graph/Google sign in has completed. The value of the setting will contain the Authorization token. You can then use the helpersHttp class to retrieve data and populate other settings. For example:
xxxxxxxxxx
Imports System
Imports System.Text
Imports System.Collections.Generic
Imports ThinkAutomationCoreClasses.Scripting
Imports Newtonsoft.Json
Public Class ThinkAutomationCustomAction
Public Sub EditValueChanged(ByVal settings As customActionDesignerSettings, ByVal SettingName As String)
Try
Select Case SettingName
Case "SignInButton"
' populate ListBoxUsers
' the SignIn value will contain the OAuth token if we have signed in.
Dim Token As String = settings.GetValue("SignInButton")
If Token.Length > 0 Then
Dim SelectedId As String = settings.GetValue("ListBoxUsers")
Dim Items As New List(Of String)
Dim http As New helpersHttp
Dim Url As String = "https://graph.microsoft.com/v1.0/users?$select=displayName,id,userPrincipalName"
http.AuthorizationToken = Token
Do
http.URL = Url
Dim Json As String = http.SendRequest
If http.LastStatusSuccess Then
Dim ThisUsersList As Users = JsonConvert.DeserializeObject(Of Users)(Json)
Dim ThisUser As User
For Each ThisUser In ThisUsersList.Value
Items.Add($"{ThisUser.displayName} ({ThisUser.userPrincipalName})|{ThisUser.id}")
Next
Url = ThisUsersList.NextLink
Else
settings.MessageBoxError = http.LastError
Url = ""
End If
Loop Until String.IsNullOrEmpty(Url)
settings.SetValue("ListBoxUsers",settings.KeyValuePairs(Items,SelectedId))
settings.SetValue("LabelUserCount",Items.Count.ToString & " Users")
End If
Case "ListBoxUsers"
settings.SetValue("LabelSelectedUserName",settings.GetDisplayName("Users"))
End Select
Catch e As Exception
settings.MessageBoxError = e.Message
End Try
End Sub
Private Class Users
<JsonProperty("@odata.nextLink")>
Public Property NextLink As String
Public Property Value As List(Of User)
End Class
Private Class User
Public Property id As String
Public Property displayName As String
Public Property userPrincipalName As String
End Class
End Class
Saved is called when the form is saved. You can use this to perform additional validation and to prevent the user saving the action.
By default the Saved method returns a blank string. If you want to prevent the settings form from being saved, return a string value. The returned string will be shown to the user in a message box. For example:
xxxxxxxxxx
If settings.GetValue("PostToURL") = "true" And settings.GetValue("URL") = "" Then
Return "You must specify the URL if the Post To URL is enabled."
Else
Return ""
End If
This setting is used to define the text that appears in the Automation Action List. By default it will show the Class Description. You can add additional text - and include setting names. The template is in the following format:
xxxxxxxxxx
Text {1:%SettingName1%} text {2:Text %SettingName2%} {a:Assign To %Setting3%}
Where 'text' is any text. Any %settingname% enclosed in % will be replaced with the setting value. If you enclose text with {} you can set its color. Eg: {1:%name%} will show the value of the %name% setting in color 1. There are 3 colors and an 'assign to' color. You can show a setting in the 'assign to' color using {a:%assignto%}.
These optional settings are stored with the Custom Action. The help text will show in the Action Properties page Help tab, when the custom action is used on an Automation. Help text can contain Markdown.
Custom Actions will not appear in the Actions toolbox until marked as 'Published'. This enables you to work on a custom action before it is available to use on your Automations. To mark as published, click the Publish button and then click Save to save the custom action. The custom action will then show in the Actions toolbox when designing your Automations. You can drag it to the Actions list and use it like any other action.
ThinkAutomation checks that the custom action code compiles successfully before you can publish it.
You can share your custom action with other ThinkAutomation users once it is marked as 'Published'. Click the Share button to enable sharing. The custom action will then be uploaded to the online library each time it is saved. Other ThinkAutomation users will then see it in the Online Actions Explorer and can add it to their own custom actions.
Your custom action will not be visible to other users until Parker Software has verified it.
You can use the Studio to export a Solution that can then be used on another ThinkAutomation Server instance.
On the ThinkAutomation Studio ribbon, select the Explorer tab. Select the Solution to deploy from the Solution selector. You can choose to export the Solution to a package file, or deploy the Solution to another server. Click the Deploy Solution button.
You can export a Solution to a ThinkAutomation Solution Package File. The Solution can then be imported into another ThinkAutomation instance. The solution package file will contain all Message Sources & Automations for the Solution along with any Custom Actions that any of the Automations in the Solution use.
Previously exported Solution files can be imported using the ThinkAutomation Studio - File menu - Import Solution. When a Solution is imported its Message Sources will be marked as disabled so that processing does not start immediately after import. Mark the Message Sources as enabled when you are ready to begin processing.
Solution package files are encrypted and cannot be read outside the ThinkAutomation Studio, so package files are safe to be sent by email.
This option can be used to directly deploy a Solution to another ThinkAutomation instance. All Message Sources, Automations and any Custom Actions will be saved to the other server. This option is useful if you have different development and production ThinkAutomation instances. You can develop and test your Solution on the development machine and they deploy it to another instance when ready.
You must specify the ThinkAutomation Server, Username and Password of the ThinkAutomation instance you want to deploy to. The Server address can be the IP address or computer name.
If the Enable Message Sources Once Deployed option is enabled then any Message Sources will be marked as enabled and processing will start. Otherwise the Message Sources must be manually enabled using the Studio.
Click the Deploy button to start. If the Solution already exists on the target instance then it will be updated, otherwise a new Solution will be created.
For Message Sources that uses OAUTH authentication (Office 365, Gmail etc) the authentication information will also be sent. This differs from the Package File option which does not save authentication - so users must re-authenticate after importing.
Messages can be posted to ThinkAutomation via local HTTP GET or POST requests. Messages posted via the API will trigger an Automation to execute. Each of your configured Message Sources has a unique local API URL in the form:
https://localhost:9898/addmessage?taid={id}
or
http://localhost:9899/addmessage?taid={id}
You can add a Friendly Path to change the above URL to a unique path, eg:
https://localhost:9898/mycompany/customers/add
By default the ThinkAutomation Server accepts local API requests from local IP addresses only. You can add additional IP addresses to the Whitelist using the ThinkAutomation Server Settings.
You can change the port numbers for the HTTPS and HTTP interfaces using the ThinkAutomation Server Settings.
Any message posted to, or requested from, this URL will be passed to the ThinkAutomation server for immediate processing. Messages will be processed by the default Automation configured for the Message Source. There is no limit to the number of messages that can be posted to the local API. Messages can be sent to ThinkAutomation via the API regardless of the configured Message Source type.
The local API is designed to receive HTTP requests from your internal network only. It is not designed to be publicly accessible from the Internet. Whilst it is technically possible to expose the ThinkAutomation local API interface to the Internet, this is not recommended. To allow your ThinkAutomation Server to receive messages via public endpoints use the Web API instead. The Web API tunnel enables your ThinkAutomation Server to receive secure public HTTP requests whilst not being publicly accessibly itself.
The HTTPS interface for the local API uses a self-signed certificate by default. You can select a certificate in the Server Settings - Clients tab.
The local API accepts HTTP GET requests. You can specify the message content as part of the URL. Whenever the URL is requested a new ThinkAutomation message will be created.
The body, subject, from & to addresses can be specified on the query string:
xxxxxxxxxx
https://localhost:9898/addmessage?taid=5f7b421a6e1f408c38488397179
&from=alice%40test.com
&subject=unsubscribe
&body=testmessage
The body, subject, from and to query string parameters are optional.
You can also pass specific field values using x-parametername=value
. In this case the message passed to ThinkAutomation will be in Json format with each field value (excluding the 'x-').
For example:
xxxxxxxxxx
https://localhost:9898/addmessage?taid=5f7b421a6e1f408c38488397179
&from=alice%40test.com
&subject=unsubscribe
&x-name=Alice+Bamber
&x-email=alice%40test.com
The message body which would be sent to ThinkAutomation as:
xxxxxxxxxx
{
"name": "Alice Bamber",
"email": "alice@test.com"
}
If you do not want to use field=value pairs you can pass the raw body text using the &body=
query string parameter. The ThinkAutomation message body will be set to the contents of the body parameter with no conversion.
The local API accepts x-www-form-urlencoded, form-data, and raw post data formats.
For raw posts the post data can be set to the mime text of an email message. If mime text is not sent the ThinkAutomation Server will convert the message to mime text using the post data as the plain text message body.
Example:
Add Message local API URL:
xxxxxxxxxx
https://localhost:9898/addmessage?taid=5f9ab14c6e1f405c7cbf955c
Post Data:
xxxxxxxxxx
MIME-Version: 1.0
To: test@test.com
From: test@mycompany.com
Subject: Test Message
This is a test message
This would send a message to the Message Source with the above local URL. The Message would be processed by the default Automation configured for the Message Source.
This is the default for web form submissions. The Message Body passed to ThinkAutomation will be Json text with each field value. For example, suppose you post a web form with 2 fields Name=Test Name, Age=20
, the message passed to ThinkAutomation will have the body:
xxxxxxxxxx
{
"Name": "Test",
"Age": "20"
}
The from, to & subject can either be passed as post fields or as parameters on the URL query string.
For each GET or POST the Local API will respond with a HTTP 202 Accepted status along with a Json response:
xxxxxxxxxx
{
"Success": true,
"Cached": true,
"ErrorMessage": "",
"MessageResultDetail": null
}
Success will be true if the message was accepted, otherwise false and ErrorMessage will contain the reason.
Cached will always be true when using the local API.
If many messages are added in a short time period via the local API and the process queue becomes full a 503 status will be returned. You should check for a 503 status and retry.
By default the local API POST and GET requests will respond with a 202 Accepted response as soon as the message has been queued (unless a &redirect parameter is specified). You can optionally wait for the Automation results by adding &wait=true to the URL. If the &wait=true parameter is used then the HTTP response will be sent back when the Automation has completed for the message (with a 200 OK response status). The response will include the Automation Return Value in the MessageResultDetail.
Example response if &wait=true parameter is used:
xxxxxxxxxx
{
"Success": true,
"Cached": false,
"ErrorMessage": "",
"MessageResultDetail": {
"MessageStoreId": "5f9befaf6e1f4065a89a5d9e",
"MessageSourceId": "5f9ab14c6e1f405c7cbf955c",
"IncomingUid": "dff8ad81-7ec2-4cc6-a288-975f7134ff85",
"AutomationId": "5f86c3076e1f402260ea4bec",
"AutomationSuccess": true,
"AutomationError": "",
"AutomationReturnValue": "Hello World",
"AutomationLog": null,
"ExecutionTime": 23
}
}
You can choose to return the Automation Return value only by adding &results=true parameter to the URL instead of &wait=true. If the &results=true parameter is used then only the Automation Return Value content (or an error message) will be returned instead of the full Json response (shown above). Depending on the content of the Automation Return value text, the result will be served as plain text (text/plain), HTML (text/html) or Json (application/json). If the Return Value contains Markdown text it will be converted to HTML first. If the Return Value is already HTML it will be returned as HTML. If the Return Value is Json it will be returned as Json.
If the &results=true parameter is used and the Automation Return value is a single local file path (or a variable containing a file path) then the file content will be read and returned. You can return whole html pages, images, PDF files etc. The response Content-Type will be set according to the file extension.
If you are using the Embedded Files Store action to save files to the Embedded Files Store database, you can return file content directly from the Embedded File Store. Use the Embedded Files Store action with the Get Info operation. Assign the results of the Get Info operation to your Automation Return value. The ThinkAutomation Server will then read the file content directly from the database and return the content.
By default the ThinkAutomation Server only accepts HTTP requests from local IP addresses for the local API. You can add additional hosts to the Whitelist using the Server Settings.
Note: You should not make the local API public/internet facing. If you need to accept web forms, HTTP requests from the internet you should use the Web API or host your own ThinkAutomation Gateway Server. The Web API Gateway provides a secure proxy between public requests and your ThinkAutomation Server - preventing any malicious activity from affecting your ThinkAutomation server.
The samples below show HTTP POST and GET against the local API. To use the public Web API replace the local URL (https://localhost:9898/addmessage?taid=xxx) with the public URL.
C# Post
xxxxxxxxxx
public void SendMessage()
{
using (HttpClient client = new HttpClient())
{
var values = new Dictionary<string, string>()
{
{"name","Alice Bamber"},
{"email","alice@test.com"},
{"subject","unsubscribe"},
{"from","alice@test.com"}
};
var content = new FormUrlEncodedContent(values);
var response = client.PostAsync("https://localhost:9898/addmessage?taid=5fcf74b96e1f4068c0f1b5c7", content).Result;
Console.WriteLine(response.Content.ReadAsStringAsync.Result);
}
}
C# Get
xxxxxxxxxx
private void SendMessageUsingGet()
{
using (HttpClient client = new HttpClient())
{
string URL = "https://localhost:9898/addmessage?taid=5fcf74b96e1f4068c0f1b5c7" +
"&from=" + HttpUtility.UrlEncode("alice@test.com") +
"&subject=" + HttpUtility.UrlEncode("unsucscribe") +
"&x-name=" + HttpUtility.UrlEncode("Alice Bamber") +
"&x-email=" + HttpUtility.UrlEncode("alice@test.com");
var result = client.GetAsync(URL).Result;
Console.WriteLine(result.StatusCode);
}
}
Visual Basic .NET Post
xxxxxxxxxx
Public Sub SendMessage()
Using client As New HttpClient
Dim values = New Dictionary(Of String, String) From {
{"name", "Alice Bamber"}
{"email", "alice@test.com"},
{"subject", "unsubscribe"},
{"from", "alice@test.com"}
}
Dim content = New FormUrlEncodedContent(values)
Dim response = client.PostAsync("https://localhost:9898/addmessage?taid=5fcf74b96e1f4068c0f1b5c7", content).Result
Console.WriteLine(response.Content.ReadAsStringAsync.Result)
End Using
End Sub
Visual Basic .NET Get
xxxxxxxxxx
Private Sub SendMessageUsingGet()
Using client As New HttpClient
Dim URL As String = "https://localhost:9898/addmessage?taid=5fcf74b96e1f4068c0f1b5c7" & _
"&from=" & HttpUtility.UrlEncode("alice@test.com") & _
"&subject=" & HttpUtility.UrlEncode("unsucscribe") & _
"&x-name=" & HttpUtility.UrlEncode("Alice Bamber") & _
"&x-email=" & HttpUtility.UrlEncode("alice@test.com")
Dim result = client.GetAsync(URL).Result
Console.WriteLine(result.StatusCode)
End Using
End Sub
By default the addmessage
GET or POST will execute the default Automation assigned to the given Message Source. You can explicitly set the Automation to execute by adding &automationid={id}
to the GET or POST query string. Automation Id's are shown on the Automation View Properties tab.
Any Web Form Message Sources can also be viewed and posted locally. The web form is served directly from the ThinkAutomation server - bypassing the Public API.
You can view the Local Form URL on the Message Source properties. The format of the URL is:
http://{serveraddress}:9899/form?taid={messagesourceid}
or
https://{serveraddress}:9898/form?taid={messagesourceid}
By default the ThinkAutomation Server accepts local API requests from local IP addresses only. You can add additional IP addresses to the Whitelist using the ThinkAutomation Server Settings.
You can change the port numbers for the HTTPS and HTTP interfaces using the ThinkAutomation Server Settings.
The secure URL (https) will display an certificate warning message in the web browser because the ThinkAutomation Server uses a self-signed certificate by default. You can add a trusted certificate using the ThinkAutomation Server Settings - Clients tab to avoid this warning.
You can use the local http interface to view the ThinkAutomation Server status.
Use a web browser to view the address:
http://localhost:9899 or https://localhost:9898
This will display a web page showing server status, along with messages processed, queued and error counts for each Message Source and Automation.
You can request the status in Json format, by requesting the page:
http://localhost:9899/status.json or https://localhost:9898/status.json
The local API HTTPS interface uses a self-signed certificate by default. Most browsers will display a certificate warning. This can be ignored. The connection is still secure. You can add a trusted certificate using the Server Settings.
The ThinkAutomation Server provides a local HTTP REST API for accessing the Message Store. This can be used to integrate message store views with your own applications or to create custom front-ends to the ThinkAutomation message store using any development platform. The Message Store REST API can also be used to update and search the Embedded Knowledge Store.
See: ThinkAutomation Message Store REST API for details.
ThinkAutomation provides a public Web API that acts as a secure tunnel between web resources and your on-premises or self-hosted ThinkAutomation instance. When your ThinkAutomation Server starts, it makes a secure outbound connection to the ThinkAutomation Web API Gateway server. This allows your ThinkAutomation Server to receive public HTTP requests without being publicly accessible itself. Since your ThinkAutomation server makes an outbound connection to the Gateway server you do not need to open any incoming firewall ports and you do not need a static IP address.
The Web API is used for the following:
Type | Details |
---|---|
Web Form Message Sources | For creating publicly accessible web forms that connect to your Automations. |
API Message Sources | For executing Automations via public HTTP GET or POST endpoints. |
Teams Message Sources | For receiving messages from Microsoft Teams users. |
Web Forms - Custom | For posting your own web forms directly to ThinkAutomation for processing. |
Web Get Requests | For triggering Automations from simple HTTP Get requests and optionally returning the Automation Return value. |
Twilio Actions | For making calls or sending/receiving SMS messages via Twilio. |
Wait For User Response Action | For requesting additional information from users during Automation execution. |
Web For Webhook Action | For integrating with 3rd party web API's that offer webhook callbacks. |
Other web based integrations | For example posting messages to your ThinkAutomation instance via HTTP POSTS or GETS for your own or 3rd party webhooks. |
The Web API Gateway server does not hold any of your settings, or keep copies of messages it has forwarded to your ThinkAutomation Server - it simply acts as a secure tunnel between your unique public URL's and your ThinkAutomation Server.
You can disable the Web API in your ThinkAutomation Server Settings. Your ThinkAutomation Server will then not make any connection to the Web API Server - however the operations above cannot then be used.
The Web Form Message Source Type enables you to create a publicly accessible web form with multiple input fields. The web form has a unique secure public URL hosted on the ThinkAutomation Web API. You can embed the web form inside your own website or send a link to the form in outgoing emails. When a web user completes the form, the results are sent to your ThinkAutomation Server for immediate processing. The Web Form can optionally display the Automation return value after the form is submitted. See: Message Source Types - Web Form
The Web API can accept HTTP POST requests from your own web forms. Simply set the form action to the Web API URL shown on the Message Source properties.
Messages can be also posted to ThinkAutomation via the Web API using HTTP GET or POST requests. Each of your configured Message Sources has a unique public endpoint URL. The URL contains a secure hash of your ThinkAutomation instance and Message Source Id. Any message posted to this endpoint will be passed to your ThinkAutomation server for immediate processing. Messages will be processed by the default Automation configured for the Message Source. If your ThinkAutomation server is not active when a message is posted then the message will be queued for up 48 hours.
The Web API enables you to send messages to ThinkAutomation from any location.
You send messages to ThinkAutomation using HTTP POST or GET requests to the public Message Source URL. HTTP POST & GET requests are sent in the same way as the local API - but with the public URL instead of the local URL.
The Web API accepts x-www-form-urlencoded, form-data, and raw post data formats as the local API.
The Web API will respond with a HTTP 202 Accepted response status along with a Json response:
xxxxxxxxxx
{
"Success": true,
"Cached": false,
"ErrorMessage": "",
"MessageResultDetail": null
}
Success will be true if the message was accepted, otherwise false and ErrorMessage will contain the reason.
Cached will be true if your ThinkAutomation Server was not active when the message was added. The Message will be cached for up to 48 hours and sent to your ThinkAutomation Server when it becomes active.
If you are not waiting for Automation results and your calling API requires a 200 response status instead of 202 you can add &responsestatus=200 or &responsestatus=201 querystring parameter to your GET or POST request.
By default Web API POST and GET requests will respond with a 202 Accepted status as soon as the message has been queued (unless a &redirect parameter is specified). You can optionally wait for the Automation results by adding a &wait=true query string parameter to the URL. If the &wait=true parameter is used then the HTTP response will be sent back when the Automation has completed for the message (with a 200 OK status). The response will include the Automation Return Value in the MessageResultDetail.
Example response if &wait=true parameter is used:
xxxxxxxxxx
{
"Success": true,
"Cached": false,
"ErrorMessage": "",
"MessageResultDetail": {
"MessageStoreId": "5f9befaf6e1f4065a89a5d9e",
"MessageSourceId": "5f9ab14c6e1f405c7cbf955c",
"IncomingUid": "dff8ad81-7ec2-4cc6-a288-975f7134ff85",
"AutomationId": "5f86c3076e1f402260ea4bec",
"AutomationSuccess": true,
"AutomationError": "",
"AutomationReturnValue": "Hello World",
"AutomationLog": null,
"ExecutionTime": 23
}
}
You can choose to return the Automation Return value only by adding &results=true query string parameter to the URL. If the &results=true parameter is used then only the Automation Return Value content (or an error message) will be returned instead of the full Json response (shown above), along with a 200 OK status. Depending on the content of the Automation Return value, the result will be served as plain text (text/plain), HTML (text/html) or Json (application/json). If the Return Value contains Markdown text it will be converted to HTML first. If the Return Value is already HTML it will be returned as HTML. If the Return Value is Json it will be returned as Json.
Depending on what your Automation is doing - the Web API POST or GET request may timeout before the Automation completes. The maximum wait time is 60 seconds. So for long running Automations (for example: if your Automation is uploading FTP files etc), then the &wait and &results parameters may not be applicable.
If the &results=true parameter is used and the Automation Return value is a single local file path (or a variable containing a file path) then the file content will be read and returned. You can return whole html pages, images, PDF files etc. The response Content-Type will be set according to the file extension.
If you are using the Embedded Files Store action to save files to the Embedded Files Store database, you can return file content directly from the Embedded File Store. Use the Embedded Files Store action with the Get Info operation. Assign the results of the Get Info operation to your Automation Return value. The ThinkAutomation Server will then read the file content directly from the database and return the content.
The Web API has a limit of 5mb for the content returned from an Automation.
If your Automation is long running, or you want to provide a static link to the Automation results that a user can access later, you can use the %Msg_ResultsUrl% variable. Your Automation could include this variable in an outgoing email. A user can click the link to view the Automation results at a later date. The %Msg_ResultsUrl% URL is unique for each processed message and contains a secure hash. The link will work for as long as the Message is stored in the Message Store.
By default the Web API accepts HTTP POST and GET requests from anywhere. To ensure requests can only be made from your own websites you can add one or more 'Allowed Origins'. For each Message Source you can specify a comma separated list of allowed URL's that can post to the Web API endpoint. If this entry is blank then the endpoint can be posted to from anywhere. Full URL's should be specified, eg: https://www.mysite.com
- without any path or page name. Allowed Origins can be edited via the Properties tab of the Message Source.
Each instance of ThinkAutomation includes free access to the Web API Gateway with daily limits of:
ThinkAutomation Edition | Web API Calls Per Day |
---|---|
Basic | 500 |
Standard | 1000 |
Professional | 5000 * |
* can be increased at additional cost if required or you can host your own instance (see below).
The daily usage count resets at midnight UTC.
Each message posted via the Web API is limited to 10mb in size.
The Professional Edition of ThinkAutomation allows you host you own instance of the API Gateway Server (for example: api.mycompany.com). This is a self-hosted instance of the ThinkAutomation Web API Gateway Server with no message limits. The Gateway Server can run on any Windows machine or cloud VM. Please contact us for more information.
Server-wide settings can be accessed using the File menu on the ThinkAutomation Studio ribbon. These settings affect the ThinkAutomation server.
Enter an Administrator Email Address. This will be used as the 'from' address for any server generated emails (error notifications etc.).
Enter any Default Recipients. This is the default email address to receive server generated emails (automation error notifications, daily summary emails, message source error notifications etc.). You can override this setting on a per-solution basis (the Contact Email on the Solution properties page).
If Send Automation Error Emails is enabled then the ThinkAutomation Server will send an email to the Default Recipients whenever an Automation fails with an error.
These settings control how ThinkAutomation sends outgoing emails. This should be configured if any of your Automations use the Send Email action.
You can send emails via:
SendGrid (Recommended)
Smart Host (An external SMTP Server)
Via SendGrid
You can use SendGrid to send outgoing emails. You must create a SendGrid account and specify your SendGrid API Key. SendGrid provides a reliable and fast option for sending outgoing emails. See: https://www.sendgrid.com.
Via Smart Host (SMTP)
You can use an external mail server to send outgoing emails. Specify the Outgoing SMTP Server IP address or DNS name, Port, Username & Password. Click the Outgoing SMTP Security option if your mail server requires STARTTLS or SSL specifically, or leave as 'Auto'. You can also use this option to send via cloud hosted email providers that provide an SMTP option (such as Office 365, Amazon SES).
To use Office 365 set the Send Emails Via option to Via Smart Host (SMTP) and set the SMTP settings to:
Outgoing SMTP Server: smtp.office365.com
Outgoing SMTP Security: STARTTLS
Outgoing SMTP Port: 587
Username: Your Office 365 Address (e.g. example@yourdomain.com)
Password: Your Office 365 password (or App Password)
You may need to create an 'App Password' to use Office 365 SMTP and use this instead of your regular user password.
If using Office 365 SMTP the 'from' address of your outgoing emails must be one of your email addresses assigned to the Office 365 account being used. Emails sent will show in the Office 365 Sent Items folder for the user.
Click the Send Test Email button to verify the outgoing email settings.
This setting determines the maximum number of outgoing emails that can be sent in a single batch. Some mail servers will limit the number of emails accepted from a single IP address per second, hour etc. You can reduce the queue size if your outgoing mail server imposes send limits. If the queue becomes full, ThinkAutomation will store the email in the Message Store database and add it to the queue later when the current queue is empty. A lower queue size will result in outgoing emails being sent more slowly. The queue is refreshed after 5 seconds. So if you set the queue size to 10 then a maximum of 10 emails will be sent every 5 seconds.
The Queue Size setting is not applicable if you are using SendGrid to send outgoing emails - since SendGrid's rate limits are already very high.
This tab shows the current Message Store configuration. The Message Store database will have been created when you first run ThinkAutomation.
Click Reconfigure to change the Message Store type. This will remove the current Message Store configuration settings and restart the ThinkAutomation Studio so that a new Message Store database can be created. Your existing Message Store database will be left unchanged. The new Message Store will contain no data. The ThinkAutomation Services will be stopped during this process.
Click the Copy button to make a copy of the current Message Store database. The Copy Message Store Wizard will be shown. Here you can select another database to copy the current Message Store records to. If the copy database does not exist it will be created. The copy database can be a different type. For example: Your current Message Store could be using SQL Server, and you can copy it to a SQLite, MySQL or PostgreSQL database.
The contents of the current Message Store database will then be copied to the selected database. This process may take some time for large Message Stores.
You can run the copy whilst the ThinkAutomation server is active. However, the copy may not contain all data if messages are processed during the copy. If you want to ensure the copy contains an exact copy of all processed messages, you should disable all of your Solutions first (or stop the ThinkAutomationMessageProcessor service during the copy).
If you want to change your Message Store database type and retain all of your existing data, you can use the Copy option to create a copy. Then use the Reconfigure option. You can then select the copy database as your new Message Store.
Run Message Store Database Maintenance At
Each day at the times specified the ThinkAutomation Server will delete processed messages according to the Keep Messages For (Days) setting on each of your Solutions. This process can take some time on a high usage ThinkAutomation implementation. If you are using a shared database server for your ThinkAutomation Message Store then you should select times when no other maintenance operations are being performed on the database. You should specify multiple times on high usage implementations to split up the delete operations.
Log Retention Maximum Days
This setting defines the maximum number of days that Automation & Message Source logs are retained for. Any log records older than this will be deleted during message store maintenance.
Disable Message Store Database Maintenance
You can disable the automatic deletion of Message Store messages for all Solutions by enabling this option.
Backup Solution Settings In Message Store
If this option is enabled then ThinkAutomation will automatically store copies of your Solutions (Message Source & Automation settings) in the Message Store database. These copies will be updated whenever any changes are made. This setting should not be enabled if your Message Store database is not secure - since someone without ThinkAutomation user access could potentially view settings data if they can access the database.
Restoring Solution Settings
Should your MetaData file (MetaData.db) become corrupt or lost, the ThinkAutomation server will attempt to restore your Solutions from the Message Store backup (if the above option is enabled). Ensure the ThinkAutomation Service is stopped. Remove the corrupted MetaData.db file from the \ProgramData\Parker Software\ThinkAutomation.NET\ folder. The restart the ThinkAutomation Server. If the server cannot find a MetaData.db file it will attempt a recovery from the Message Store database (if the Backup option was enabled).
You can assign a Flag to an incoming message in an Automation using the Set Message Store Flag action. When you view messages in the Message Store you can filter by Flag.
You can define any number of Flags. Each flag is given a Number, Description and Color.
The Message Processor Service Tasks setting defines the number of message processor tasks that the Message Processor Service starts.
By default the Message Processor Service starts 4 separate tasks for Automation processing. Each separate Automation is assigned to one of these tasks. This means that by default 4 Automations can process messages at the same time. If all tasks are processing then new messages will wait in a queue. Messages for each Automation are processed by their assigned task one at a time in the order that messages are received.
The higher this number, the more Automations can execute messages at the same time (at the expense of additional memory). See Also: Performance Tips - Concurrent Automation Processing.
You can create any number of Global Constants. These are %variables% that you can use on any Automation within any Solution.
You can specify any number of Constant Name and Constant Value pairs.
For example: If you create a global constant with name 'VatNumber' and value 'GB12345678'. If you use %VatNumber% on any Action property on any Automation, the value 'GB12345678' will be replaced when messages are processed.
This tab allows you to configure the port numbers and whitelist that the ThinkAutomation Server uses for client communication. Under normal circumstances you should not need to change the port numbers.
The Client Websocket Port is the port used by the ThinkAutomation Studio, ThinkAutomation Desktop Connector and Message Reader, Message Processor services to communicate with the ThinkAutomation Server. The default port is 9110.
The HTTPS/HTTP ports are the ports used by the local HTTP API. The default ports are 9899 (HTTP) and 9898 (HTTPS).
By default the HTTPS interface uses a self-signed SSL certificate. You can assign a trusted certificate if required.
The Whitelist IP Addresses entry should contain a list of IP addresses that the ThinkAutomation Server accepts incoming connections from. Separate multiple IP's using semi-colons. You can use wildcards (eg: 192.168.*). You can use the wildcard *.*.*.* to allow connections from anywhere.
Note: If you are using the Web API you do not need to whitelist public IP addresses. This is because your ThinkAutomation Server makes an outbound connection to the API Gateway Server. Your ThinkAutomation Server does not need to be exposed to the Internet itself.
If you want to use the ThinkAutomation Studio or Desktop Connector on remote computers, then the remote computer IP addresses must be added to the whitelist.
You can specify your default OpenAI API Key for use with the ChatGPT action. this will be used by default if no API key is specified on the ChatGPT action itself.
OptimaGPT is Parker Software's on-premises or private-cloud hosted AI server. This enables you to use the ChatGPT actions without sending private data to OpenAI. OptimaGPT must be installed and setup on a separate computer. Once configured, enable the OptimaGPT Enabled option and specify the OptimaGPT Local Server Address and OptimaGPT API Key. The ChatGPT action will then allow you to select to use OptimaGPT instead of OpenAI ChatGPT.
By default any login that ThinkAutomation makes to Microsoft Graph/Office 365 uses a multi-tenant app registration created by Parker Software. This provides ThinkAutomation users with a secure login without any additional configuration (Note: This does NOT give access to your data to any other organization, including Parker Software, it simply provides an authentication method for users to access their own data).
You can override this with your own App Registration. Using your own App Registration will allow longer periods between re-authentication.
You must create an App Registration in Azure before you can change these settings:
Open your Azure Portal.
Search for and select 'App Registrations'.
Click '+ New registration'.
Give it a name and select the account type (single, multi-tenant).
In the 'Redirect URI' you must add Platform: Web with http://localhost:3017
Click Register
Now select the new App Registration. Click the link against Client credentials to create a Secret Key.
IMPORTANT: Make a note of the new Secret Key Value (not Secret Id) before closing as you can only view this once. Secret keys can have a validity value of up to 2 years.
In ThinkAutomation enter your Client Id, Client Secret Value and optionally Tenant ID.
Any Office 365 logins will now use your own Client ID, Client Secret and Tenant ID instead of the default.
You can also provide your own App Registration details on a per-solution basis.
Enable this option to login using client credentials. You create the client-credentials in Azure. ThinkAutomation then authenticates using this - rather than asking for a user login.
To set up app-only access, follow the instructions above to create an App Registration.
You must now configure the permissions:
Under the application's API permissions page, choose Add a permission.
Select Microsoft Graph.
Select Application permissions.
In the Select Permissions dialog, choose the permissions required for ThinkAutomation. As a minimum you will need: User.ReadAll, Mail.ReadWrite.
You must then click the Grant admin consent button. This allows the selected permissions to be used.
See: Get access without a user - Microsoft Graph for more information.
When App-Only access is used, whenever you connect to Office 365 in ThinkAutomation you will be asked for the username to use (for example, the user to read emails for). However a login form will not be shown.
Note: Any existing Office 365 logins will need to be signed in again if you change these settings.
The ThinkAutomation Server can operate as a mail server to receive emails directly for processing. By default the SMTP Server is disabled.
You can create Message Sources to process emails received via the built-in mail server.
The Host Name Or IP Address entry should be set to the IP address/name that the SMTP server should listen on. By default this is 'localhost' and should not need to be changed. If your computer has multiple network interfaces you can force the SMTP Server to listen on a specific IP address.
The Listen On Port entry defines the port number. This defaults to 587. Ensure this port is open on your firewall if you want to receive inbound SMTP from other computers.
You can require incoming SMTP connections to authenticate with a Login Username and Password. This is optional.
Any email client or script can then be used to send email directly to ThinkAutomation for processing. The first Message Source with a matching SMTP Incoming Email 'To' address will receive the email.
You can test using PowerShell. For example:
xxxxxxxxxx
Send-MailMessage -From test@test.com -To messagesource1@localhost -Subject Test -Body Test -SmtpServer 127.0.0.1 -Port 587
or using C# code, for example:
xxxxxxxxxx
var smtpClient = new SmtpClient("127.0.0.1")
{
Port = 587
};
smtpClient.Send("email", "recipient", "subject", "body");
The ThinkAutomation SMTP Server supports the following ESMTP extensions: STARTTLS, SIZE, PIPELINING, 8BITMIME, AUTH PLAIN LOGIN
The SMTP Server will only accept incoming SMTP connections from IP addresses in the Whitelist. The Whitelist is configured on the Clients tab.
The ThinkAutomation SMTP Server is used to receive email for processing. It cannot be used to send outgoing emails (it does not act as a 'mail relay') and therefore cannot be used by malware to send spam.
ThinkAutomation allows messages to be sent for processing via the Web API. The Web API provides a secure public endpoint allowing messages to be posted to ThinkAutomation from Web Forms and your own or 3rd party solutions. The ThinkAutomation Server connects to the Web API Gateway server when it starts. Each of your Message Sources configured in ThinkAutomation will have a unique URL which you can post messages to.
You can disable the Web API for your ThinkAutomation Server if required. If the Web API is disabled you will not be able to use: Web Form Message Sources, Microsoft Teams Message Sources, Wait For User Response & Twilio Actions.
See: Using The Web API for more information.
By default, ThinkAutomation connects to 'api.thinkautomation.com', which is a shared API Gateway Server hosted by Parker Software. This works out-of-the-box and requires no setup but provides a restricted number of messages per day (5000 for the Pro edition, 1000 for Standard).
With the ThinkAutomation Professional Edition, you can also host your own instance of the ThinkAutomation API Gateway Server which would have no restrictions. For this you will need a Windows Server with a public IP address (or a virtual machine hosted in Microsoft Azure or any other cloud based provider) with its own DNS name and trusted SSL certificate. Contact us for details.
Once setup you would then enable the Use Own Gateway Instance option and enter your public DNS name in the Gateway Address option.
Parker Software can assist in setting up your own API Gateway Server. Contact us for details.
This tab allows you to configure users of the ThinkAutomation Studio and ThinkAutomation Desktop Connector. A default system administrator user will have been created during the setup. You can create additional users and set various rights for each user. You must have one user that is the System Administrator.
You can request a password reset for any user. Edit the user and enable the Requires Password Reset option and save the user. When the user next logs in using the ThinkAutomation Studio or Client they will be asked to change their password.
When you create a new user the Requires Password Reset option is automatically enabled. The new user must change their password after their first login.
The System Administrator user's password is also used to encrypt the Metadata database (held in the Metadata.db file). This contains all your Solutions, Message Source & Automation settings. If you reset the System Administrator user's password then the metadata database will be rebuilt using the new password.
If the Can Create/Edit Message Sources & Automations user right is disabled, the user will not be able to add or edit Message Sources or Automations using the Studio. The user can send new messages for processing.
If all User Rights are disabled for a user then the ThinkAutomation Studio can only be used to send messages to an Automation for processing and to view the results. No other options will be available for the user.
Limiting Access To Solutions
For non-administrator users you can restrict access to specific Solutions. When the user connects using the Studio or Client they will only see the Solutions they have been granted access to. Click the Solutions tab. Uncheck the Has Access To All Solutions option and enable/disable the Solutions that the user has access to.
ThinkAutomation can save changes made to your Automations allowing you to Revert to a previous version.
Enable the Store Automation Revisions option to enable (it is enabled by default). The Store Max Revisions setting defines the number of previous versions that are stored.
If you use the Translate, Detect Language or Speak Text actions then you need to create a Translation Account. Contact Parker Software to create a Translation Account or a free trial. Once you have created an account enter your Translation Account Username & Password.
You can also use the ChatGPT action or the Azure Translate action (available from the online Custom Actions library). This action allows you to use your own Azure credentials.
Set the default Logging level for Automations. The logging level controls the amount of detail recorded in the Automation log for each processed message.
The default logging level can be overridden using the Set Logging Level action inside individual Automations.
During Automation development you can set the level to 'Default' or 'Detailed'. Once your Automation is complete and working as intended it is recommended to set the logging level to 'Minimal'. This will improve performance and reduce the Message Store database size.
Any Comment actions that have the Show In Log option enabled will always be logged, regardless of the logging level.
For outgoing emails sent using the Send Email action you can use Markdown for the message text. Any Markdown will be automatically converted to HTML when the email is sent. A basic CSS stylesheet will be used for this conversion. You can edit the CSS using this tab. The Default CSS is also used with the Wrap HTML action when the Default style is selected.
Use this tab to specify your Proxy Server details if your ThinkAutomation computer uses a proxy server to connect to the Internet. Automation actions that make outbound connections will then attempt to use the proxy server properties specified.
Script Actions and Custom Action Scripts can include NuGet packages. You can configure the NuGet Package Sources. This is a list of URL's (one per line). The default package source is https://api.nuget.org/v3/index.json - which is the Microsoft NuGet package repository (see: https://www.nuget.org). If you have your own package repository you can replace the default or add it to the list.
If you use any of the Twilio actions (Twilio Make A Telephone Call, Twilio Send SMS Message etc.) then you must Enable Twilio Integration and enter your Twilio Account SID and Auth Token. These can be found in your Twilio Account Settings.
Enter the Default Twilio Caller Id. This is the default Twilio phone number that you have created in your Twilio account. This will be used as the sender 'from' number for the Twilio SMS Send SMS Message/Twilio Make A Telephone Call actions, if no specific From number is specified on these actions.
Send Usage Data
The ThinkAutomation Server will periodically (once per week) send usage information to Parker Software. This helps us to improve the product based on customer usage. Only the action Type Names that you are using across all your Automations are sent. No personal information or configuration settings are sent.
Automatically Check For Updates
If this option is enabled ThinkAutomation will automatically check for new updates once per week. A message will be shown in the ThinkAutomation Studio if an update is available. If the automatic check is disabled you can still manually check for updates using the Studio - File - Check For Updates option.
Include Pre-Release Updates
If this option is enabled then pre-release updates will be included in the Check For Updates. Pre-releases will include the latest fixes and changes which are ready to release unless significant bugs emerge.
The ThinkAutomation Server will automatically remove old processed messages from the Message Store database. The date at which a processed message is removed is defined by the Keep Messages For Days setting on the Solution properties (which defaults to 1095 days). This will affect messages processed by all Automations within the Solution.
Use the Edit Solution Properties button on the Ribbon to change this setting.
Set the Keep Messages For Days option to zero to disable automatic deletion.
The ThinkAutomation Server performs message store maintenance on a daily basis based on the times specified in the Server Settings - Message Store - Run Message Store Database Maintenance At setting. When Automations or Solutions are deleted via the Studio, ThinkAutomation marks the messages in the message store for deletion during the next maintenance run.
Messages in the Message Store provide an audit trial of messages processed. To maintain best performance you should only keep processed messages for a long as you need to.
For fast running Automations, or Automations that generate many log entries, you should add a Set Logging Level action to the start of your Automation, with the logging level set to 'minimal'. This will significantly increase performance and reduce the Message Store database size.
By default the Message Processor Service starts 4 separate tasks for Automation processing. Each separate Automation is assigned to one of these tasks. This means that by default 4 Automations can process messages at the same time. If all tasks are processing then new messages will wait in a queue. Messages for each Automation are processed by their assigned task one at a time in the order that messages are received.
You can increase the number of tasks that the Message Processor Service uses in the Server Settings - Message Processor.
Increasing the number of tasks may or may not provider better performance. It depends on how ThinkAutomation is used and the processor capacity available. If you have a small number of Automations that process many thousands of messages per day then increasing the number of tasks will in most cases not make any difference. If however you have many Automations processing a few hundred messages per day each at ad-hoc times (for example - Web Forms) then increasing the number as tasks will provide a faster response time during busy periods.
Increasing the number of tasks will also increase the memory usage of the Message Processor Service.
Individual Automation Concurrent Processing
Specific Automations can also be flagged to Allow Concurrent Execution (set on the Automation Properties tab). This setting defines if messages for the SAME Automation should execute concurrently. This option is disabled by default on new Automations. In most cases you should not need to enable this. If this option is enabled then messages for the same Automation may be processed in a different order than they were received. You should also ensure that your Automation is not updating anything that does not allow concurrent write access. For example: If your Automation updates an Excel file - if one or more messages are executing at the same time the Excel file may block access because it is already open.
Use a local (installed on the same computer as ThinkAutomation) SQL Server, MySQL, PostgreSQL or Mongo DB Message Store types for best performance. The built-in SQLite Message Store database may give better performance than a remote SQL Server database (depending on your configuration and existing database load).
The built-in SQLite database will provide adequate performance and requires no external database. The ThinkAutomation computer will use less memory overall compared to a locally installed external database. If you are processing ~1000 messages per day or less, then the built-in database will be suitable.
Only keep messages in your Message Store database for as long as you need to. The Keep Messages For (Days) entry on the Solution properties controls how long messages are stored. ThinkAutomation will automatically delete old messages each day. If you are processing many thousands of messages per day but do not remove old messages then your Message Store database will eventually become slower. Also remember that if you use the free version of SQL Server (SQL Server Express) - that this has a limit of 10gb per database.
If you use a shared remote database server for your ThinkAutomation Message Store then you should ensure that this database is available at all times. The ThinkAutomation server checks if the message store database is available every 30 seconds. If it is not available it will pause processing until the database comes back online.
If you need to repeatedly send a complex HTML email (eg: A marketing style email with many styles/images etc) you should prepare the HTML file beforehand and save it to a file. All CSS stylesheets should be converted to inline styles for maximum email client compatibility. Using the Send Email action, you have the option to Embed Images and Convert CSS To Inline Styles. However these operations are time consuming - and if you are using the Automation to send the same email many times it will be resource intensive. It will be faster to use the Use External File Or URL For HTML option to reference a local HTML file (not URL). The HTML in the file can still contain %variable% replacement markers.
Sometimes your Automation may execute too fast - for example if posting to an external API or hosted CRM that enforces rate limits. In these cases you can use the Sleep custom action (available in the Custom Action On-Line Library) to slow down the Automation. Place this action anywhere in your Automation.
The Get CRM Entity and Update CRM Entity actions can connect to Microsoft Dynamics (Online), Salesforce, Zoho CRM and Sugar CRM.
For other CRM systems, check if your CRM system provides a REST API. If so you can use the HTTP Get and HTTP Post actions to integrate directly. Alternatively there may be an ODBC driver available (see: ODBC Data Sources).
The Dynamics URL should be the Dynamics instance you are connecting to. Normally this would be:
https://{your_company}.crm4.dynamics.com
Select the Connection Method. This can either be Username/Password or OAuth. OAuth is the recommended connection method.
Username/Password
The Username would be your Dynamics/Office 365 username.
For the Password - this will either be your Dynamics/Office 365 password, or an 'app password' - depending on your security setup. App passwords are required if you have enabled two-factor authentication for the user you want to connect with. App passwords are generated via your Office 365 portal. See: How to manage app passwords - Azure Active Directory | Microsoft Docs
Note: It may take a few minutes before a new App Password can be used.
OAuth
Click the Sign In button to sign in to your Dynamics instance.
The built-in CRM actions do not support Dynamics On-Premises. We have created a custom action for reading/updating Microsoft Dynamics On-Premises. Search for 'Dynamics' in the Custom Action on-line library.
The Salesforce Host would normally be login.salesforce.com or login.database.com or region specific (eg: eu30.salesforce.com).
Specify your Username and Password.
The Security Token is an automatically generated key that is used for logging in to Salesforce from an untrusted network. To get your security token, login to SalesForce.com, go to Setup, and under "My Personal Information" click on Reset My Security Token. The security token will be delivered to the email address associated with your account.
See: Object Reference for Salesforce and Lightning Platform | Standard Objects for details of the standard Salesforce object types (Entities).
First select your Zoho Domain. For USA select Zoho.com. If your Zoho CRM is hosted in EU, India, Australia or China, you need to specify the corresponding domain: Zoho.eu, Zoho.in, Zoho.com.au or Zoho.com.cn.
Click the Sign In button to complete the sign in process.
Enter your Login URL, Username & Password.
The Login URL will be your specific Sugar URL.
ThinkAutomation supports native access to the following database types:
Microsoft SQL Server
Microsoft SQL Server Azure
MySQL / Maria DB
SQLite
Oracle
PostgreSQL
DB2
Firebird
Microsoft Access
MongoDB
In addition it can also connect to an ODBC DSN and use any OLEDB driver.
For all database types you can either specify the connection string directly or click the ...
button on the Connection String entry to use the Connection String Builder.
SQL Server
Set the Instance to the name or network address of the instance of SQL Server to connect or use '(local)' for the local instance. An optional port number can be specified after the name (eg: 'MySQLServer, 1433'). To force a protocol add one of the prefixes - tcp, np or lpc. eg: 'tcp:servername'.
SQL Server Azure
Set the Server to the address of your Azure Database followed by comma port number. Eg: 'mydatabase.database.windows.net,1433'
MySQL
If you use MySQL for the ThinkAutomation Message Store or if you are using ThinkAutomation to store very large records you may need to increase the max_allowed_packet option on your MySQL server, as a single record may be too large for an Insert. See Packet Too Large.
Microsoft Access
Before connecting to a Microsoft Access database you need to install the Microsoft Access Database Engine. Go to: https://www.microsoft.com/en-us/download/details.aspx?id=54920 and install the 64 bit engine (accessdatabaseengine.exe). Office does not need to be installed, however if Office is installed on the ThinkAutomation computer it will need to be the 64 bit version.
IBM DB2
Before connecting to a DB2 database the IBM Data Server Runtime Client must be installed. The IBM Data Server Driver package can be downloaded here. The IBM.Data.DB2.dll IBM DB2 .NET Data Provider library must be in the global path or copied to the ThinkAutomation program files folder.
Copy the \Program Files\IBM\IBM DATA SERVER DRIVER\bin\netf40\IBM.Data.DB2.dll file to \Program Files\ThinkAutomation\ folder or add C:\Program Files\IBM\IBM DATA SERVER DRIVER\bin\netf40\ to your PATH environment variable (you will need to restart the computer after adding the path).
OLEDB
ThinkAutomation can connect to any OLEDB data source configured on your machine. The connection string must use 'OLE DB Provider=providername' not 'Provider=providername'. This is because ThinkAutomation uses 'Provider=' internally to indicate the database type.
MongoDB
ThinkAutomation can read and update documents from MongoDB databases. This can be any locally installed MongoDB or cloud based MongoDB compatible document databases such as MongoDB Atlas, Amazon DocumentDB or Azure Cosmos DB.
To connect to an ODBC data source. First, ensure the required ODBC driver is installed. Configure a System DSN using the Windows ODBC Data Source Administrator. When connecting to the database in ThinkAutomation, select ODBC as the Database Type and enter the DSN name created earlier. ODBC drivers are available for many database types.
Parker Software can supply high performance ODBC drivers that work with ThinkAutomation for the following data sources and cloud based services:
FreshBooks
Magento
Mailchimp
NetSuite
QuickBooks
SAP ASE
Asana
Amazon Redshift
Google BigQuery
Confluence
HubSpot
WooCommerce
Jira
Zendesk
Shopify
Stripe
Slack
FoxPro/xBase/Interbase
plus many more....
Please contact us for details and pricing.
Universal Quoting Of Identifiers
All database servers support quoting for identifiers that contain special symbols like spaces or dots. ThinkAutomation allows you to wrap identifiers universally so that quotation is appropriate for every database server. Use the following syntax:
"identifier" For example, expression "table1"."field1" turns into "table1"."field1" in Oracle and PostgreSQL, into [table1].[field1] in MS SQL Server, and into `table1`.`field1` in MySQL server. Do not confuse with single quotes, which are intended to wrap string constants.
Comments
Comments are inserted with two hyphens (comments out the text till the end of current line). For multiline comment, wrap it into /.../ sequences. Example:
xxxxxxxxxx
--This is a single-line comment
/*This one
spans over
several lines*/
Date And Time Constants
When using date/time constants in SQL statements the parts of date are separated with hyphen, time parts are separated with colon, and space is expected between the two parts. The following table illustrates date/time format:
Literal Type | Format | Example |
---|---|---|
date | yyyy-mm-dd | {date '2022-01-01'} |
time | hh:mm:ss | {time '23:59:49'} |
timestamp | yyyy-mm-dd hh:mm:ss | {timestamp '2022-01-01 09:00:00'} |
The following SQL statement:
SELECT * FROM emp WHERE HIREDATE>{date '1982-01-15'}
in MySQL evaluates to
SELECT * FROM emp WHERE HIREDATE>CAST('1982-01-15' AS DATETIME)
and in Oracle to
SELECT * FROM emp WHERE HIREDATE>TO_DATE('1982-01-15', 'YYYY-MM-DD')
ThinkAutomation includes an embedded server-less document database that you can use to store any arbitrary data in Json format. Data can then be queried using SQL statements. See the Embedded Data Store action. Files can also be stored and retrieved using the Embedded Files Store action. Simple key/value pair storage can also be stored using the Embedded Value Store action.
The Embedded database enables fast and easy storage & retrieval of data & files in your Automations without any additional setup.
The ThinkAutomation Embedded Document DB is similar to Mongo DB in how it operates, but requires no setup. The Embedded Database is 'schemaless' meaning the schema does not need to be pre-defined.
It uses LiteDB internally. LiteDB is a free serverless database that can be used in .NET projects enabling you to access the ThinkAutomation embedded databases from your own applications.
Limits
Each document (record) is limited to 16mb in size.
Any number of databases.
Unlimited number of documents per collection.
Up to 250 indexes per collection.
The total size of all the collection names in a database is limited to 8000 bytes. If you plan to have many collections in a single database, make sure to use short names for your collections. For example, if collection names are 10 bytes in length, you can have 800 collections in the database.
See: https://www.litedb.org for more information.
Database Files Location
Actual database files are created when a database is first accessed. One file for each database name. Files are located in the \ProgramData\Parker Software\ThinkAutomation.NET\EmbeddedStore\
folder. Databases are global to your ThinkAutomation instance (IE: The same database can be accessed from any Automation in any of your Solutions).
Encryption
Database files can be encrypted (using AES) by specifying a password. Once a database has been created its password cannot be changed. If you need to change a password, you should create a new database and re-add the data.
Inserting Data
Data is inserted in Json format. Each 'record' is a Json Document. Each document must have an '_id' field with a unique value. If the '_id' field is not supplied then it will be added automatically with a new unique value.
For example, if two documents are added to a collection called 'Person':
xxxxxxxxxx
{
"BusinessEntityID": 1,
"PersonType": "EM",
"NameStyle": false,
"Title": null,
"FirstName": "Ken",
"MiddleName": "J",
"LastName": "Sánchez",
"Suffix": null,
"EmailAddress": "ken@testcompany.com"
}
xxxxxxxxxx
{
"BusinessEntityID": 2,
"PersonType": "EM",
"NameStyle": false,
"Title": null,
"FirstName": "Terri",
"MiddleName": "Lee",
"LastName": "Duffy",
"Suffix": null,
"EmailAddress": "terri@testcompany.com",
"AdditionalContactInfo": null
}
A SQL select statement can then be used:
xxxxxxxxxx
SELECT _id,EmailAddress FROM Person
Which would return:
xxxxxxxxxx
[
{
"_id": "61483e2213d7e52e0023f4ee",
"EmailAddress": "ken@testcompany.com"
},
{
"_id": "61483e2213d7e52e0023f4f0",
"EmailAddress": "terri@testcompany.com"
}
]
When using SQL you can also return the data as CSV, which for the above would return:
xxxxxxxxxx
61483e2213d7e52e0023f4ee,ken@testcompany.com
61483e2213d7e52e0023f4f0,terri@testcompany.com
You could also return a single document:
xxxxxxxxxx
SELECT EmailAddress FROM Person WHERE LastName = 'Duffy'
If using the CSV return type, this would return a single value 'terri@testcompany.com'
In the above example, you could use the Ensure Indexed option on the Insert to add an index to 'LastName' to provide faster queries.
In the Studio, select File - Embedded Data Browser, or from any of your Embedded Data Store actions within any Automations click the Browse Data button. This will open the Embedded Database Browser.
You can select any of your Databases/Collections to execute SQL SELECT statements to view your data. Click the Run button to execute. The results will be displayed. Click the Print/Export button to print or export the data locally.
SELECT statement
xxxxxxxxxx
SELECT <field> [,field]
[FROM <collectioname>]
[WHERE <filter>]
[GROUP BY <field>]
[ORDER BY <field> [,field] [ASC | DESC] ]
[LIMIT <number>]
[OFFSET <number>]
You can use aggregate functions:
xxxxxxxxxx
COUNT(), MIN(), MAX(), FIRST(), LAST(), AVG(), SUM()
Date Functions:
xxxxxxxxxx
YEAR(value), MONTH(value), DAY(value), HOUR(value), MINUTE(value), SECOND(value), DATEADD(dateInterval[year,month,day,hour,minute,second], amount, value),
DATEDIFF(dateInterval, start, end), TO_LOCAL(date), TO_UTC(date)
String Functions:
xxxxxxxxxx
LOWER(value), UPPER(value), LTRIM(value), RTRIM(value), TRIM(value), INDEXOF(value, match [,start]), SUBSTRING(value, startIndex [,length]), LPAD(value, totalWidth, paddingChar), RPAD(value, totalWidth, paddingChar), FORMAT(value,format), LENGTH(value)
GROUP BY
If this clause is present, the results are grouped by a field and the query returns a document for each group. Please note that only one grouping field is allowed.
UPDATE statement
xxxxxxxxxx
UPDATE <collectionname> SET <field> = <value> [,<field> = <value>]
WHERE <filter>
DELETE statement
xxxxxxxxxx
DELETE <collectionname>
WHERE <filter>
ThinkAutomation includes a number of options to make parsing HTML content easier.
When an incoming message is received, if the message is an email and the body has no plain text portion then the %Msg_Body% built-in variable will be automatically created as a plain text version of the HTML body. The %Msg_HTML% built-in variable will contain the HTML original.
The Set Variable action and the Text Operation actions have options to convert HTML To Plaintext, XML or JSON. These operations are the same for both of these actions, however the Text Operation action has the option of previewing the result, allowing you to test the conversion.
Converts any HTML content into plaintext. All HTML tags are removed resulting in only the text content that would have been displayed.
For Example:
xxxxxxxxxx
<html>
<head>
<title>This is a test</title>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body>
<h1>This is the heading</h1>
<p>This is a sample paragraph with <b>bold</b> text<br> and a line below.
<p>Sample link to <a href="http://www.google.com/">Google</a></p>
</body>
</html>
Becomes:
xxxxxxxxxx
This is the heading
This is a sample paragraph with bold text
and a line below.
Sample link to Google
<http://www.google.com/>
Converts any HTML into well-formed XML for easier extraction of data. All formatting tags, styles, images & scripts are removed.
For example, the above HTML would be converted to:
xxxxxxxxxx
<root>
<html>
<head>
<title>
<text>This is a test</text>
</title>
</head>
<body>
<h1>
<text>This is the heading</text>
</h1>
<p>
<text>This is a sample paragraph with bold text and a line below.</text>
</p>
<p>
<text>Sample link to</text>
<a href="http://www.google.com/">
<text>Google</text>
</a>
</p>
</body>
</html>
</root>
Converts any HTML to Json text. The HTML is first converted to XML and then from XML to Json.
For example, the above HTML would be converted to:
xxxxxxxxxx
{
"html": {
"head": {
"title": {
"text": "This is a test"
}
},
"body": {
"h1": {
"text": "This is the heading"
},
"p": [
{
"text": "This is a sample paragraph with bold text and a line below."
},
{
"text": "Sample link to",
"a": {
"@href": "http://www.google.com/",
"text": "Google"
}
}
]
}
}
}
Character data, comments, whitespace and significant whitespace nodes are accessed via #cdata-section, #comment, #whitespace and #significant-whitespace respectively.
Multiple nodes with the same name at the same level are grouped together into an array.
Empty elements are null.
Once converted to Json you can use the Extract Field or Read JSON Document actions to extract data at specific paths.
Any number of Solutions can be created. Each containing any number of Message Sources and Automations. The ThinkAutomation Services load all Solutions in memory.
There is no limit to the number of messages that can be processed. The only limit is available memory and processor capacity.
Note: The ThinkAutomation Basic edition has a limit of 10 message sources and 500 processed messages per day. Standard & Professional Editions have no limits.
The effective maximum number of active Message Sources & Automations is determined only by available memory and processor capacity. Each Message Source executes concurrently. So if you created 10 Message Sources to download messages from 10 separate Office 365 accounts then each will process at the same time. The Automations executed from these Message Sources also execute concurrently (up to the maximum defined in the Server Settings - Message Processor - Message Processor Tasks) as each new message arrives.
For high volume ThinkAutomation implementations you should monitor the memory & processor usage of the ThinkAutomation services. If you are using the Professional Edition then the Message Reader and Message Processor services can be configured to run on separate computers and multiple instances of the Message Processor service can be configured to share the processing.
The Message Store can store a unlimited number of processed messages - limited only by the database type being used. Each message can be any size - but with an effective limit of 50mb per message. For all editions you can run the Message Store database on a separate computer if required.
Individual Automations are limited to 16mb in metadata size - which equates to many thousand Actions per Automation. Large Automations can be split into separate Automations and called using the Call action type.
When a new incoming message is received, the ThinkAutomation Server adds the message to an in-memory queue. Messages are then written to the Message Store database from this queue. The in-memory queue is limited to 500mb (or max n messages - where 'n' is based on available memory). If the queue gets to 70% capacity the ThinkAutomation Server notifies the Message Reader services to slow down (throttle). Messages will be added more slowly until the queue gets back to 20% capacity. A message will be added to the server log whenever throttling is enabled.
The main bottleneck for high volume processing is the speed at which the ThinkAutomation server can write new messages to the Message Store database. For high-volume implementations the type and location of the Message Store database will be the main performance factor. For instance, a local SQL Server database will be faster than a remote one. A MongoDB database will give the best performance provided it is local (or on another computer on the same network) and has sufficient memory.
A typical ThinkAutomation installation on a computer with an i7 processor and 16GB ram with the Message Store database running on the same computer can process 200-300 messages per second (assuming a basic Automation and incoming message size of 1k and no other high CPU intensive applications running).
The speed at which individual Automations can process messages obviously depends on the Automation itself.
You should also ensure that processed messages are removed from the Message Store database when you no longer need to keep a copy. Message removal days are specified on the Solution properties. The ThinkAutomation server removes old messages on a daily basis.
You can view the current queue status and queue size by viewing the ThinkAutomation Server Status web page. Open a browser to http://localhost:9899 on the ThinkAutomation Server computer.
Json text can be created using the Create Json, Update Json or Set Variable actions.
The Create Json action is useful where you have a pre-defined Json schema and you want to assign values to specific paths and then return the resulting Json to a variable. It maintains the data type (string, date, boolean, number) of the pre-defined schema.
The Set Variable action allows ad-hoc creation of Json - but you need to add quotes for string values. For example, if we had the following Json:
xxxxxxxxxx
{
"Name": "",
"Email": "",
"StartDate": "",
"Age": 0
}
And we wanted to set a value and include %variable% replacements, eg:
xxxxxxxxxx
{
"Name": "%Name%",
"Email": "%Email%",
"StartDate": "%StartDate%",
"Age": %Age%
}
Any string %variable%replacements that are strings or dates must be enclosed in quotes.
The Set Variable action has a 'Convert: Reformat Json' operation which will reformat, and re-indent the Json (after the %variable% replacements).
The Update Json action is useful where you want to create or update Json and set the values of specific paths. Any existing paths in the Json that are not updated will retain their existing values. Any paths updated that do not already exist in the existing Json will be added.
When an Automation executes, any %variable% replacements inside Json text will be correctly 'escaped' - unless the replace value itself is already Json. Any Extract Field values that are set as 'Date' type, or any built-in variables that are dates (%Msg_Date%, %Date% etc.) will be replaced in ISO 8601 format.
%Msg_Json%
This built-in variable will return Json text representing the current message being processed. For example:
xxxxxxxxxx
{
"MessageId": "12c1c473-862d-44f1-9dc7-cbf0474fba12",
"Subject": "Test Subject",
"Dated": "2021-09-23T10:49:55+01:00",
"BodyPlainText": "Test Body",
"BodyHTML": "",
"From": [
{
"Email": "howard.williams@parkersoftware.com",
"Name": "Howard Williams"
}
],
"ToAddress": [
{
"Email": "stephen@parkersoft.co.uk",
"Name": ""
}
],
"CC": null,
"BCC": null,
"Sender": null,
"ReplyTo": null,
"InReplyTo": null,
"References": "",
"ReturnPath": "",
"MessageHeaders": [
{
"Header": "MIME-Version",
"Value": "1.0"
},
{
"Header": "Date",
"Value": "Thu, 23 Sep 2021 10:49:55 +0100"
},
{
"Header": "Message-Id",
"Value": "12c1c473-862d-44f1-9dc7-cbf0474fba12"
},
{
"Header": "Content-Type",
"Value": "text/plain; charset=us-ascii; format=flowed"
},
{
"Header": "Content-Transfer-Encoding",
"Value": "7bit"
},
{
"Header": "X-Priority",
"Value": "3 (Normal)"
},
{
"Header": "To",
"Value": "stephen@parkersoft.co.uk"
},
{
"Header": "From",
"Value": "Howard Williams <howard.williams@parkersoftware.com>"
},
{
"Header": "Subject",
"Value": "=?us-ascii?B?SnNvbiBSZXBsYWNl?="
}
],
"ContentType": "text/plain; charset=us-ascii; format=flowed",
"ContentTransferEncoding": "7bit",
"CharSet": "us-ascii",
"Language": "latin1",
"OrigDate": "2021-09-23T10:49:55+01:00",
"Size": 356,
"ReadReceipt": false,
"Importance": "NORMAL",
"Sensitivity": "NORMAL",
"Attachments": null,
"RelatedItems": null,
"SolutionId": "60e2e90913d7e55818292ddb",
"MessageSourceId": "613b33bb13d7e531e41aa54f",
"AutomationId": "614c3f5413d7e531b004b412",
"MessageStoreId": "613b33bb13d7e531e41aa54f"
}
%Msg_ExtractedFieldsJson%
This variable will return Json text containing the name and value for each Extract Field action. For example, suppose you have created the following Extract Field actions:
From = Extract Field Built-In Variable %Msg_FromEmail%
Size = Extract Field Built-In Variable %Msg_Size%
Dated = Extract Field Built-In Variable %Msg_Date%
Body = Extract Field Built-In Variable %Msg_Body%
The %Msg_ExtractedFieldsJson% built-in variable would return:
xxxxxxxxxx
{
"From": "howard.williams@parkersoftware.com",
"Size": 355,
"Dated": "2021-09-23T11:00:52Z",
"Body": "Test Message"
}
You can define the field type for each Extracted Field on the Extract Field action - Database Update Tab - Field Type.
The %Msg_ExtractedFieldsJson% variable is useful when used with the Embedded Data Store action. You can set the Insert json to this variable to insert your extracted fields into an easy to use data store that you can query on from other Automations.
There are a number of ways to extract data from Json text.
Extract Field Action
You can use the Extract Field action to extract a specific Json path value. If the Extract Field From value contains Json text then you can enable the Extract Json Path option and then enter or select a path. If you paste some sample Json into the Helper Message the path list will be populated. You can also extract Json array values to a CSV string.
Read Json Document
The Read Json Document action can be used to read Json from a web resource or specify Json Text manually (or a %variable% replacement read from an earlier action). You can then extract multiple paths and assign the values to variables.
InLine Function
The InLine function option allows you to extract a specific Json path value without creating an action. Simply use the InLine function as you would any other %variable% replacement.
You can use the %func%:JsonValue inline function to extract a specific Json path value. For example, if you have a variable called 'AddressJson' set to:
xxxxxxxxxx
{
"employee": {
"name": "John",
"salary": 56000,
"married": true
}
}
You could use the inline function such as:
Dear %func%:JsonValue(%AddressJson%,"employee.name"),
At runtime the replaced text would be:
Dear John,
The Extract Field action allows you to extract at a specific Json path. If this path is an array you can enable the Extract All Array Values To CSV option.
For example, suppose you have the following Json:
xxxxxxxxxx
{
"Actors": [
{
"name": "Tom Cruise",
"age": 56,
"Born At": "Syracuse, NY",
"Birthdate": "July 3, 1962",
"photo": "https://jsonformatter.org/img/tom-cruise.jpg"
},
{
"name": "Robert Downey Jr.",
"age": 53,
"Born At": "New York City, NY",
"Birthdate": "April 4, 1965",
"photo": "https://jsonformatter.org/img/Robert-Downey-Jr.jpg"
}
]
}
You could create an Extract Field action and set the Path to Actors and enable the Extract All Array Values To CSV option.
The Extract Field value would be set to:
xxxxxxxxxx
Tom Cruise,56,"Syracuse, NY","July 3, 1962",https://jsonformatter.org/img/tom-cruise.jpg
Robert Downey Jr.,53,"New York City, NY","April 4, 1965",https://jsonformatter.org/img/Robert-Downey-Jr.jpg
You can then use the For..Each action to loop over each line in the returned CSV and within the loop use the Parse CSV Line action to get specific values.
You can use the For Each action to loop on Json members. For example, the following Json:
xxxxxxxxxx
{
"employee": {
"name": "John",
"salary": 56000,
"married": true
}
}
In the For..Each action set the For Each to Json Member In and set the Json In to a %variable% containing the Json. With the Start At Path set to employee.
You can assign each member value and name to variables.
The above loop would set the variables:
xxxxxxxxxx
%name%=name, %value%=John
%name%=salary, %value%=56000
%name%=married, %value%=true
Array example:
xxxxxxxxxx
["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
Using a For..Each action on the above Json. The values assigned would be 'Sunday','Monday'.. etc.
Array Example 2:
xxxxxxxxxx
{
"id": "0001",
"type": "donut",
"name": "Cake",
"ppu": 0.55,
"topping":
[
{ "id": "5001", "type": "None" },
{ "id": "5002", "type": "Glazed" },
{ "id": "5005", "type": "Sugar" },
{ "id": "5007", "type": "Powdered Sugar" }
]
}
Using a For..Each on the above Json with the Start At Path set to topping. The values in the loop would be assigned:
xxxxxxxxxx
{
"id": "5001",
"type": "None"
}
xxxxxxxxxx
{
"id": "5002",
"type": "Glazed"
}
etc.
If you set the Start At Path to topping[0] then this will iterate through the first array item in the topping array.
You can convert Json text to human readable HTML using the Convert Json To HTML action.
This action us useful when you read Json data from a database, web resource or web api etc., and you need to easily convert the content to readable HTML. The HTML can then be included on outgoing emails or used as a return value for webform Message Sources.
You can convert Json text to XML (and XML To Json) using the Set Variable action with the Convert: JSON To XML operation (or Convert: XML To Json) operation.
Markdown is a lightweight markup language with plaint-text formatting. See: Markdown Guide
You can use Markdown in ThinkAutomation for outgoing email text, Teams Messages, Web Forms and Wait For User Response forms (headings, prompt text, help text). You can also use it with the Set Variable action. The Set Variable action has an option for converting Markdown to HTML and for converting CSV data to a Markdown table.
For example: If you set an outgoing plain text email or Teams message to:
xxxxxxxxxx
# Order Received
Please find below your order:
Order: **1234**
Link: [View Order](https://mycompany.com/orders/1234.pdf)
The outgoing email HTML would convert to:
xxxxxxxxxx
<h1 id="order-received">Order Received</h1>
<p>Please find below your order:</p>
<p>Order: <strong>1234</strong><br />
Link: <a href="https://mycompany.com/orders/1234.pdf" target="_blank">View Order</a></p>
For outgoing emails any converted HTML will be wrapped inside <html>
& <body>
tags. A basic CSS stylesheet will be applied. The CSS can be edited in the Server Settings - Default CSS.
Any of the standard Markdown formatting can be used. See: https://www.markdownguide.org/basic-syntax
For tables you can use Pipe format or Grid format.
Pipe Format
xxxxxxxxxx
| abc | def | ghi |
|:---:|-----|----:|
| 1 | 2 | 3 |
Would convert to:
xxxxxxxxxx
<table>
<thead>
<tr>
<th style="text-align: center;">abc</th>
<th>def</th>
<th style="text-align: right;">ghi</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;">1</td>
<td>2</td>
<td style="text-align: right;">3</td>
</tr>
</tbody>
</table>
Or..
xxxxxxxxxx
# Details
| Item | Details |
| ------- | ----------------- |
| From | **%Msg_From%** |
| To | **%Msg_To%** |
| Subject | **%Msg_Subject%** |
Would convert to:
xxxxxxxxxx
<h1>Details</h1>
<table>
<thead>
<tr>
<th>Item</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>From</td>
<td><strong>sender@test.com</strong></td>
</tr>
<tr>
<td>To</td>
<td>receiver@test.com</td>
</tr>
<tr>
<td>Subject</td>
<td><strong>Test Subject</strong></td>
</tr>
</tbody>
</table>
Pipe style tables must have a blank line before and after the table.
Grid Format
A grid table allows you to have multiple lines per cells and cells can span over multiple columns. For example:
xxxxxxxxxx
+---------------+---------------+--------------------+
| Fruit | Price | Advantages |
+===============+===============+====================+
| Bananas | $1.34 | - built-in wrapper |
| | | - bright color |
+---------------+---------------+--------------------+
| Oranges | $2.10 | - cures scurvy |
| | | - tasty |
+---------------+---------------+--------------------+
Alignments can be specified as with pipe tables, by putting colons at the boundaries of the separator line:
xxxxxxxxxx
+--------------:+:--------------+:------------------:+
| Right | Left | Centered |
+==============:+:==============+:==================:+
| Bananas | $1.34 | built-in wrapper |
+---------------+---------------+--------------------+
For headerless tables:
xxxxxxxxxx
+--------------:+:--------------+:------------------:+
| Right | Left | Centered |
+---------------+---------------+--------------------+
When using multiple lines per cell the column separators must line up.
Converting CSV Data To A Markdown Table
If you have CSV data you can use the Set Variable or Text Operation actions to convert CSV data to a Markdown table. Numeric columns will be right aligned and date columns will be centre aligned.
Any URL will automatically be converted to a link. You can also use the syntax:
[Link Text](http://www.mysite.com)
Would convert to:
xxxxxxxxxx
<a href="http:/www.mysite.com" target="_blank">Link Text</a>
For images you can use the syntax:
![Logo](http://www.mysite.com/assets/images/logo.png)
Would convert to:
xxxxxxxxxx
<img src="http://www.mysite.com/assets/images/logo.png" alt="Logo">
Markdown document files or attachments (*.md) can be converted to PDF, Word & HTML files using the Convert Document action.
You use use the Automation Return action to return Markdown text. If the Message Source is a Web Form then the Markdown will be automatically converted to HTML before being displayed in the confirmation message.
For manually executed Automations sent by users of the Desktop Connector or Studio (via the Send Message form) then any Markdown content in the Return value will be rendered.
The Sentiment Analyzer Control Panel is a stand alone application that can be used to test & train the ThinkAutomation Sentiment Analyzer. It can be started by clicking the Open Sentiment Analyzer Control Panel button on the Score Sentiment, Train Sentiment & Classify Sentiment actions or by running the ThinkAutomationSentimentControlPanel.exe application.
You must first login with your ThinkAutomation User Name/Password.
The current Class Names will be listed. Select a Class Name. You can add a new class using the Add button. To clear all training data for a class click the Reset button.
Test Or Train With Text
Select this tab to test or train the currently selected class name with manually entered text.
Enter or paste text into the box. Click the Test button to analyze the text. The sentiment score will be displayed along with Tokens Used and Tokens Scored.
Click Train Positive or Train Negative to add positive or negative training data for the entered text. Click Add Ignore Words to add all tokens from the entered text as Ignore Words. Click Tokenize to just display the extracted tokens without adding training data.
Test With Files
Select this tab to run multiple tests using local files. Select the Positive Files Path for the folder containing files that you expect to score positive and Negative Files Path for the folder containing files that you expect to score negative.
Enter the file Mask (eg: *.txt) or enter *.* for all supported file types. You can use txt, html, csv, eml or msg (Outlook Messages).
Click Run Test to start.
Each file will be scored - and the overall results displayed along with the overall accuracy percentage.
Train With Files
Select this tab to add training data using multiple local files. Select the Positive Files Path for the folder containing files that will be trained as positive and Negative Files Path for the folder containing files that will be trained as negative.
Enter the file Mask (eg: *.txt) or enter *.* for all supported file types. You can use txt, html, csv, eml or msg (Outlook Messages).
Click Run Training to start.
Each file contained in the selected folders will be read, tokenized and the tokens added as either positive or negative training data.
You can use the Test options to run tests after each training operation.
Training Strategy
For best results each Class Name should be trained with roughly the same number of positive and negative messages. Accuracy will improve with more messages trained.
For example, suppose we want to use the Sentiment Analyzer to flag up incoming messages as 'Sales Enquiry'. You would create a 'SalesEnquiry' class name. You then need to obtain roughly the same number of messages that ARE sales enquires and that are NOT sales enquiries. Save these to separate folders on your file system. You can save Outlook messages to these folders. Several hundred at least of each if possible.
Then use the Train With Files option to add the training data.
Now use the Test With Text option and enter some new text that you would consider a Sales Enquiry. The scored result should be POSITIVE. Enter some new text that you would consider NOT a Sales Enquiry. The scored result should be NEGATIVE.
You can also use the Train Sentiment Automation action to add training data. The benefit of the Automation Action is that you can link it to a Message Source to read folders from an email source. For example: You could create email folders for positive/negative messages and move respective email items to those folders. Then create ThinkAutomation Message Sources to read the folders and execute the Train Sentiment action. You can then add new email items to these folders whenever you want to update the training data.
Classification
Classification is the process of finding the most relevant Class Name for any text. For example: Suppose you have two Class Names: "SalesEnquiry" and "SupportEnquiry" and training data has been added for both. Classification can be used on some new text to indicate which Class Name is the most relevant. You can use the Classify button on the Test With Text tab to perform classification tests.
The ThinkAutomation Desktop Connector is a stand-alone application that you can optionally install on multiple computers on your network. The number of ThinkAutomation Desktop Connectors that can connect to your ThinkAutomation Server at the same time depends on the Edition you have purchased (see: Editions).
Users can use the ThinkAutomation Desktop Connector to manually execute Automations by sending messages or by dragging and dropping files, attachments and Outlook Messages. For example, you may have an Automation that generates a quotation PDF, sends the quotation to the customer and records it in your CRM system. The ThinkAutomation Desktop Connector could be installed on all the sales team computers. Sales team members can then simply drag and drop quote request emails on to the relevant Automation. Automations are executed immediately by the ThinkAutomation server and the results returned back to the Desktop Connector.
The Desktop Connector cannot be used to edit Automations or make any other configuration changes.
The Desktop Connector is installed as part of the main ThinkAutomation installation. A stand-alone Desktop Connector installer is also available here: Download ThinkAutomation Desktop Connector Setup (55mb).
When the Desktop Connector is started the user must login. You can create additional users using the ThinkAutomation Studio - Server Settings - Users tab. Multiple Desktop Connector users can login using the same username if required.
After login the Desktop Connector will list all Automations and Web Form Message Sources for the currently selected Solution. You can change the selected Solution from the drop-down list. You can restrict the Solutions available to a user using the Server Settings.
Click an Automation in the list. The right hand pane will display the Send Message form for the selected Automation. Enter a message and click the Send button (or press CTRL-Enter). You can also change the Subject, From and To addresses and add Attachments.
The message will be processed by ThinkAutomation and the return value (along with any Comments) will be displayed.
You can drag and drop any file on to the Send Message form. These will be sent to ThinkAutomation for immediate processing. Any text files dropped onto the Desktop Connector will be converted into plain text emails. HTML files will be converted to HTML emails. Email messages (EML files) can also be dropped. Any other file types will be added as an attachment to a plain text email before being sent to ThinkAutomation. You can drag & drop multiple files in a single drag/drop operation. Each file will be treated as a separate message.
For users of Microsoft Outlook (desktop version) you can select one or more messages from Outlook itself and drag & drop them onto the Send Message form. You can also drop specific message attachments. These will then be copied and sent to ThinkAutomation for processing and the results displayed. The original messages in Outlook are not changed.
Any Web Form messages sources for the selected Solution will also be displayed. Selecting one of these will display the the web form inside the Client. You can then complete the form and submit. ThinkAutomation will then process the form results.
The Desktop Connector will display any Wait For User Response action forms. If the Send Request Via Studio & Client Users option is enabled on any Wait For User Response actions, the ThinkAutomation Server will send the validation request to users running the ThinkAutomation Studio or ThinkAutomation Desktop Connector. Studio and Desktop Connector users can complete the validation request from there. You can specify specific Usernames or leave this blank to send to any ThinkAutomation Studio or Desktop Connector users (connected to your ThinkAutomation Server instance).
The Desktop Connector can also be used to view the Message Store which shows a list of processed messages. Click the View tab. All Automations for the selected Solution will be displayed. Select an Automation to view processed messages. Double-click a message or click the Open button to view the message detail and Automation log.
The View tab will only be available if the logged-in user has the Can View Message Store right enabled.
The ThinkAutomation Desktop Connector connects to the ThinkAutomation Server using a secure websocket on port 9110. Ensure this port is open on the ThinkAutomation Server firewall. You will also need to add any network IP ranges to the Whitelist in the ThinkAutomation Server Settings.
The Professional Edition of ThinkAutomation allows the ThinkAutomation main service, Message Reader service and Message Processor service to be configured to run on separate computers. You can also run multiple instances of the Message Processor service on separate computers in a load-balanced configuration (additional license required).
Preparation
You first need to decide on the computer that will run the ThinkAutomation Main Service. Only one computer can run the ThinkAutomation Main Service.
Choose the computers that will run the ThinkAutomation Message Reader Service and the ThinkAutomation Message Processor Service. You can choose to run one or both of these on the same computer as the Main Service or separately.
Configuring The Main Service Computer
Run the ThinkAutomation.exe setup to install ThinkAutomation on the main computer. After the setup is complete the ThinkAutomation Node Configuration application will start.
Select the Distributed Services option and then select the services to run on this computer. The Main Service option must be selected on the main computer.
You should then run the ThinkAutomation Studio to complete the setup of the ThinkAutomation main service. This includes registering your product and completing the Message Store database configuration.
Configuring Node Computers
On a separate computer, run the ThinkAutomation.exe setup again to install ThinkAutomation. After setup is complete the ThinkAutomation Node Configuration application will start.
Select the Distributed Services option and the un-select the Main Service option and select either (or both) the Message Reader Service or Message Processor Service.
You must then enter the IP address of the Main Service computer. Click the Verify button to verify that the computer can connect to the ThinkAutomation main service.
Important
The Message Reader and Message Processor services use ports 9110 and 9899 to communicate with the ThinkAutomation Server. Ensure these ports are open on any firewall on the ThinkAutomation Server computer. Ensure any remote computer IP addresses are added to the ThinkAutomation Server Settings Whitelist.
The ThinkAutomation Professional Edition can be configured to act as a failover server for another ThinkAutomation instance. If the main ThinkAutomation Server goes offline, the failover server takes over message processing until the main server is back online.
Preparation
Your main ThinkAutomation server should be installed, configured and running.
You must use SQL Server, MySQL, PostgreSQL or MongoDB as your Message Store database.
The database must be available to the computer that will run the failover instance of ThinkAutomation. The database server would normally be on a separate computer to the ThinkAutomation main server.
The Backup Solution Settings In Message Store option must be enabled in the main ThinkAutomation server settings.
On the main ThinkAutomation server ensure the failover server IP address is in the Whitelist (Server Settings - Clients - Whitelist IP Addresses).
On the main ThinkAutomation server ensure port 9899 is open for inbound connections (from the failover server) on any firewalls.
Setting Up
On a separate computer, run the ThinkAutomation.exe setup again to install ThinkAutomation. After setup is complete the ThinkAutomation Node Configuration application will start.
Select the Failover Server option and click Next. You will then need to register this instance. Enter your registration details and serial number and click Next. You cannot use the same serial number that has been used to register the main ThinkAutomation instance.
You must then enter the computer name or IP address of the main ThinkAutomation computer. Click the Verify button to verify that the computer can connect to the ThinkAutomation main service.
Enable the Automatic Failover option if you want this instance to automatically monitor the main ThinkAutomation Instance.
How It Works
The failover ThinkAutomation server connects to the main ThinkAutomation server every few seconds to verify that it is running. If the main server cannot be reached (after a couple of retries) the failover server restores all current Solution and global settings from the Message Store database backup and starts processing. Once the main server comes back online it stops processing and reverts to its waiting state.
During failover you can use the Studio to connect to the failover server to view processing status and to view the Message Store - however you cannot make changes to any settings.
Manual Failover
If the Automatic Failover option is not enabled then the failover instance of ThinkAutomation will not start processing if the main server cannot be contacted. You must enable the failover server manually. To do this, start the ThinkAutomation Studio on the failover server. After logging in you will be asked if you want to enable the failover. The failover server will still stop processing if the main server comes online even if Automatic Failover is disabled.
Note: If you use any Counter or Embedded Data actions in your Automations then you must configure a shared location for the embedded database files. This is done using the EmbeddedStorePath registry key. This should be set to a path that is accessible by both the main ThinkAutomation Server and the Failover Server.
Parker Software can assist you in setting up a fault-tolerant, load-balanced ThinkAutomation implementation with failover. Please contact our Professional Services team for more information.
You can install and use the ThinkAutomation Studio on any remote computer that can access the ThinkAutomation Server.
Run the ThinkAutomation.exe setup on the remote computer.
When the ThinkAutomation Node Configuration starts after installation, select Studio Only.
Start the ThinkAutomation Studio and set the ThinkAutomation Server to the IP Address or computer name of the ThinkAutomation Server computer.
The number of Studio & Client users that can be connected to the ThinkAutomation Server at any one time depends on the edition. Standard Edition supports 2 active Studio users, Professional Edition supports up to 10.
Important
If you will be connecting to the ThinkAutomation Server from an external host (for example, if your ThinkAutomation Server is hosted on a cloud virtual machine) you will need to add the remote IP address to the ThinkAutomation Server Whitelist. This needs to be done on the ThinkAutomation Server computer. Use the Studio on the server computer - Server Settings - Clients - Whitelist IP Addresses. Add the External IP addresses for any ThinkAutomation Studio or Client users.
You may also need to configure any firewalls on the ThinkAutomation Server computer to accept inbound requests on port 9110 and 9899.
By default the ThinkAutomation Message Processor service runs under the local SYSTEM account. By default this account will not have access to any network resources (Printers, Network Drives, Remote paths etc). Therefore, if you want an Automation to update files, save attachments or access any network resource you must run the ThinkAutomation Message Processor service under a different user.
To do this, first stop the ThinkAutomation Services (click the Windows Start button and search for 'services' - select the Services app). Scroll down to ThinkAutomation Message Processor. Select and right-click and click Stop.
Right-click the ThinkAutomation Message Processor service and select Properties. Click the Log On tab. Un-select the Local System Account option and select This account. Select a local user account that has access to the network resources that you want ThinkAutomation to be able to access. Enter the password and confirm it.
Click OK.
Restart the ThinkAutomation Message Processor service. It should now be able to access network resources during Automation execution.
The TACopy.exe utility is a command line application that can be used to send messages to ThinkAutomation for processing. It can be run from the command prompt or executed from other applications (such as Windows Task Scheduler, PowerShell, Batch Files or Macro Playback software etc). TACopy can be run on any network computer that can access the ThinkAutomation Server.
TACopy can send plain text messages, files, emails and Outlook messages. Multiple files can be sent in a single operation - with each file being sent to ThinkAutomation as a separate message.
Usage
xxxxxxxxxx
tacopy {command} [parameter] [/m messagesourceid] [/a automationid] [/w]
[/s "subject text"] [/f fromaddress] [/t toaddress] [/b "body text"]
[/i serverNameOrIP[:port]]
The /i switch is used to specify the IP address or computer name of the computer running the ThinkAutomation Server. If this is not specified then localhost is assumed.
Commands
Command | Details |
---|---|
status | Displays the ThinkAutomation Server status. |
list | Displays a list of Message Sources & Automations along with their ID's. |
send | Sends messages to ThinkAutomation for processing. |
The Send command can be used to send a plain text message - by specifying the body text as part of the command line, or it can read and send files. For plain text or HTML files the content of the file is used as the body of the message. For email files (.eml) and Microsoft Outlook messages (.msg) the complete email is sent including attachments. For any other type of file will be sent as an attachment to a plain text email.
The /m switch must be specified followed by a valid Message Source Id. The message will then be processed by the default Automation assigned to the Message Source. You can optionally also specify an Automation Id (/a) if you want to execute a specific Automation (within the same Solution). You can find the Message Source/Automation Id's using the list command, or they can be viewed in the ThinkAutomation Studio.
For send commands you can optionally include the /w switch. If the /w switch is included then TACopy will wait for the Automation to complete before showing the Return Value.
Examples:
xxxxxxxxxx
tacopy SEND C:\Files\document.pdf /m 60e2f87a13d7e5074c1e05a8 /t sales@mydomain.com /i 192.168.1.1 /w
Will create a plain text message with document.pdf added as an attachment and a To Address of 'sales@mycomain.com' and send it to ThinkAutomation for processing and display the Automation return value. If no /s subject switch is supplied then the message subject will be set to the filename.
xxxxxxxxxx
tacopy SEND /s "Subject Text" /f someone@mydomain.com /t sales@mydomain.com /b "Plain text body" /m 60e2f87a13d7e5074c1e05a8
Send a plain text message with the Subject, From Address, To Address and Body specified.
xxxxxxxxxx
tacopy SEND C:\Emails\*.msg /m 60e2f87a13d7e5074c1e05a8
Sends all Outlook Messages (*.msg) in the folder C:\Emails to ThinkAutomation. The messages will be the full email messages including attachments.
xxxxxxxxxx
tacopy SEND C:\Files\Body.txt /s "Subject Text" /f someone@mydomain.com /t sales@mydomain.com /m 60e2f87a13d7e5074c1e05a8
Send a plain text message using the contents of C:\Files\Body.txt as the body content.
Using TACopy On Other Computers
TACopy.exe is installed with the main ThinkAutomation Setup and the ThinkAutomation Desktop Connector setup. You can copy it to other computers if you need to send messages via the command line from networked computers.
TACopy does not require installation if you want to use it on its own.
Copy the following files from the ThinkAutomation Program Files folder:
TACopy.exe
GemBox.Email.Dll
Newtonsoft.Json.Dll
Copy these files into a folder of your choice. TACopy can then be executed from there. You should add the folder to the Windows Path environment variable if you want to execute TACopy from any other folder on your system.
TACopy communicates with the ThinkAutomation Server using https on port 9898.
You need to ensure that any remote IP's are added to the ThinkAutomation Whitelist in the ThinkAutomation Server Settings and ensure that port 9898 is open on the ThinkAutomation Server firewall.
MetaData
All of your Solutions, Message Sources and Automations (referred to collectively as 'metadata') are stored in an encrypted document store database called 'MetaData.db' located in the settings folder:
\ProgramData\Parker Software\ThinkAutomation.NET\
You can open this folder using the ThinkAutomation Studio - File Tab - Open button next to the Data Path setting.
You can make a copy of the MetaData.db file at any time to backup your settings.
Important: The metadata file is encrypted using your ThinkAutomation system administrator user password. If you re-install ThinkAutomation on a new computer and copy an existing MetaData.db file to the settings folder - you will need to use the same password when setting up the System Administrator user - otherwise the metadata file will be inaccessible.
Server Settings
Server settings are stored in a json file called ServerSettings.json located in the settings folder. You can make a copy of this file at any time.
Library
All Custom Action settings and Automations saved to the library are stored in a document store database called Library.db also located in the settings folder.
You can make a copy of this file at any time.
Counters
If you use the Update Counter action, then any counter values are stored in a database file called counters.db also located in the settings folder.
You will need to stop the ThinkAutomation Service before making a copy of this file.
Embedded Databases
If you are using the Embedded Data Store or Embedded Files Store actions the database files will be stored in a sub-folder of settings folder called EmbeddedStore.
You can make a copy of these files at any time, however you should ensure that no Automations are executing that would update any embedded databases during the copy (or stop the ThinkAutomation service to be sure).
How you backup your Message Store Database will depend on the Message Store Database Type (SQL Server, MySQL, PostgreSQL, MongoDB or SQLite).
If you are using the built-in SQLite database then the database file will be located in the settings folder (with a default name of ThinkAutomationMessageStore.sqlite). You can make a copy of this file when the ThinkAutomation Service is not running (copying the file when the ThinkAutomation Service is running may result in a corrupted copy).
For other database types you need to follow the database backup instructions depending on the database being used. For example, for SQL Server see: Create a Full Database Backup - SQL Server | Microsoft Docs
See: Example Automations
Parker Software Limited UK | Parker Software Inc USA |
---|---|
Victoria Business Park, Prospect Way, Stoke on Trent, Staffordshire, ST8 7PL. United Kingdom. | 4767 New Broad Street, Baldwin Park, Orlando, Florida, 32814. United States. |
Tel: (UK) 0330 0882 943 | Tel: (USA) 800 680 7712 |
Email Sales: sales@parkersoftware.com Support: support@parkersoftware.com
ThinkAutomation Business Process Automation Software. Copyright (c) 2024 Parker Software Limited.