Http Auth Letterexpress

Hi Jan,

i have a question: I have made HTTP GET that gives me a PDF back.
This works fine, but how i can send these PDF with the Email Node.

  1. This message comes:
    ERROR: Response body is not valid JSON. Change “Response Format” to “String”
Error: Response body is not valid JSON. Change "Response Format" to "String"
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/HttpRequest.node.js:740:31)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:370:47

Then i change to String, in the string Data i see the PDF, then it would be nice to send these as attachemend.

Whats i have to do ?

Must be the attachment a binary ?

Thanks,
Stefan

Sorry do not totally understand what you mean especially with the PDF download seeming to work fine but you then have issues afterward.

Anyway from the things I see. If you download a binary file (like PDF) you have to set the on the HTTP Request Node the option “Response Format” to “File” as you expect a file.

To the second part. Yes, email attachments are always binary as written in the description of the “Attachments” parameter.
Name of the binary properties which contain data which should be added to email as attachment. Multiple ones can be comma separated.

So if you leave the default value “data” in the parameter “Binary Property” on the HTTP Request-Node you would have to set “Attachments” on the EMail-Node also to “data”.

I hope that helps.

Jan, thanks. My post was to quick. Sorry

You are welcome. Great to hear that my answer was apparently anyway helpful. Have fun!

last thing: I would use this api:
https://sandbox.letterxpress.de/briefe-uebertragen/api
What do you think: Auth in Header ?

  "auth": {
    "username": "(string)",
    "apikey": "(string)"
  }

This in Body ?

  "letter": {
    "base64_file":      "(string)", // Optional bei einem Update-Request
    "base64_checksum":  "(string)", // Optional bei einem Update-Request
    "address":          "(string)", // Optional
    "dispatchdate":     "(string)", // Optional
    "specification": {
      "color":"(int)",
      "mode":"(string)",
      "ship":"(string)",
      "c4":"(string)" // Optional für C4 Versandtasche unter 9 Blatt
    }
  }

Here it not works in Header and Body or together in Body.

What do you think ?

Stefan

Hi, in PHP it works like this:
(
[auth] => Array
(
[apikey] => apikey
[username] => username
)

)

In Postman it works:


Any Idea ?

Thanks,
Stefan

I have it !!! Thanks, Stefan

Great to hear that it works.

But it is always best to then post the actual solution that people which have the same problem later know exactly how it got fixed.

Jan, sorry. Ill send you my solutions for DPD Shipping and for Letterexpress Letter Service. I think this would be interesstening for other Users.

Regards,
Stefan

1 Like