LenR
LenR

Reputation: 1

How to parse a message in Azure IOT hub logic app

I am trying to understand how to get content into a logic app email (or into the conditioning search in the logic app).

I have an IOT device sending a standard message to the hub (the demo temperature app). This works fine.

I have added a service bus and routing and again all ok.

I then want a logic app to send an email either using some of the content of the message, or even to use the conditional processing in the logic app.

I am using the connector in the logic app to the service bus.

When I try emailing dependant on the conditional "Content contains Startup" the email goes successfully but only down the false route.

When I try to put a JSON parse step in is returns invalid as the content isn't in JSON format.

The Error message:

InvalidJSON. The 'content' property of actions of type 'ParseJson' must be valid JSON. The provided value 'e3sid2ZNZXNzYWdlVHlwZSI6IFN0YXJ0dXAsInRlbXBlcmF0dXJlIjogMzcuMzMsImh1bWlkaXR5IjogNjEuMjV9' cannot be parsed: 'Unexpected character encountered while parsing value: e. Path '', line 0, position 0.'.

Upvotes: 0

Views: 581

Answers (1)

mg360
mg360

Reputation: 113

It is a little hard to understand exactly where you problem is occurring but it sort of looks like your string is in base64.

You can try converting it using:

base64ToString(triggerBody()?['whateveryourvariablenameis'])

Check this out for screen shots and more information: Azure Logic App service bus message content

Upvotes: 1

Related Questions