Problem creating JSON Object to pass to Microsoft Graph API

Describe the problem/error/question

I want to send message in Teams using Microsoft Graph API (available Teams node in N8N does not have features I would like), but I struggle to create correct body object to pass to API.

Problem is if I try to pull data from previous node I get error. Example below

But if I paste same text in current node there is no error. Example below

There should be something wrong with input data, because if I simply replace everything with ‘test’ then it works. Please explain what am I missing.

Here is example data where I get error.

[
  {
    "email_text": "\r<b>Problem started</b> at 99:99:99 on 9999.99.99<br><b>Problem name:</b> Some Name<br><b>Host:</b> Some Host<br><b>Severity:</b> High<br><b>Operational data:</b> 9999-99-99 99:99:99.999 | INFO | Some Service Name | Some text. <br><b>Original problem ID:</b> 99999<br>"
  }
]

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1.79.3
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

I think the problem could be with that ‘\r’ in the beginning of the input. Try to either remove it or use two back-slashes.

1 Like

Yes I guess that works. I added .replace(/\r/g, “”) to node where I parse email text, that solved it.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.