slides (v1)
CRITICAL — You MUST use the Read tool to read before starting, which contains authentication and permission handling rules
CRITICAL — Before generating any XML, you MUST use the Read tool to read xml-schema-quick-ref.md. Guessing XML structure from memory is strictly prohibited.
Identity Selection
Lark Slides are usually the user's own content resources.
By default, you should explicitly use (user identity) to perform slides-related operations first, always specify the identity explicitly.
- (Recommended): Create, read, and manage presentations as the currently logged-in user. Complete user authorization before execution:
bash
lark-cli auth login --domain slides
- : Only used when the user explicitly requires operation as the application identity, or when the bot needs to hold/create resources. When using the bot identity, additionally confirm whether the bot actually has access permission to the target presentation.
Execution Rules:
- For creation, reading, adding/deleting slides, and continuing to edit existing PPT according to the link provided by the user, use by default first.
- If there is insufficient permission, first check whether the bot identity is misused currently; do not fall back to bot by default.
- Only switch to when the user explicitly requires "operation with application identity / bot identity", or the current workflow is that the bot creates resources and then grants collaboration authorization.
Quick Start
Create a PPT with page content in one command (Recommended):
bash
lark-cli slides +create --title "Presentation Title" --slides '[
"<slide xmlns=\"http://www.larkoffice.com/sml/2.0\"><style><fill><fillColor color=\"rgb(245,245,245)\"/></fill></style><data><shape type=\"text\" topLeftX=\"80\" topLeftY=\"80\" width=\"800\" height=\"100\"><content textType=\"title\"><p>Page Title</p></content></shape><shape type=\"text\" topLeftX=\"80\" topLeftY=\"200\" width=\"800\" height=\"200\"><content textType=\"body\"><p>Body Content</p><ul><li><p>Key Point 1</p></li><li><p>Key Point 2</p></li></ul></content></shape></data></slide>"
]'
You can also do it in two steps (create a blank PPT first, then add pages one by one), see +create reference document for details.
The above is the minimum usable example. For richer page effects (gradient background, cards, charts, tables, etc.), refer to the Workflow and XML templates below.
Must-do Before Execution
Important:
references/slides_xml_schema_definition.xml
is the only correct source of XML protocol for this skill; other md files are only summaries of it and the CLI schema.
Required Reading (Before Each Creation)
| Document | Description |
|---|
| xml-schema-quick-ref.md | XML element and attribute quick reference, mandatory reading |
Optional Reading (Check When Needed)
| Scenario | Document |
|---|
| Need to understand detailed XML structure | xml-format-guide.md |
| Need CLI call examples | examples.md |
| Need to refer to XML of real PPT | slides_demo.xml |
| Need to use complex elements such as table/chart | slides_xml_schema_definition.xml (complete Schema) |
| Need to understand detailed parameters of a command | Reference document for the corresponding command (see the reference document section below) |
Workflow
This is a presentation, not a document. Each slide is an independent visual page, with low information density and sufficient white space in typesetting.
text
Step 1: Requirement clarification & knowledge reading
- Clarify user requirements: theme, audience, number of pages, style preference
- If the user has no clear style, recommend according to the theme (see the style judgment table below)
- Read XML Schema reference:
· xml-schema-quick-ref.md — Element and attribute quick reference
· xml-format-guide.md — Detailed structure and examples
· slides_demo.xml — Real XML example
Step 2: Generate outline → user confirmation → creation
- Generate a structured outline (title per page + key points + layout description), submit to the user for confirmation
- Less than 10 pages: Use slides +create --slides '[...]' to create PPT and add all pages in one step
- More than 10 pages: First use `slides +create` to create a blank PPT, then use `xml_presentation.slide.create` to add pages one by one
- Each slide requires complete XML: background, text, graphics, color scheme
- Complex elements (table, chart) need to refer to the original XSD
Step 3: Review & delivery
- After creation, use xml_presentations.get to read the full text XML, confirm:
· Is the number of pages correct? Is the content of each page complete?
· Is the color scheme unified? Is the font size hierarchy reasonable?
- If there is a problem → Use xml_presentation.slide.delete to delete the problematic page and recreate it
- No problem → Delivery: Inform the user of the presentation ID and access method
jq Command Template (Used When Editing Existing PPT)
It is recommended to use
for new PPTs. The following jq template is suitable for scenarios where pages are appended to existing presentations, which can avoid manually escaping double quotes:
bash
lark-cli slides xml_presentation.slide create \
--as user \
--params '{"xml_presentation_id":"YOUR_ID"}' \
--data "$(jq -n --arg content '<slide xmlns="http://www.larkoffice.com/sml/2.0">
<style><fill><fillColor color="BACKGROUND_COLOR"/></fill></style>
<data>
Place elements such as shape, line, table, chart here
</data>
</slide>' '{slide:{content:$content}}')"
Quick Style Reference Table
Note: Gradient colors must use
format with percentage stop points, such as
linear-gradient(135deg,rgba(15,23,42,1) 0%,rgba(56,97,140,1) 100%)
. Using
or omitting stop points will cause the server to fall back to white.
| Scenario/Theme | Recommended Style | Background | Primary Color | Text Color |
|---|
| Technology/AI/Product | Dark technology style | Dark blue gradient linear-gradient(135deg,rgba(15,23,42,1) 0%,rgba(56,97,140,1) 100%)
| Blue series | White |
| Business report/Quarterly summary | Light business style | Light gray | Dark blue | Dark gray |
| Education/Training | Fresh and bright style | White | Green series | Dark gray |
| Creative/Design | Gradient dynamic style | Purple-pink gradient linear-gradient(135deg,rgba(88,28,135,1) 0%,rgba(190,24,93,1) 100%)
| Pink-purple series | White |
| Weekly report/Daily report | Simple professional style | Light gray + top color gradient bar | Blue | Dark color |
| User not specified | Default simple professional style | Same as above | Same as above | Same as above |
Page Layout Suggestions
| Page Type | Layout Key Points |
|---|
| Cover page | Centered large title + subtitle + bottom information, use gradient or dark background |
| Data overview page | Indicator cards arranged horizontally (rect background + large number + small description), list or chart below |
| Content page | Left vertical line decoration + title, columns or list below |
| Comparison/Table page | table element or side-by-side cards, dark background with white text for table header |
| Chart page | chart element (column/line/pie), with text description |
| Closing page | Centered thank you message + decorative line, style echoes the cover page |
Outline Template
Use the following format when generating an outline, submit to the user for confirmation:
text
[PPT Title] — [Positioning Description], for [Target Audience]
Page Structure (N pages):
1. Cover page: [Title copy]
2. [Page theme]: [Key point 1], [Key point 2], [Key point 3]
3. [Page theme]: [Key point description]
...
N. Closing page: [Closing copy]
Style: [Color scheme], [Typesetting style]
Common Slide XML Templates
Templates that can be copied directly (cover page, content page, data card page, closing page): slide-templates.md
Core Concepts
URL Format and Token
| URL Format | Example | Token Type | Processing Method |
|---|
| https://example.larkoffice.com/slides/xxxxxxxxxxxxx
| | The token in the URL path is directly used as |
| https://example.larkoffice.com/wiki/wikcnxxxxxxxxx
| | ⚠️ Cannot be used directly, you need to query first to get the real |
Special Handling for Wiki Links (Critical!)
The knowledge base link (
) may correspond to different types of documents such as cloud documents, spreadsheets, slides, etc.
You cannot directly assume that the token in the URL is , you must first query the actual type and real token.
Processing Flow
- Use to query node information
bash
lark-cli wiki spaces get_node --as user --params '{"token":"wiki_token"}'
-
Extract key information from the returned result
- : Document type, slides correspond to
- : Real presentation token (used for subsequent operations)
- : Document title
-
After confirming that is , use as
Query Example
bash
# Query wiki node
lark-cli wiki spaces get_node --as user --params '{"token":"wikcnxxxxxxxxx"}'
Return result example:
json
{
"node": {
"obj_type": "slides",
"obj_token": "xxxxxxxxxxxx",
"title": "2026 Product Annual Summary",
"node_type": "origin",
"space_id": "1234567890"
}
}
bash
# Read slide content with obj_token
lark-cli slides xml_presentations get --as user --params '{"xml_presentation_id":"xxxxxxxxxxxx"}'
Resource Relationship
text
Wiki Space
└── Wiki Node (obj_type: slides)
└── obj_token → xml_presentation_id
Slides (Presentation)
├── xml_presentation_id (Unique identifier of presentation)
├── revision_id (Version number)
└── Slide (Presentation page)
└── slide_id (Unique identifier of page)
Shortcuts (Recommended for Priority Use)
Shortcut is a high-level encapsulation of common operations (
lark-cli slides +<verb> [flags]
). Prioritize operations with Shortcut if available.
| Shortcut | Description |
|---|
| Create PPT (optional to add pages in one step), automatic authorization in bot mode |
API Resources
bash
lark-cli schema slides.<resource>.<method> # Must check parameter structure before calling API
lark-cli slides <resource> <method> [flags] # Call API
Important: When using native API, you must first run
to view the
/
parameter structure, do not guess the field format.
xml_presentations
- — Read full PPT information, return in xml format
xml_presentation.slide
- — Create a page under the specified xml presentation
- — Delete a page under the specified xml presentation
Core Rules
- Outline first before operation: Generate an outline and submit it to the user for confirmation before creating PPT to avoid rework
- Creation process: For less than 10 pages, it is recommended to use
slides +create --slides '[...]'
to create in one step; for more than 10 pages, first use to create a blank PPT, then use xml_presentation.slide.create
to add pages one by one
- Only , , are direct child elements of : Text and graphics must be placed inside
- Text is expressed through : Must use
<content><p>...</p></content>
, cannot write text directly in shape
- Save key IDs: Subsequent operations require , ,
- Be careful with deletion: Deletion operation is irreversible, and at least one slide must be retained
Permission Table
| Method | Required scope |
|---|
| slides:presentation:create
, slides:presentation:write_only
|
| |
xml_presentation.slide.create
| slides:presentation:update
or slides:presentation:write_only
|
xml_presentation.slide.delete
| slides:presentation:update
or slides:presentation:write_only
|
Common Error Quick Check
| Error Code | Meaning | Solution |
|---|
| 400 | XML format error | Check XML syntax to ensure tags are closed |
| 400 | create content exceeds supported range | is only used to create blank PPT, do not pass complete slide content here |
| 400 | Request packaging error | Check whether is passed into or according to the schema |
| 404 | Presentation does not exist | Check whether is correct |
| 404 | Slide does not exist | Check whether is correct |
| 403 | Insufficient permission | Check whether you have the corresponding scope |
| 400 | Cannot delete the only slide | At least one slide must be retained in the presentation |
Self-check Before Creation
Before generating XML page by page, check quickly:
Symptom → Fix Table
| Observed Problem | What to Fix |
|---|
| Text is truncated/not fully visible | Increase the or of the shape |
| Elements overlap | Adjust / to increase spacing |
| Large blank area on the page | Reduce element spacing, or add content to fill |
| Text color is too close to background color | Use light text on dark background, dark text on light background |
| Unreasonable table column width | Adjust the value of in |
| Chart is not displayed | Check whether both and are included, and whether the number of / data matches |
| Gradient background turns white | Gradient must use format + percentage stop points, such as linear-gradient(135deg,rgba(30,60,114,1) 0%,rgba(59,130,246,1) 100%)
; using or omitting stop points will be reverted to white |
| Wrong gradient direction | Adjust the angle of ( horizontal, vertical, diagonal) |
| Overall style is not unified | Use the same background for cover page and closing page, maintain consistent color scheme and font size system for content pages |
| API returns 400 | Check XML syntax: tag closure, attribute quotes, special character escaping |
| API returns 3350001 | is not created via , or the token is incorrect |
Reference Documents
| Document | Description |
|---|
| lark-slides-create.md | +create Shortcut: Create PPT (supports to add pages in one step) |
| xml-schema-quick-ref.md | XML Schema simplified quick reference (mandatory reading) |
| slide-templates.md | Copyable Slide XML templates |
| xml-format-guide.md | Detailed XML structure and examples |
| examples.md | CLI call examples |
| slides_demo.xml | Complete XML of real PPT |
| slides_xml_schema_definition.xml | Complete Schema definition (only protocol basis) |
| lark-slides-xml-presentations-create.md | Details of command to create blank PPT |
| lark-slides-xml-presentations-get.md | Details of command to read PPT |
| lark-slides-xml-presentation-slide-create.md | Details of command to add slides |
| lark-slides-xml-presentation-slide-delete.md | Details of command to delete slides |
Note: If the content of md files is inconsistent with the output of
slides_xml_schema_definition.xml
or
lark-cli schema slides.<resource>.<method>
, the latter two shall prevail.