Upload file to Rocket Chat https://docs.rocket.chat/api/rest-api/methods/rooms/upload#example-call
Here is an example
curl "http://localhost:3000/api/v1/rooms.upload/GENERAL" \
-F file=@$HOME/example.txt \
-F "msg=This is a message with a file" \
-F "description=Simple text file" \
-H "X-Auth-Token: ijFlJ1yfidXhwEYY284Anoq_iEsOeMMVCupzNhX22tB" \
-H "X-User-Id: hw5DThnhQmxDWnavu"
How can I implement in HttpRequest node?
I’m taking the file from IMAP node attachment.
Please copy and paste your actual node configuration.
@Ilya_Kuchaev welcome to the community.
The example below should do it. Just replace the header with your IDs.
{
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
250,
300
]
},
{
"parameters": {
"requestMethod": "POST",
"url": "https://testingn8n.rocket.chat/api/v1/rooms.upload/GENERAL",
"jsonParameters": true,
"options": {
"bodyContentType": "multipart-form-data"
},
"sendBinaryData": true,
"headerParametersJson": "={ \"X-Auth-Token\": \"yourtoken\", \"X-User-Id\": \"youruserid\" }"
},
"name": "HTTP Request",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
1020,
300
]
},
{
"parameters": {
"url": "https://hips.hearstapps.com/hmg-prod.s3.amazonaws.com/images/golden-retriever-royalty-free-image-506756303-1560962726.jpg?crop=0.672xw:1.00xh;0.166xw,0&resize=640:*",
"responseFormat": "file",
"options": {}
},
"name": "HTTP Request1",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
650,
300
]
}
],
"connections": {
"Start": {
"main": [
[
{
"node": "HTTP Request1",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request1": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
}
}
}