CREATING A THINGWORX CONNECTION
The ThingWorx connector sends the uplinks of your devices to your ThingWorx Platform. It creates a Thing for each device, based on a Thing Template, and updates the Thing with each uplink. It sends to the device the downlinks set on the Thing.
The data follows this path: LoRaWAN® device → ThingPark Enterprise → ThingPark X IoT Flow connection → ThingWorx Platform.
The ThingWorx connector requires that the ThingWorx Platform is installed and configured upfront. This page gives a minimal setup example to get the ThingWorx connector working.
Collecting Expected Information
Parameters required
| UI Field | Description |
|---|---|
| Name | Name of the connection. |
| Hostname | Host name or IP address of the ThingWorx Platform, with or without port, for example thingworx.example.com:8443. The platform must have SSL/TLS enabled. |
| Application Key | Secret access key for accessing the ThingWorx Platform: the Key ID of an application key. See Application Key Retrieval. |
| Thing Template Name | ThingWorx Thing Template used to create the Things of the devices. Default actilityThingTemplateSF. The connector creates it when it is missing. |
| Query | Optional JSON filter that restricts the Things bound to the Thing Template, for example {"filters": {"type": "EQ", "fieldName": "name", "value": "2CF7F1909C0A1A1A"}}. |
| Connect Timeout (in ms) | Maximum time to establish the connection to ThingWorx. Default 30000 ms. |
| Ping Timeout (in ms) | Maximum time to wait for a ping response from ThingWorx. Default 30000 ms. |
| Default Client Request Timeout (in ms) | Default timeout of the requests to ThingWorx. Default 5000 ms. |
| Client Connect Wait Timeout (in ms) | Maximum time to wait for the connection to ThingWorx before the attempt fails. Default 300000 ms. |
| Query Things Timeout (in ms) | Maximum time of the queries that list the Things of the Thing Template. Default 30000 ms. |
| Invoke Service Timeout (in ms) | Maximum time of each service call on ThingWorx, such as the creation of a Thing or its update with an uplink. Default 5000 ms. |
| Batch Things Size | Maximum number of Things processed in one batch. Default 1000. |
| Description | Optional description of the connection. |
Preparing the ThingWorx Platform
The ThingWorx connector is intended to be connected to the ThingWorx Foundation service. This service can be either provided by ThingWorx as a SaaS service or hosted on local premises.
After enabling the ThingWorx service, retrieve an application key and give the permissions described below to its user.
The connector creates the Thing Template when the connection starts. You can also use your own Thing Template, based on the one created.
Application Key Retrieval
We recommend that you create a new user or use an existing one that is different from the Administrator user.
-
Log in to ThingWorx Composer as Administrator (
https://<host>:<port>/Thingworx/Composer/index.html) and click the Users link in the Security section of the menu. Click New to add a new user.
-
On the General Information tab, fill in the username and the password, make sure Enabled is checked, and click Save.

-
Click the Application Keys link in the Security section of the menu and click New to create an application key for the new user.

-
Set the key Name, select the User Name Reference and set an Expiration Date in the future, then click Save.

-
After you click Save, a Key ID is generated. Copy it: it is the Application Key of the connection.

Permissions Setup
-
Click the Collections link in the Permissions section of the menu, select Things and Thing Templates and click Edit Permissions.

-
On the Visibility tab, select the Composer organization and click Save.

-
On the Design Time tab, select the user, check at least the Create and Read permissions and click Save.

-
Click the Entities link in the Permissions section of the menu, search and select EntityServices and click Edit Permissions.

-
On the Visibility tab, select the Composer organization and click Save.

-
On the Run Time tab, add the CreateThing, CreateThingTemplate and GetEntityList services, allow the user to execute them and click Save. With these permissions, the connection that uses the application key can create the Thing Template and the Things on the ThingWorx Platform when they are missing.

-
In the Access Reports link of the Permissions section of the menu, you can check that the user has access to these services.

-
You can now log in to ThingWorx Composer with the new user, and use the application key (Key ID) in the connection.
Creating a Connection With UI
-
In ThingPark Enterprise, click Connections -> + Add Connection -> ThingPark X IoT Flow.

-
In ThingPark X IoT Flow, click ThingWorx in the list of connectors.

-
Fill in the form:
- Name: a clear name for the connection, for example
My ThingWorx Connection. - Hostname: the host name or IP address of your ThingWorx Platform, with or without port.
- Application Key: the Key ID of the application key created in ThingWorx Composer.
- Thing Template Name: keep
actilityThingTemplateSFor enter the name of your Thing Template. - Query: optional, a JSON filter on the Things of the Thing Template.
- Connect Timeout (in ms): optional, default 30000 ms.
- Ping Timeout (in ms): optional, default 30000 ms.
- Default Client Request Timeout (in ms): optional, default 5000 ms.
- Client Connect Wait Timeout (in ms): optional, default 300000 ms.
- Query Things Timeout (in ms): optional, default 30000 ms.
- Invoke Service Timeout (in ms): optional, default 5000 ms.
- Batch Things Size: optional, default 1000.
- Description: optional.

- Name: a clear name for the connection, for example
-
Click Create. A notification confirms that the connection has been created, and the connection details open.
-
In the connection details, check that the connection is OPENED (see Connection States).
Parameters marked with * are mandatory.
Changing the Settings After Creation
In the connection details, the settings sections show the settings of the connection.
-
Click the Edit button next to the setting to change.
-
Enter the new value and click the Confirm button, then confirm the update.
A notification confirms that the setting is updated.
Creating a Connection With API
WebSocket Secure (WSS) over TLS v1.2 connection is the recommended protocol by ThingWorx and is mandatory.
You need to create the connection prior to creating the flow.
The creation of a connection establishes a link from ThingPark X IoT Flow to the cloud provider that you want to associate a Device with. The link can be used to transport any Uplink regardless the DevEUI parameter.
To do this, you need to use the Connections group resource:
POST /connectionsto create a new Connection instancePUT /connectionsto update a Connection instanceDELETE /connectionsto delete a Connection instance
When you update a configuration property on a connection, you must provide the whole configuration properties again.
Example of the creation of a connection:
POST /connections
{
"connectorId": "actility-thingworx-iot",
"name": "Actility ThingWorx Connection",
"configuration":
{
"description": "ThingWorx Datacenter",
"hostName": "thingworx.example.com:8443",
"applicationKey": "{YOUR-APPLICATION-KEY}",
"thingTemplateName": "actilityThingTemplateSF"
}
}
The following table lists the expected results of properties when applied.
| Property | Expected results |
|---|---|
connectorId | Set to actility-thingworx-iot |
configuration/hostName | Defines the host:port of the ThingWorx Platform to use. Ensure that the platform has SSL/TLS enabled. |
configuration/applicationKey | Secret access key for accessing the ThingWorx Platform. Required for building the WSS over TLS v1.2 connections. |
configuration/thingTemplateName | ThingWorx ThingTemplate to be associated with the Things processed by the connector. |
configuration/query | JSON filter that restricts the Things bound to the Thing Template, for example {"filters": {"type": "EQ", "fieldName": "name", "value": "2CF7F1909C0A1A1A"}}. |
configuration/pipeCount | The pipe count is the number of web sockets that the client opens. The default value of 1 suffices in most applications. Limited to 255. |
configuration/connectTimeout | Connect Timeout, in milliseconds. Default 30000. |
configuration/pingTimeout | Ping Timeout, in milliseconds. Default 30000. |
configuration/defaultClientRequestTimeout | Default Client Request Timeout, in milliseconds. Default 5000. |
configuration/clientConnectWaitTimeout | Client Connect Wait Timeout, in milliseconds. Default 300000. |
configuration/queryThingsTimeout | Query Things Timeout, in milliseconds. Default 30000. |
configuration/invokeServiceTimeout | Invoke Service Timeout, in milliseconds. Default 5000. |
configuration/batchThingsSize | Batch Things Size. Default 1000. |
All properties are not present in this example. You can check the rest of these properties in the common parameters section.
Sending a Downlink
On each Thing, set the property named downlink with a JSON message to send a downlink to the device:
{
"DevEUI_downlink": {
"Time": "2019-07-10T15:38:46.882+02:00",
"DevEUI": "0018B20000000B20",
"FPort": 1,
"payload_hex": "9e1c4852512000220020e3831071"
}
}
For more information, see the downlink message section.
Displaying Information to Know if It Worked
-
Go to the ThingWorx Composer dashboard and select the device you want to monitor.

-
Click more to see the latest uplink data.

Limitations
This connector is limited to 10K devices.
Troubleshooting
Last Wins Issue
If you see this error in the events:
Unable to restart connection THINGWORX with id 289: Could not bind things: Error trying to process message: Binding failed, see server log for more information V1BindMessage [header=V1MessageHeader [messageType=10, requestId=21794, endpointId=-1, sessionId=-1, flags=0], gatewayName=null, gatewayType=null, names=[...]]
It is probably due to a ghost connection on the ThingWorx server side. In ThingWorx, set the Last in wins option, in the configuration of the WS communication part.

User Rights
Unable to open connection THINGWORX with id 301: Unable to dispatch [ uri = /Resources/EntityServices/Services/GetEntityList/]: Entity EntityServices does not exist or is not yet associated with a Thing
This error message is related to administration rights. In ThingWorx, make sure that the user has the right to get the entity list (GetEntityList service, see Permissions Setup).