The idea of the task is to create an incident in the ticketing platform and attach a screenshot to the ticket created using a chatbot. For the attachment to be done for the ticket created, I am using an upload attachment API which accepts the image in byte array type only.
API Body:
{
"_ProxyDetails": {
"Password":"test@123",
"ProxyID":0,
"ReturnType":"JSON",
"UserName":"[email protected]",
"OrgID":1,
"TokenID":""
},
"eModule":"IM",
"TicketID":14487,
"FileByte":"",
"AttachmentFileName":"testtextfile.txt"
}
Where FileByte needs to be a byte array. I need the image to be converted to a byte array using the built-in JavaScript library only. Can anyone help me to convert this image to byte array type?

atob(getBase64Image().split(',')[1])