|
| 1 | + |
| 2 | +Rich text is used in DevRev to represent text fields that can be formatted and can contain mentions. Eg.: description of an issue, body of a conversation, etc. |
| 3 | + |
| 4 | +A simple rich text looks like one markdown string wrapped in an array: `["Hello **world**!"]`. |
| 5 | +Markdown should be compatible with [CommonMark Spec v0.30](https://spec.commonmark.org/0.30). |
| 6 | + |
| 7 | +To support mentions `rich_text` can be formatted as an array of strings and mention objects like so: |
| 8 | +```json |
| 9 | + [ |
| 10 | + "Hello ", |
| 11 | + {"ref_type":"external_user_type", "id":"1...", "fallback_record_name": "John Doe"}, |
| 12 | + "how are you?" |
| 13 | + ] |
| 14 | + ``` |
| 15 | + |
| 16 | + |
| 17 | +Mention represents any mention (user, issue, etc.) in rich text and is defined as: |
| 18 | + | Field | Type | Required | Description | |
| 19 | + | ---------------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------ | |
| 20 | + | `id` | String | Yes | Identifier of the item being mentioned. This could be a user ID or any other identifier, in the format used by the source system. | |
| 21 | + | `ref_type` | String | Yes | Type of the item being mentioned. Examples include "issue", "comment", etc. The recipe will convert this according to user mappings. | |
| 22 | + | `fallback_record_name` | String | No | The text to display if the mention cannot be resolved. This could be a user's display name or a ticket title, for instance. | |
| 23 | + |
| 24 | +In reverse loaders should expect the following structure: |
| 25 | + ```json |
| 26 | + { |
| 27 | + "type": "rich_text", |
| 28 | + "content": [ |
| 29 | + "Hello ", |
| 30 | + { |
| 31 | + "ref_type": "external_user_type", |
| 32 | + "id": "don:...", |
| 33 | + "fallback_record_name": "John Smith" |
| 34 | + }, |
| 35 | + "how are you?" |
| 36 | + ] |
| 37 | + } |
| 38 | + ``` |
| 39 | + |
| 40 | + |
| 41 | +## Importing articles |
| 42 | + |
| 43 | +Articles support Markdown as well as HTML. |
| 44 | + |
| 45 | +### Article mentions |
| 46 | + |
| 47 | +We support mentions to artifacts and articles. An inline attachment must be mapped to an artifact. A link to another article must be mapped to an article. |
| 48 | + |
| 49 | +#### Inline attachments |
| 50 | +If an inline attachment is hosted in the source system, it must be created as an artifact in DevRev. The same link cannot be used as the attachment will be deleted in the source system when our customers deactivate the account. However, creating an artifact is not enough. The artifact must linked in the appropriate place in the article content. |
| 51 | + |
| 52 | +##### HTML |
| 53 | +```html |
| 54 | +<img src="don:core:dvrv-us-1:devo/0:artifact/1" alt="Alt Text"/> |
| 55 | +``` |
| 56 | + |
| 57 | +##### Markdown |
| 58 | +```markdown |
| 59 | + |
| 60 | +``` |
| 61 | + |
| 62 | +##### Example |
| 63 | +Let's say the content of your external system looks like this: |
| 64 | +```html |
| 65 | +<p>This is an article with one image.</p> |
| 66 | +<p><img src="https://devrev.zendesk.com/hc/article_attachments/29908544740244" alt="download.jpeg"></p> |
| 67 | +``` |
| 68 | + |
| 69 | +The content in DevRev should look like this: |
| 70 | +```html |
| 71 | +<p>This is an article with one image.</p> |
| 72 | +<p><img src="don:core:dvrv-us-1:devo/0:artifact/1" alt="download.jpeg"></p> |
| 73 | +``` |
| 74 | + |
| 75 | +`don:core:dvrv-us-1:devo/0:artifact/1` is the ID of the artifact created in DevRev corresponding to the attachment with ID `29908544740244` in the external source system. |
| 76 | +To achieve this, you need to transform the content of the article to this: |
| 77 | +```json |
| 78 | +[ |
| 79 | + "<p>This is an article with one image.</p><p><img src=\"", |
| 80 | + { |
| 81 | + "ref_type": "artifact", |
| 82 | + "id": "29908544740244", |
| 83 | + "fallback_record_name": "<fallback link>" |
| 84 | + }, |
| 85 | + "\" alt=\"download.jpeg\"></p>" |
| 86 | +] |
| 87 | +``` |
| 88 | +The ref_type should be set to artifact and the ID should be the ID of the attachment in the external source system. The platform simply replaces the mention block with the ID of the corresponding artifact. The resolved value is not wrapped in double quotes. |
| 89 | + |
| 90 | +#### Links to other articles |
| 91 | +If there is a link to another article in the content of the article, you need to create a mention to the article. The link must be to an article that was either created in previous syncs or will be created in the current sync. At the extractor stage, it is impossible to predict the ID of the article that will be created in DevRev. So, this must be handled by the platform. This feature is only available for HTML format. However, since Markdown can contain HTML, you can use the same approach for Markdown as well. |
| 92 | + |
| 93 | +##### HTML |
| 94 | +```html |
| 95 | +<a data-article-id="don:core:dvrv-us-1:devo/0:article/10" href="/ART-10" target="_self">Contact our Support Team</a> |
| 96 | +``` |
| 97 | + |
| 98 | +##### Example |
| 99 | +Let's say the content of your external system looks like this: |
| 100 | +```html |
| 101 | +<p>You can create an account and log-in <a href="https://devrev.zendesk.com/hc/en-us/articles/360059607772" target="_self">only</a> with the company email. |
| 102 | +``` |
| 103 | + |
| 104 | +The content in DevRev should look like this: |
| 105 | +```html |
| 106 | +<p>You can create an account and log-in <a data-article-id="don:core:dvrv-us-1:devo/0:article/10" href="/ART-10" target="_self">only</a> with the company email. |
| 107 | +``` |
| 108 | + |
| 109 | +`don:core:dvrv-us-1:devo/0:article/10` is the ID of the article created in DevRev corresponding to the article with ID `360059607772` in the external source system. |
| 110 | +To achieve this, you need to transform the content of the article to this: |
| 111 | +```json |
| 112 | +[ |
| 113 | + "You can create an account and log-in <a data-article-id=\"", |
| 114 | + { |
| 115 | + "ref_type": "article", |
| 116 | + "id": "360059607772", |
| 117 | + "fallback_record_name": "<fallback article ID>" |
| 118 | + }, |
| 119 | + "\" target=\"_self\"> only</a> with the company email." |
| 120 | +] |
| 121 | +``` |
| 122 | +The ref_type should be set to the item type in the external system that is being mapped to articles. For example, if you're importing documents from the external system as articles, the `ref_type` should be set to documents. The ID should be the ID of the item in the external source system. The platform replaces the mention block with the ID of the corresponding article in DevRev as well as adds the href attribute with the appropriate value. |
| 123 | + |
| 124 | +## Managing Permissions |
| 125 | + |
| 126 | +You can manage permissions in the `shared_with` field. Permissions can reference users, groups and [platform groups](./platform_groups.md). |
0 commit comments