0

How can I pass subject content in the node.js using add.textitem node? I have tried the code below but the bot only sends the content, I never get subject, parentItemId, etc..

var content = {
    subject: 'test',
    content: msg.payload,
}
msg.payload = content;
return msg;

Debugging

04/09/2019 17:42:58node: 8de0d86f.987558
msg.payload : Object
object
subject: "test"
content: "All arrays Chuck Norris declares are of infinite size, because Chuck Norris knows no bounds."
contentType: "Circuit.Enums.TextItemContentType.RICH"

But in Circuit, only get content.

Carcigenicate
  • 43,494
  • 9
  • 68
  • 117
  • Can you show more of your code? Are you using the REST API or the JS SDK? If the JS SDK, then see the example here: https://circuitsandbox.net/sdk/classes/Client.html#method_addTextItem – Roger Urscheler Sep 05 '19 at 01:59
  • Hello Roger. As I don't know to much about JS/REST, etc, I'm using node-red to do this integration using circuit modules. This is based on JS SDK. This is the code I'm sending to addtextItem node. var text = { subject: 'test', content: msg.payload, contentType: 'Circuit.Enums.TextItemContentType.RICH' } msg.payload = text; return msg; Content works great, but subject, parentID and attachments not. – Bruno d' Amaral Sep 06 '19 at 02:09

1 Answers1

0

The content of the text item needs to be passed as the msg.payload.content. Here you are trying to pass the object as the payload itself. See the code below for how to use pass the subject and content.

msg.payload = {
    content: {
        content: 'content',
        subject: 'subject'
    }
}
return msg;