I know there’s been mentions of an issue with sending both binary and json data with HTTP request, but I’m not sure if that’s still an issue or not. There are lots of mentions of a new HTTP request node coming, but I’m not sure where the release notes exist etc.
Describe the issue/error/question
Trying to send an audio file from Telegram to Whisper hosted on Replicate.com for transcription.
What is the error message (if any)?
[
{
"body": {
"detail": "Failed to parse request body as JSON: invalid character 'O' looking for beginning of value"
},
"headers": {
"date": "Mon, 30 Jan 2023 10:30:14 GMT",
"content-type": "application/json",
"content-length": "104",
"connection": "close",
"via": "1.1 google",
"cf-cache-status": "DYNAMIC",
"report-to": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=4VSknP%2FrLO6uFyylO7wMXIx91Dr9zz%2FwjIhRO1IicLKZqmDvVmGCdlm8oOf%2Fd%2BdDSQ1m6BbpLSJioBwihH7El5JUlRJ6iuuvRRTOj3Q4Y37kasMYVvPo%2Frhtmz12uF1Alw0S\"}],\"group\":\"cf-nel\",\"max_age\":604800}",
"nel": "{\"success_fraction\":0,\"report_to\":\"cf-nel\",\"max_age\":604800}",
"strict-transport-security": "max-age=15552000",
"server": "cloudflare",
"cf-ray": "791987f5bd56ec8c-SEA"
},
"statusCode": 400,
"statusMessage": "Bad Request"
}
]
Please share the workflow
Share the output returned by the last node
Didn’t get that far.
Information on your n8n setup
**n8n version:0.212.1
**Database you’re using (default: SQLite):Postgres
Running n8n with the execution process [own(default), main]:
**Running n8n via [Docker, npm, n8n.cloud, desktop app]:Docker on Railway
That looks like the API you are talking to might be having a hard time with what you are sending, Looking at the API docs quickly I couldn’t see anything for sending a file but I did see that they expect JSON to be send
It doesn’t look like Telegram returns a public URL so you might need to upload the file to temporary storage somewhere like S3 then pass that URL to the service and delete the file.
Got it. Theoretically, if I saved a file to the n8n file system, e.g. write a spreadsheet file etc. Is there a way to get the file URL at that point? Maybe one of the js expressions?
Just to close this loop, I figured out how to make it work using data URLs instead of having to host the file somewhere. If anyone else ends up struggling with this, here you go:
Get file from Telegram Node, with download true.
Move Binary Data to JSON
Then use data URLs to send to Replicate with the HTTP Request Node