Using Your Own API Gateway

Creation date: 02/12/2024 14:39    Updated: 02/12/2024 14:39
The ThinkAutomation API Gateway Server allows inbound public HTTPS API requests and any public Web Form or Web Chat form responses to be sent to your local ThinkAutomation server. The gateway acts as a secure tunnel between public web requests and your ThinkAutomation Server. The Gateway listens for web requests (HTTPS port 443) and forwards these to your ThinkAutomation Server. Your ThinkAutomation server makes an outbound connection to the Gateway using a secure websocket connection on port 80.

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 has no messages per day restrictions. For this you will need a separate 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. 

Follow These Steps To Configure Your Own API Gateway

Important: Firstly, ensure you have the latest ThinkAutomation Server installed. You should not use an old ThinkAutomation Server with the latest Gateway.

1. Register a DNS name (eg: api.mycompany.com). Add a DNS 'a' record to point this DNS name to the public IP address of your ThinkAutomation Gateway computer.

2. Obtain an SSL certificate with a common name matching the DNS name. Import this certificate into the Windows Certificate store, or save it as a PFX file.

3. Download and install the ThinkAutomationGateway.exe setup (Parker Software can provide the download link). No other software is required for the Gateway to work (IIS should not be enabled). Ports 443 and 80 need to be open on any firewalls used or connected to this computer. Once the Gateway is installed, run the ThinkAutomation Gateway Configuration application to setup the gateway. 

4. In the HTTP External Address entry, enter the public DNS name (for example: api.mycompany.com). Click the Select Cert button to select the SSL certificate that is registered to the public DNS name. This can be a certificate selected from the certificate store, or you can select a path to a PFX file.

5. On the ThinkAutomation Instance Connections tab enter the same public DNS name in the Instance Listener External Address entry. 

6. Click Save to save the settings.

7. Click the Install button to install the Gateway Service, then click Start to start it. If the service was already installed, you need to stop and restart the service after any changes are made.

8. Now, go to your ThinkAutomation Server computer and start the Studio. Select File - Server Settings - Web API tab.

9. Enable the Use Own API Gateway Server option.

10. Change the Public Address and the Gateway Server Host to the DNS name.

11. The Gateway Server Instances Port must match the Instances Connect On Port entry in the Gateway Configuration - ThinkAutomation Instance Connections tab. This defaults to port 80, but can be changed to any available port (ensure this is open on the Gateway computer firewall).

12. Save the server settings.

Multiple ThinkAutomation Server's can use the same Gateway Server. You can lock down which ThinkAutomation Server's can connect to your gateway by enabling the Instance Connections Must Be In Whitelist option, and then specifying your ThinkAutomation Server's public address in the whitelist.