Skip to Main Content
Status Future consideration
Categories Ideas
Created by Arun Ramesh
Created on Jan 25, 2019

Distinguish Embedded Image & Attachments in Aha API

Hello,
I am using the APIs provided by Aha to integrate Salesforce Idea Exchange with Aha.I am not using the Salesforce integration provided by Aha.
I use the Ideas and Idea Comments API predominantly to integrate the ideas and idea comments from Salesforce.

When an idea is created in Salesforce Idea Exchange, it is brought into Aha via the custom integration built and the idea name, description, created_at, categories, workflow_status, custom_fields etc. are created in Aha using Aha Ideas API. Subsequently, the comments on these ideas are created in Aha using the Aha Idea Comments API.

In the case, where a comment is created in Aha for an idea, I need to sync this comment back to Salesforce. I am using the activity web hook to do so. I am able to get the hook to the comment id and I am seeing a problem when I retrieve the comment details. The comment in Aha can contain multiple embedded images in the comment body as well as attachments. The embedded images provide context to the idea comment body, where as the attachments are reference images or files.

When I query such a comment from Aha, I can see the link to the embedded image within the comment body and the same link is also visible under the attachments,. The attachments in addition to this duplicate link, has the actual attachments. When I sync this comment to Salesforce, I concatenate the attachment links at the end of the attachment body as there is no attachment option in the Salesforce API. Salesforce API can only accept links as image source in its comment body.

When I do this, I end up duplicating the image in Salesforce. I have the same image embedded in the comment body between the text and since its also available as an attachment, I can see it again at the end of the comment.

Question: why does Aha return the same image link in the comment body as well as in attachment for an embedded image? Also, I see in Aha that embedded images are also attachments. This is misleading both from the UI as well as from API. From APIs, how do I distinguish between actual attachments and attachments which are embedded images? It would at least benefit if the attachment had a field called "embedded_image" and it was populated with true/false.

