HTTP POST receiving XML and send as email

Hi,

I have setup a flow with a HTTP in/request node which receive XML payload in a POST request.
I have this flow:

Debug node logs the XML but the email recieved contains the same but JSON

  • How can I preserve XML?
  • How can I also add HTTP headers to the mail?

The xml node converts the xml to a JSON string. Just remove it!
Can't help you with the second part, I'm sure someone else here can.

If I send this XML:

<?xml version="1.0" encoding="UTF-8"?>
<event>
   <action>updated</action>
   <type>application</type>
   <object>
      <application>
         <id>1409617777678</id>
         <created_at>2018-06-18T14:59:54+02:00</created_at>
         <updated_at>2018-08-17T16:36:59+02:00</updated_at>
         <state>live</state>
         <user_account_id>2445582229963</user_account_id>
         <first_traffic_at>2018-06-18T15:00:28+02:00</first_traffic_at>
         <first_daily_traffic_at>2018-07-02T12:46:20+02:00</first_daily_traffic_at>
         <end_user_required>false</end_user_required>
         <service_id>2555417758689</service_id>
         <user_key>ca11f21866f5d664fb59fd3afa578d44</user_key>
         <provider_verification_key>4492205d7b3f619425ee46b4e4023873</provider_verification_key>
         <plan custom="false" default="false">
            <id>2357355951502</id>
            <name>Basic Echo Plan</name>
            <type>application_plan</type>
            <state>published</state>
            <service_id>2555417758689</service_id>
            <end_user_required>false</end_user_required>
            <setup_fee>0.0</setup_fee>
            <cost_per_month>0.0</cost_per_month>
            <trial_period_days />
            <cancellation_period>0</cancellation_period>
         </plan>
         <name>Testing Echo API</name>
         <description>This is just for fun :) ....</description>
         <extra_fields />
      </application>
   </object>
</event>

Through XML node (as above) I get in the mail (quite crappy with HTML encodings):

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;&lt;&lt;?xml version&gt;&quot;1.0&quot;

encoding=&quot;UTF-8&quot;?&amp;gt;&amp;lt;event&amp;gt;&amp;lt;action&amp;gt;updated&amp;lt;/action&amp;gt;&amp;lt;type&amp;gt;application&amp;lt;/type&amp;gt;&amp;lt;object&amp;gt;&amp;lt;application&amp;gt;&amp;lt;id&amp;gt;1409617777678&amp;lt;/id&amp;gt;&amp;lt;created_at&amp;gt;2018-06-18T14:59:54

02:00&amp;lt;/created_at&amp;gt;&amp;lt;updated_at&amp;gt;2018-08-17T16:36:59

02:00&amp;lt;/updated_at&amp;gt;&amp;lt;state&amp;gt;live&amp;lt;/state&amp;gt;&amp;lt;user_account_id&amp;gt;2445582229963&amp;lt;/user_account_id&amp;gt;&amp;lt;first_traffic_at&amp;gt;2018-06-18T15:00:28

02:00&amp;lt;/first_traffic_at&amp;gt;&amp;lt;first_daily_traffic_at&amp;gt;2018-07-02T12:46:20

02:00&amp;lt;/first_daily_traffic_at&amp;gt;&amp;lt;end_user_required&amp;gt;false&amp;lt;/end_user_required&amp;gt;&amp;lt;service_id&amp;gt;2555417758689&amp;lt;/service_id&amp;gt;&amp;lt;user_key&amp;gt;ca11f21866f5d664fb59fd3afa578d44&amp;lt;/user_key&amp;gt;&amp;lt;provider_verification_key&amp;gt;4492205d7b3f619425ee46b4e4023873&amp;lt;/provider_verification_key&amp;gt;&amp;lt;plan

custom=&quot;false&quot;

default=&quot;false&quot;&amp;gt;&amp;lt;id&amp;gt;2357355951502&amp;lt;/id&amp;gt;&amp;lt;name&amp;gt;Basic Echo Plan&amp;lt;/name&amp;gt;&amp;lt;type&amp;gt;application_plan&amp;lt;/type&amp;gt;&amp;lt;state&amp;gt;published&amp;lt;/state&amp;gt;&amp;lt;service_id&amp;gt;2555417758689&amp;lt;/service_id&amp;gt;&amp;lt;end_user_required&amp;gt;false&amp;lt;/end_user_required&amp;gt;&amp;lt;setup_fee&amp;gt;0.0&amp;lt;/setup_fee&amp;gt;&amp;lt;cost_per_month&amp;gt;0.0&amp;lt;/cost_per_month&amp;gt;&amp;lt;trial_period_days/&amp;gt;&amp;lt;cancellation_period&amp;gt;0&amp;lt;/cancellation_period&amp;gt;&amp;lt;/plan&amp;gt;&amp;lt;name&amp;gt;Testing

Echo API&amp;lt;/name&amp;gt;&amp;lt;description&amp;gt;This is just for fun :) ....&amp;lt;/description&amp;gt;&amp;lt;extra_fields&amp;gt;&amp;lt;/extra_fields&amp;gt;&amp;lt;/application&amp;gt;&amp;lt;/object&amp;gt;&amp;lt;/event&amp;gt;&lt;/&lt;?xml

version&gt;

If I go directly from HTTP node to email node I just get the two first elements as some sort of JSON:
{&quot;updatedapplication&quot;}

What are you trying to achieve?
Is it to download the xml from the Email?
If so have you tried sending the xml as an attachment the mail node info bar explains how

@ukmoose I have an API Management system that will do a HTTP POST when something change, with the XML above as an example.

I want to have a webhook in Node-RED to receive that HTTP POST and XML, then as step one send that XML as-is in an email body but also pick a few HTTP headers to also be added to the email body.

Sorry I must be missing something.

If you want to add http headers to the Email message body it won't then be valid xml.

But as the Email message body is msg.payload. You could convert the xml to a string and then prepend the html headers you want to the start of that string.

Sure, I know it won't be a valid XML but it won't be parsed initially so doesn't matter - as said this is step one.
Will google howto's...