let media = []
files.forEach(file => {
media.push({
type: "photo",
caption: formText,
media: `http://site.ru/files/${user}/${file.name}`
})
})
config = {
method: 'post',
url: `https://api.telegram.org/${botToken}/sendMediaGroup?chat_id=${chatId}`,
data: {media}
}
axios(config)
.then(function (response) {
res.status(200).json({message: response.data})
})
.catch(function (error) {
res.status(400).json({message: error})
})
const token = Buffer.from(`${email}:${password}`, "utf8").toString(
"base64"
);
const config = {
method: "get",
url:
"http://example.com",
headers: {
Authorization: `Basic ${token}`,
}
}
axios(config)