Connect Confluence
Tasks call Confluence through qbash.integrations.confluence with an Atlassian account email and API token you store on the Connectors page. The connector searches with CQL, reads pages and blog posts as markdown, walks spaces and the page tree, and reads versions, comments, attachments, labels, tasks and databases. It creates and updates pages, blog posts, folders and comments, adds and removes labels, uploads attachments, marks tasks complete and moves content to the trash.
The connector works with Confluence Cloud sites on atlassian.net. It acts as the account the token belongs to, so it sees and changes what that account can in Confluence.
After you connect Confluence, you can add its tools to a qbash MCP server for ChatGPT, Claude and other MCP clients, or call it from a Python task.
Create an API token
- Sign in to the Atlassian account the connector should act as. A dedicated account for automation keeps its access separate from a person's.
- Open API tokens in your Atlassian account settings.
- Click Create API token. Use this button, not Create API token with scopes. Name the token and pick an expiry date. Atlassian caps it at one year.
- Copy the token. Atlassian shows it once.
The token reaches every Atlassian product the account can use on every site, so a token you already use for Jira on the same site works here too.
Add the credential in qbash
- Open Connectors, then Confluence, and click Connect.
- Fill in Credential Name, such as "Team wiki".
- Paste the site address into Site URL, such as
https://acme.atlassian.net. A link to any page on the site works too. - Enter the account's email in Atlassian account email and paste the token into API token.
- Save. qbash lists one space on your site to check the email and token, and refuses the credential when Confluence rejects them.
- In the task editor, choose Add connector from the Package + menu and select the credential. See Task resources.
Search and read pages from a task
hits = qbash.integrations.confluence.search(
cql='text ~ "on-call" AND type = page ORDER BY lastmodified DESC', limit=5
)
for hit in hits["results"]:
page = qbash.integrations.confluence.get_content(content_id=hit["id"])
qbash.log(f'{page["content"]["title"]}: {len(page["body"] or "")} characters')
search sends your CQL to Confluence unchanged, so filters such as space = ENG, label = "runbook" and lastmodified >= now("-7d") work as they do in Confluence's advanced search. get_content takes a content id or a page link and returns the body as markdown. Pass body_format="storage" for Confluence's XHTML, with macros intact.
List methods return next_cursor. Pass it back as cursor until it is None. The SDK Reference lists every method and its parameters.
Write a page
qbash.integrations.confluence.create_page(
space="ENG",
title="Weekly incident summary",
body="## Incidents\n\n| Date | Service | Minutes down |\n| --- | --- | --- |\n| Dec 1 | api | 12 |",
parent_id="123456",
)
Bodies are markdown by default. Headings, lists, tables, links and code blocks carry over. For panels, mentions, task lists or other macros, write Confluence's storage format and pass body_format="storage". Every write method accepts read_only=True, which checks the call and returns the request it would send without changing anything.
Methods
| Method | Resource | Access |
|---|---|---|
search | Content | Read |
search_users | Users | Read |
get_content | Content | Read |
list_spaces | Spaces | Read |
get_space | Spaces | Read |
list_space_content | Content | Read |
get_children | Page tree | Read |
get_descendants | Page tree | Read |
get_ancestors | Page tree | Read |
list_versions | Versions | Read |
list_comments | Comments | Read |
list_attachments | Attachments | Read |
download_attachment | Attachments | Read |
list_labels | Labels | Read |
list_tasks | Tasks | Read |
list_database_entries | Databases | Read |
get_users | Users | Read |
create_page | Content | Write |
update_page | Content | Write |
create_folder | Content | Write |
add_comment | Comments | Write |
update_comment | Comments | Write |
add_labels | Labels | Write |
remove_label | Labels | Write |
upload_attachment | Attachments | Write |
update_task | Tasks | Write |
trash_content | Content | Write |
Limits and details
update_pagereplaces the whole body. To change one section, read the page withbody_format="storage", edit the XHTML and write it back with the same format. Pass the version you read asexpected_versionand the update is refused if someone saved the page in between.list_commentsreturns footer comments by default. Call it again withkind="inline"for comments on highlighted text.get_contentreads a whiteboard's title and place in the tree, but not its drawing.trash_contentmoves content to the space's trash, where a space admin can restore it.upload_attachmenttakes files up to 50 MB. A file with the same name as one already on the page becomes its new version.- Confluence's search index can lag behind a page saved seconds ago.
- A 401 marks the credential as needing a new token, which happens when the token expires or is revoked. Create a new token and update the credential. A 403 means the account cannot see or change that content, and the message includes Confluence's reason.
- Error messages never contain the token.