Example API Response:
{
"idea_comments": [
{
"id": "6650489847489305532",
"idea_id": "6650149924520273401",
"body": "<p>Embedded image</p><p><img src=\"https://guidewire.aha.io/attachments/6650489753250804293/token/c634797cea1cc1abbb46533fa92327611252e07f1c5cfa5cf70abcd5f0289242.download?size=original\" alt=\"\" width=\"1147\" data-mce-src=\"https://guidewire.aha.io/attachments/6650489753250804293/token/c634797cea1cc1abbb46533fa92327611252e07f1c5cfa5cf70abcd5f0289242.download?size=original\" height=\"678\" data-mce-style=\"max-width: 1187px;\"></p>",
"created_at": "2019-01-25T17:37:11.799Z",
"idea_commenter_user": {
"id": "6636480842314481181",
"name": "Arun Ramesh",
"email": "aramesh@guidewire.com",
"avatar_url": "https://aha-attachments-prod.s3.amazonaws.com/users/ab47e918144e210f849c8fa7fa5baf3c3904b349/thumb160.JPG?1546988103",
"created_at": "2018-12-18T23:35:06.110Z",
"updated_at": "2019-01-25T18:26:02.545Z"
},
"idea": {
"id": "6650149924520273401",
"reference_num": "IDEASSS-I-144",
"name": "New idea 20190117-3",
"created_at": "2019-01-24T19:38:07.317Z",
"workflow_status": {
"id": "6646599610634565962",
"name": "Planned",
"position": 10,
"complete": false,
"color": "#dce7c6"
},
"description": {
"id": "6650149924656170405",
"body": "Add a filter screen to CAT screen since it may have several screens of data over time. Similar filter screen should be added to any or all admin screens where the default screen is a LV and may contain multiple pages.<br><img alt='User-added image' src='https://guidewire--UAT--c.cs26.content.force.com/servlet/rtaImage?eid=087340000009u6x&feoid=Body&refid=0EM34000000Au9M?token=00D210000009rQF!ARUAQIuobOaTnAbAx6QPTgxLqF.6Ty1pxSD_e2S7lyxeqBeBmwkj6f_nyst_AYmH.poX6HK7jFOZs9HSc4DSlEujbbu6XHY7' style='height: 174px; width: 500px;'></img>",
"created_at": "2019-01-24T19:38:07.349Z",
"attachments": [
{
"id": "6650192588051097537",
"download_url": "https://guidewire.aha.io/attachments/6650192588051097537/token/547ac5790dd2ff32df1729dff8fec2b904b85f02b01289500d107f688e4932ec.download?size=original",
"created_at": "2019-01-24T22:23:40.693Z",
"updated_at": "2019-01-24T22:23:40.693Z",
"content_type": "image/png",
"file_name": "Screen Shot 2019-01-18 at 1.03.55 PM.png",
"file_size": 465412
}
]
},
"url": "https://guidewire.aha.io/ideas/ideas/IDEASSS-I-144",
"resource": "https://guidewire.aha.io/api/v1/ideas/IDEASSS-I-144"
},
"attachments": [
{
"id": "6650489753250804293",
"download_url": "https://guidewire.aha.io/attachments/6650489753250804293/token/c634797cea1cc1abbb46533fa92327611252e07f1c5cfa5cf70abcd5f0289242.download?size=original",
"created_at": "2019-01-25T17:36:49.860Z",
"updated_at": "2019-01-25T17:37:11.808Z",
"content_type": "image/png",
"file_name": "Screen Shot 2019-01-24 at 1.30.59 PM.png",
"file_size": 465202
}
]
},
{
"id": "6650502434515762529",
"idea_id": "6650149924520273401",
"body": "<p>Attach image</p>",
"created_at": "2019-01-25T18:26:02.448Z",
"idea_commenter_user": {
"id": "6636480842314481181",
"name": "Arun Ramesh",
"email": "aramesh@guidewire.com",
"avatar_url": "https://aha-attachments-prod.s3.amazonaws.com/users/ab47e918144e210f849c8fa7fa5baf3c3904b349/thumb160.JPG?1546988103",
"created_at": "2018-12-18T23:35:06.110Z",
"updated_at": "2019-01-25T18:26:02.545Z"
},
"idea": {
"id": "6650149924520273401",
"reference_num": "IDEASSS-I-144",
"name": "New idea 20190117-3",
"created_at": "2019-01-24T19:38:07.317Z",
"workflow_status": {
"id": "6646599610634565962",
"name": "Planned",
"position": 10,
"complete": false,
"color": "#dce7c6"
},
"description": {
"id": "6650149924656170405",
"body": "Add a filter screen to CAT screen since it may have several screens of data over time. Similar filter screen should be added to any or all admin screens where the default screen is a LV and may contain multiple pages.<br><img alt='User-added image' src='https://guidewire--UAT--c.cs26.content.force.com/servlet/rtaImage?eid=087340000009u6x&feoid=Body&refid=0EM34000000Au9M?token=00D210000009rQF!ARUAQIuobOaTnAbAx6QPTgxLqF.6Ty1pxSD_e2S7lyxeqBeBmwkj6f_nyst_AYmH.poX6HK7jFOZs9HSc4DSlEujbbu6XHY7' style='height: 174px; width: 500px;'></img>",
"created_at": "2019-01-24T19:38:07.349Z",
"attachments": [
{
"id": "6650192588051097537",
"download_url": "https://guidewire.aha.io/attachments/6650192588051097537/token/547ac5790dd2ff32df1729dff8fec2b904b85f02b01289500d107f688e4932ec.download?size=original",
"created_at": "2019-01-24T22:23:40.693Z",
"updated_at": "2019-01-24T22:23:40.693Z",
"content_type": "image/png",
"file_name": "Screen Shot 2019-01-18 at 1.03.55 PM.png",
"file_size": 465412
}
]
},
"url": "https://guidewire.aha.io/ideas/ideas/IDEASSS-I-144",
"resource": "https://guidewire.aha.io/api/v1/ideas/IDEASSS-I-144"
},
"attachments": [
{
"id": "6650502415158350390",
"download_url": "https://guidewire.aha.io/attachments/6650502415158350390/token/e491340759458c68e1e55618c8a08d952426ab1d39b0e38577168b3d4c13da72.download?size=original",
"created_at": "2019-01-25T18:25:57.941Z",
"updated_at": "2019-01-25T18:26:02.458Z",
"content_type": "image/png",
"file_name": "Screen Shot 2019-01-22 at 3.41.50 PM.png",
"file_size": 79590
}
]
}
],
"pagination": {
"total_records": 2,
"total_pages": 1,
"current_page": 1
}
}

  • Attach files