> ## Documentation Index
> Fetch the complete documentation index at: https://moengage.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Livingdocs

## Introduction

[Livingdocs](https://livingdocs.io/) is a modern digital content creation and publishing system used by a wide variety of media companies.

## MoEngage and Livingdocs

The MoEngage and Livingdocs integration lets you edit and manage all your templates inside Livingdocs and pull them dynamically into MoEngage campaigns to send up-to-date articles to your customers.

## Integration

<Info>
  **Prerequisites**

  * Your Livingdocs [access tokens](https://docs.livingdocs.io/reference/public-api/get-started/#authorization).
</Info>

### Embed Livingdocs templates inside MoEngage campaigns

Using MoEngage's Content APIs, you can dynamically pull the latest copy of your templates from Livingdocs and send them to your customers.

#### Step 1: Set up a MoEngage Content API

1. Navigate to **Settings** > **Advanced settings** > **Content API**. Click **+ Add content API** in the upper-right corner of the Content API screen. <img src="https://mintcdn.com/moengage/7iGV38YjgdBKSU0B/images/partner_21979775680020.png?fit=max&auto=format&n=7iGV38YjgdBKSU0B&q=85&s=13940626ef5a9638acd1f4a5d4316704" alt="MoEngage Content API screen with the Add content API button highlighted" width="2706" height="1344" data-path="images/partner_21979775680020.png" />
2. Add your Livingdocs API to the endpoint URL. The endpoint changes depending on your use case. <img src="https://mintcdn.com/moengage/syqICryKE0qygh49/images/partner_19878525089556.png?fit=max&auto=format&n=syqICryKE0qygh49&q=85&s=43986535494328af192841f67f225c86" alt="MoEngage Content API configuration screen with the Livingdocs endpoint URL entered" width="2840" height="1542" data-path="images/partner_19878525089556.png" /> We use the Livingdocs [Composition API](https://docs.livingdocs.io/reference/public-api/composition-api/) to fetch the HTML content of your templates.
3. Insert the following URL:
   ```text theme={null}
   https://server.livingdocs.io/api/beta/composition/<document_id>
   ```
4. To find your document ID, open your document inside Livingdocs and look at the URL. <img src="https://mintcdn.com/moengage/syqICryKE0qygh49/images/partner_19878750341652.png?fit=max&auto=format&n=syqICryKE0qygh49&q=85&s=d9707f1af36bd7346fc70b23ae33eb94" alt="Livingdocs editor URL with the document ID highlighted" width="2852" height="1720" data-path="images/partner_19878750341652.png" /> Under **Headers**, add the following:
   * `Authorization`: `Bearer <your-access-token>`
   * `Content-Type`: `application/json; charset=utf-8`
   * `Accept`: `application/json`
5. Set **Method** to `POST`.
6. Under **Body**, enter the following:
   <CodeGroup>
     ```json JSON theme={null}
     {
       "fields": [
         "systemdata",
         "content",
         "metadata",
         "includes",
         "html"
       ],
       "resolveIncludes": true
     }
     ```
   </CodeGroup>
7. Click **Save**, then click **Done** once you see a successful response.

<Tip>
  Click **Test** on the Content API to validate the response before using it in a campaign.
</Tip>

#### Step 2: Display your template inside MoEngage campaigns

To use this Content API in your MoEngage campaigns:

1. On step 2 of campaign creation, type `@`.
2. In the personalization pop-up, select the Livingdocs Content API you configured in Step 1.
3. Use the [MoEngage Templating Language](https://www.moengage.com/docs/user-guide/campaigns-and-channels/getting-started/message-personalization/jinja-templating-language) to parse the API response and use the content in your campaign:
   ```jinja JINJA wrap theme={null}
   {% set response = ContentApi.LivingdocsIntegration2({("params":{},"static_params":{},"dynamic_params":{},"request_body":{"fields":["systemdata","content","metadata","includes","html"],"resolveIncludes":"true"}})}) %}
   {% for block in response.content[0].containers.main %}
   {% if block.component == "free-html" %}
   {{ block.content['free-html'].html }}
   {% endif %}
   {% endfor %}
   ```
   <img src="https://mintcdn.com/moengage/syqICryKE0qygh49/images/partner_19879027390356.png?fit=max&auto=format&n=syqICryKE0qygh49&q=85&s=b78a7e30dcdddf15f360edfeb229bec8" alt="MoEngage editor with Livingdocs template parsed using JINJA" width="2852" height="1142" data-path="images/partner_19879027390356.png" />
4. Click the **Preview** tab to view your campaign with real-time personalization. <img src="https://mintcdn.com/moengage/syqICryKE0qygh49/images/partner_19879067572372.png?fit=max&auto=format&n=syqICryKE0qygh49&q=85&s=95c504fffc0f46909cd30852d1a88c25" alt="Personalized preview showing the Livingdocs template rendered in the campaign" width="2852" height="1562" data-path="images/partner_19879067572372.png" />

### Use dynamic blocks inside MoEngage campaigns

Sometimes you want to reuse a piece of dynamic code across multiple MoEngage campaigns and templates. Achieve this with MoEngage content blocks:

1. On the MoEngage dashboard side navigation, go to **Content** > **Content Blocks**.
2. Click **Create content block**.
3. Create your content block. It can be either Plain text or HTML. <img src="https://mintcdn.com/moengage/syqICryKE0qygh49/images/partner_19879758142996.png?fit=max&auto=format&n=syqICryKE0qygh49&q=85&s=901eaec06b0096b9f1c9fbac1afb6df2" alt="MoEngage content block editor with type and content options" width="2852" height="1476" data-path="images/partner_19879758142996.png" />
4. Once ready, copy the block label. You will paste this inside the Livingdocs template editor.

Next, go to the Livingdocs template editor and paste the block code:

<img src="https://mintcdn.com/moengage/syqICryKE0qygh49/images/partner_19879866340500.png?fit=max&auto=format&n=syqICryKE0qygh49&q=85&s=6368456cb779c52c122dda60b10bd720" alt="Livingdocs template editor with a MoEngage content block code pasted in" width="2852" height="1512" data-path="images/partner_19879866340500.png" />

That's it — your content block is automatically inserted into the template at the location of the code:

<img src="https://mintcdn.com/moengage/syqICryKE0qygh49/images/partner_19879891001876.png?fit=max&auto=format&n=syqICryKE0qygh49&q=85&s=e7f61f80d58538cf58c7ad9800197953" alt="Livingdocs preview showing the MoEngage content block rendered in the template" width="2852" height="1542" data-path="images/partner_19879891001876.png" />
