D
У меня есть картинка jpg в переменной img (это захват с камеры).
Надо ее отправить в телегу. в nodered есть http-request. Я нанем написал свой модууль для отправки простых текстовых уведомлений. все ок. Но теперь надо им же выслать фотку.
URL сменил. а вот сгенерировать тело не пойму как правильно. Кусочек мануала модуля:
url string
If not configured in the node, this optional property sets the url of the request.
method string
If not configured in the node, this optional property sets the HTTP method of the request. Must be one of GET, PUT, POST, PATCH or DELETE.
headers object
Sets the HTTP headers of the request.
payload
Sent as the body of the request.
Большой вопрос в том, что телега ждет от мня в data (Он же payload). генерирую тело функцией.
var apitoken ='bot';
var post = {};
post.payload = {};
post.method = 'POST';
post.url ='https://api.telegram.org/'+apitoken+'/sendPhoto';
post.headers = {};
post.headers["content-type"] = 'multipart/form-data';
post.payload.chat_id = '-3';
post.payload.photo = msg.payload;
return post;
Но телега ждет что в фото будет ссылка. если post.payload.photo = url на фото - она приходит


