MQTT Integration. Dynamic Updates for Client ID and Password

Hello Losant Team,

I need to integrate with another service using MQTT. I’ve selected MQTT Integration feature and I need to use dynamically updated Client ID and Password. As far as I can see in Losant Web GUI, MQTT Integrations support only statically entered credentials. Can I use Losant API Node / Application: MQTT Publish Message for those purposes? If yes, could you refer an example with topic, message, broker address, etc defined in Node Payload?
Thanks

@Alexander_Kondrov,

Yes, this would have to be done using the Losant API Node. You can use the Integration Post API:

In the body of the request, you can use templated values:

{
  "name": "Example Integrations",
  "integrationType": "mqtt",
  "topics": [
    "myTopic"
  ],
  "mqttConfig": {
    "clientId": "{{ example template }}",
    "username": "exampleUsername",
    "password": "examplePassword",
    "port": 8883,
    "protocol": "mqtts",
    "host": "broker.example.com"
  }
}
1 Like

@Alexander_Kondrov,

Now that I think about it. If you use the API to create an Integration, it would be hard to then consume automatically. The creation of said integration could be automated but, you’d still have to build a workflow to consume the newly created MQTT integration.

Could you give more background into what you’re trying to accomplish?

Thank you, Taron. I created an integration and just planning to patch it I guess with API node every time sending a message in a workflow. At least Losant API Node /Integration: Patch looks as the most appropriate command for me so far

1 Like

Taron,

Continuing this topic, Could you help me to understand if I can generate sha256 encryption of a string value in Losant using JWT: CREATE Node with RS256 Algorithm selected?

Thank you.

UPD and solution: HASH Node worked great for this task finally