I’m Darshan Hiranandani, I’ve been working on an API that allows me to create articles with titles and main content. So far, I’ve been able to create articles successfully, but I’m facing a challenge when it comes to uploading images or attachments to these articles.
I know some platforms like Intercom have hosting services that allow you to upload and store attachments, but I’m not sure if they offer something similar for direct image uploads.
Can anyone share their experience or suggestions on how to upload images or attachments via REST API? Any help or ideas on how to handle this would be greatly appreciated!
Thanks in advance!
Regards
Darshan Hiranandani
Best answer by Jacques Reynolds
Hey @darshanhiranandani 👋 Jacques here from Support Engineering. I hope you are doing well today! :)
You can upload images or attachments to articles via the Intercom API, if the content is hosted publicly and accessible via a URL. Intercom does not support direct uploads of files; instead, you must provide a URL to the file in your API request.
Here's how you can format your request:
Image Tag for Articles: Use an <img> tag with the image URL as the src attribute. Ensure the URL is complete and publicly accessible. Supported file types include PNG, JPEG, SVG, and GIF .
Attachment Attributes: When uploading attachments, specify the following attributes in your JSON payload: • type: Set to "upload". • name: The name of the file, e.g., "example.png". • url: The public URL of the file. • content_type: The MIME type, e.g., "image/png". • filesize: The size in bytes. • width and height: Dimensions for image files .
Ensure your files are hosted on a platform that allows public access, as Intercom requires that URL to fetch and display the content.
Hey @darshanhiranandani 👋 Jacques here from Support Engineering. I hope you are doing well today! :)
You can upload images or attachments to articles via the Intercom API, if the content is hosted publicly and accessible via a URL. Intercom does not support direct uploads of files; instead, you must provide a URL to the file in your API request.
Here's how you can format your request:
Image Tag for Articles: Use an <img> tag with the image URL as the src attribute. Ensure the URL is complete and publicly accessible. Supported file types include PNG, JPEG, SVG, and GIF .
Attachment Attributes: When uploading attachments, specify the following attributes in your JSON payload: • type: Set to "upload". • name: The name of the file, e.g., "example.png". • url: The public URL of the file. • content_type: The MIME type, e.g., "image/png". • filesize: The size in bytes. • width and height: Dimensions for image files .
Ensure your files are hosted on a platform that allows public access, as Intercom requires that URL to fetch and display the content.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.