Temboo SQS Receive Message issue

I'm trying to read specific values from the Amazon SQS queue and I've managed to filter the xml I get when I run the Receive Message sketch to get the value I want.

However I'm having issues accessing the value (in this case LED1) and comparing it to a predefined condition.

(This is what I see in the serial monitor

Running ReceiveMessage - Run #1
body
LED1
HTTP_CODE
200
#include <Bridge.h>
#include <Temboo.h>
#include "TembooAccount.h" // contains Temboo account information, as described below

int numRuns = 1;   // Execution count, so this doesn't run forever
int maxRuns = 10;   // Maximum number of times the Choreo should be executed
void setup() {
  pinMode(13, OUTPUT);
  Serial.begin(9600);

  // For debugging, wait until the serial console is connected.
  delay(4000);
  while (!Serial);
  Bridge.begin();
}

void loop() {
  if (numRuns <= maxRuns) {
    Serial.println("Running ReceiveMessage - Run #" + String(numRuns++));

    TembooChoreo ReceiveMessageChoreo;

    // Invoke the Temboo client
    ReceiveMessageChoreo.begin();

    // Set Temboo account credentials
    ReceiveMessageChoreo.setAccountName(TEMBOO_ACCOUNT);
    ReceiveMessageChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
    ReceiveMessageChoreo.setAppKey(TEMBOO_APP_KEY);

    // Set Choreo inputs
    ReceiveMessageChoreo.addInput("AWSAccountId", "x");
    ReceiveMessageChoreo.addInput("AWSAccessKeyId", "x");
    ReceiveMessageChoreo.addInput("QueueName", "x");
    ReceiveMessageChoreo.addInput("AWSSecretKeyId", "x");

    // Identify the Choreo to run
    ReceiveMessageChoreo.setChoreo("/Library/Amazon/SQS/ReceiveMessage");

    // add an output filter to extract the latest message
    ReceiveMessageChoreo.addOutputFilter("body", "//ReceiveMessageResult/Message/Body", "Response");

    // Run the Choreo; when results are available, print them to serial
    //  ReceiveMessageChoreo.addOutputFilter("ReceiveMessageResult", "/Message", "/@Body");
    ReceiveMessageChoreo.run();

    while (ReceiveMessageChoreo.available()) {
      char c = ReceiveMessageChoreo.read();
      Serial.print(c);

    }
    ReceiveMessageChoreo.close();
  }

  Serial.println("Waiting...");
  delay(30000); // wait 30 seconds between ReceiveMessage calls
}
    while (ReceiveMessageChoreo.available()) {
      char c = ReceiveMessageChoreo.read();
      Serial.print(c);

    }

Get the response and do nothing more than print it. That's going to make it hard to actually use any of the data. Store the data, and parse it when the data has all been collected.

Hi there, I work for Temboo.

We have an example that is similar to what you are trying to do below:

In that example, we are able to parse the data returned from the Choreo. I've also included an example that should work with your code where we parse the returned data and print something if LED1 is returned from the body.

    while (ReceiveMessageChoreo.available()) {
        // read the name of the next output item
        String name = ReceiveMessageChoreo.readStringUntil('\x1F');
        name.trim(); // use “trim” to get rid of newlines

        // read the value of the next output item
        String data = ReceiveMessageChoreo.readStringUntil('\x1E');
        data.trim(); // use “trim” to get rid of newlines

         if (name == "body") {
             if (data == "LED1") {
                 Serial.println("Turn LED on");
         }

    }

Hopefully that answers your questions, but feel free to reply here or contact us via email (support AT temboo.com) if you have further questions - we're always happy to help.