Using Cumulocity MQTT static templates in Thingstream flows
To use the static templates in a Thingstream flow, you will need to add a function node (pictured below) to create a payload with the required format for the Cumulocity static template you wish to use.

MQTT publishes to Cumulocity need a unique Client ID for the device. A good idea is to derive this from the Thingstream Client ID which would be done using a Thingstream function node with the following code:
var id = msg.contextProperties.deviceId.split(':'); //This takes the unique device ID of your thing, splitting off the prefix "device:" to make it compatible with Cumulocity
msg.clientid = id[1]; // This sets the msg.clientid property which is used by the Thingstream MQTT Publish Node
Registering a new device in Cumulocity uses the static template “100” to create the device and static template “110” to update it with the Client ID. If the device already exists in Cumulocity, these requests are simply ignored. Add the following code to the Thingstream function node:
msg.payload="100,"+msg.contextProperties.deviceName+",MQTT\n110,"+msg.clientid // This creates a device in Cumulocity using the display name of the Thingstream Thing and the client ID created in the previous step
Adding a location to the device in Cumulocity uses the static template “112” which can be done using a Thingstream function node with the following code where lat and lon are variables that you have declared from the incoming payload of your device:
msg.payload = "112,"+lat+","+lon;
If you like, you can do the register, update, and set location tasks one after the other by simply joining each static template publish with a line break:
msg.payload="100,"+msg.contextProperties.deviceName+",MQTT\n110,"+msg.clientid+"\n112,"+lat+","+lon;
Once your payload is ready, you would join the function node to an MQTT Publish Node configured with the credentials for your Cumulocity tenant. The server URL is mqtt.cumulocity.com and the topic to publish to is s/us. Leave the Client ID empty so that the msg.clientid value you set earlier is used and then set the username as your Cumulocity user ID prefixed with your tenant name e.g. mytenant/myusername. Set the password to the same password you use to login to Cumulocity