How to send attachments and data to AZURE AI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi All,
There is one requirements where we need to send the attachments which is present in the incident.
There is already an implementation on sending the incident information to the azure ai, The AI summarize the content based on the incident data which we are passing which is working fine.
Now, We need to send attachments which is attached to the incident (like pdf,doc,image etc) and along with incident data to azure ai, Now AI has to summarize the content based on the attachments and also with the incident data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Akash_16
Below Code is from Dev Instance that help!!
Attachments in ServiceNow are stored in the sys_attachment table, with file content in sys_attachment_doc.
To get all attachments for a given Incident:
2. Convert attachments into a usable format
The content itself is stored as chunks in sys_attachment_doc. You’ll need to stream/encode these for sending to Azure.
Simplified function to get the base64 file content:
If you’re using RESTMessageV2 to call Azure, you’ll want to base64-encode:
3. Build the payload for Azure AI
You have two options here:
-
Option A: Send as inline base64 data (for small/moderate files).
-
Option B: Upload to blob storage (Azure Storage), then send the file URLs to the AI service along with incident text. This is cleaner if files are large.
Example payload (inline base64):
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Could you please help sharing if the JSON request body is supported by Azure AI API?
Also could you please help sharing the documentation link so that it helps members to understand from where this was referred?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
you first need to understand what Azure API supports in terms of accepting attachment.
Did you check their API documentation?
what HTTP method they accept, what request body looks like?
Once you know these details you can then write the script in ServiceNow.
I found this, please check
Azure AI services REST API reference
also this
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader