Skip to content
This repository was archived by the owner on Mar 22, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions components/ClearPoint Confluence/confluence_get_page_component.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
from langflow.custom import Component
from langflow.io import Output, SecretStrInput, MessageTextInput,StrInput,BoolInput
from atlassian import Confluence
from typing import List
from langflow.schema import Data, DataFrame


class ConfluenceGetPageComponent(Component):
display_name = "Confluence Get Page"
description = (
"Fetches the content of a Confluence page by its page ID."
)
icon = "file"
name = "ConfluenceGetPageComponent"

inputs = [
StrInput(
name="CONFLUENCE_SERVER_URL",
display_name="Confluence Server URL",
required=True,
),
StrInput(
name="CONFLUENCE_USERNAME",
display_name="Confluence Username",
required=True,
),
SecretStrInput(
name="CONFLUENCE_API_KEY",
display_name="Confluence API Key",
required=True,
),
MessageTextInput(
name="page_id",
display_name="Page ID",
info="The ID of the page to fetch from Confluence.",
tool_mode=True,
)
]

outputs = [
Output(
name="page_content",
display_name="Page",
method="get_page",
info="The page content as a Data object."
)
]

def get_page(self) -> List[Data]:
# HACK: make copy of inputs to avoid race condition. not guareenteed to work. See https://github.com/langflow-ai/langflow/issues/8791
page_id = self.page_id

# create the confluence client
confluence = Confluence( url=self.CONFLUENCE_SERVER_URL,
username=self.CONFLUENCE_USERNAME,
password=self.CONFLUENCE_API_KEY)

# Get the page by ID and expand the body and children
page = confluence.get_page_by_id(page_id=page_id, expand='body.storage')

page_content = {
'id': page['id'],
'title': page['title'],
'content': page['body']['storage']['value'],
}

self.status = page_content
return Data(data=page_content)
128 changes: 128 additions & 0 deletions components/ClearPoint Confluence/confluence_search_pages_component.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
from langflow.custom import Component
from langflow.io import Output, SecretStrInput, MessageTextInput,StrInput,BoolInput
from atlassian import Confluence
from typing import List
from langflow.schema import Data, DataFrame


class ConfluenceSearchPagesComponent(Component):
display_name = "Confluence Search Pages"
description = (
"Returns the matching pages in Confluence based on the provided CQL search query."
)
icon = "file-search"
name = "ConfluenceSearchPagesComponent"

inputs = [
StrInput(
name="CONFLUENCE_SERVER_URL",
display_name="Confluence Server URL",
required=True,
),
StrInput(
name="CONFLUENCE_USERNAME",
display_name="Confluence Username",
required=True,
),
SecretStrInput(
name="CONFLUENCE_API_KEY",
display_name="Confluence API Key",
required=True,
),
MessageTextInput(
name="cql_query",
display_name="CQL query ",
info="The CQL query to use to search for pages in Confluence.",
tool_mode=True,
),
MessageTextInput(
name="expand_properties",
display_name="Properties to Expand",
info="A comma-separated list of properties to expand on in the search result.",
tool_mode=True,
)
]

outputs = [
Output(
name="pages",
display_name="List of Pages",
method="search_pages",
info="Matching pages as a list of Data objects."
),
Output(
display_name="DataFrame of Pages",
name="dataframe",
method="build_dataframe",
info="Matching pages in a DataFrame.",
),
]

def search_pages(self) -> List[Data]:
# HACK: make copy of inputs to avoid race condition. not guareenteed to work. See https://github.com/langflow-ai/langflow/issues/8791
cql_query = self.cql_query
expand_properties = self.expand_properties


# create the confluence client
confluence = Confluence( url=self.CONFLUENCE_SERVER_URL,
username=self.CONFLUENCE_USERNAME,
password=self.CONFLUENCE_API_KEY)

if expand_properties.strip() == "":
expand_properties = None
else:
# split the properties by comma and strip whitespace
expand_properties_list = [prop.strip() for prop in expand_properties.split(",") if prop.strip()]

# see https://github.com/atlassian-api/atlassian-python-api/blob/705b26f8674334d663847774e21a38d718cf0dd3/atlassian/confluence/__init__.py#L2748
response = confluence.cql(cql_query,expand=expand_properties)


# build list of pages
pages_list = []
for page in response["results"]:

page_data = {
"id": page["content"]["id"],
"title": page["content"]["title"],
"excerpt": page.get("excerpt", ""),
}

if expand_properties:
for prop in expand_properties_list:
prop_nodes = prop.split(".")
# traverse the nested properties
value = page
for node in prop_nodes:
if isinstance(value, dict) and node in value:
value = value[node]
else:
value = None
break

# if value is not None, add it to the page data
if value:
page_data[prop.replace(".","_")] = value # can't have dots in key names, value get's lost in langflow

pages_list.append(Data(data=page_data))

self.status = pages_list
return pages_list



def build_dataframe(self) -> DataFrame:
# trigger the saerch
issues = self.search_pages()

# convert results to list of dict
rows = []
for issue in issues:
rows.append(dict(issue.data))

# convert list of dict to DataFrame
df_result = DataFrame(rows)

self.status = df_result
return df_result
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
from langflow.custom import Component
from langflow.io import Output, SecretStrInput, MessageTextInput,StrInput,MultilineInput
from atlassian import Confluence
from typing import List
from langflow.schema import Data, DataFrame


class ConfluenceUpdatePageComponent(Component):
display_name = "Confluence Update Page"
description = (
"Updates the content of a Confluence page."
)
icon = "file-pen-line"
name = "ConfluenceUpdatePageComponent"

inputs = [
StrInput(
name="CONFLUENCE_SERVER_URL",
display_name="Confluence Server URL",
required=True,
),
StrInput(
name="CONFLUENCE_USERNAME",
display_name="Confluence Username",
required=True,
),
SecretStrInput(
name="CONFLUENCE_API_KEY",
display_name="Confluence API Key",
required=True,
),
MessageTextInput(
name="page_id",
display_name="Page ID",
info="The ID of the page to update in Confluence.",
tool_mode=True,
),
MultilineInput(
name="content",
display_name="Page Content",
info="The content to update the Confluence page with. Content must be formatted using Confluence's storage format.",
tool_mode=True,
)
]

outputs = [
Output(
name="results",
display_name="Results",
method="update_page",
info="The results of the Confluence update page content operation."
)
]

def update_page(self) -> List[Data]:
# HACK: make copy of inputs to avoid race condition. not guareenteed to work. See https://github.com/langflow-ai/langflow/issues/8791
page_id = self.page_id
content = self.content

# create the confluence client
confluence = Confluence( url=self.CONFLUENCE_SERVER_URL,
username=self.CONFLUENCE_USERNAME,
password=self.CONFLUENCE_API_KEY)

# page title is required for update so fetch current page title
page = confluence.get_page_by_id(page_id=page_id)
page_title= page['title']

# Update the page
updated_page = confluence.update_page(
page_id=page_id,
title=page_title,
body=content,
representation='storage'
)

# build a results payload
results = {"page_id": page_id, "status": "Content updated successfully"}

self.status = results
return Data(data=results)