You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I think this is not really a bolt-python question but rather a general slack api question.
I would like to write a slack integration that periodically updates a canvas with updated business numbers. So kind of (mis)use canvas as some sort of simple "dashboard" for my team.
I see 2 options:
Delete the previous canvas and create an entirely new one with the update content by using client.canvases_delete(canvas_id) and client.canvases_create(...)
Use client.canvases_edit( canvas_id= canvas_id, changes= [...]) but for that it seems that I have to look up section id's of the content with client.canvases_sections_lookup(...). So I thought about getting the full content of the canvas with client.canvases_sections_lookup(...) and then do delete operations for each piece of content and the fill the empty canvas with the updated content with insert operations.
I prefer the option number 2 because then the same canvas instance is kept and update and can be marked as the one that should be opened as a secondary view when the slack channel is opened.
However, it looks like I cannot lookup other content type on the canvas apart from headers with client.canvases_sections_lookup(...). i.e. Could I delete a markdown table or paragraph or any simple text that is displayed inside the canvas somehow with your SDK? Do I miss anything?
The text was updated successfully, but these errors were encountered:
I think #2 would be the best approach! You are correct that for the canvases.sections.lookup API it is currently limited to headers and header names. It seems like it will still pull the "section" however, so as long as a markdown table or paragraph is under that specific header section, it seems like it should be able to delete the whole section under the found header.
Unfortunately it doesn't seem to work that deleting the headline also deletes something below it or maybe I set up the canvas content (I only tried markdown) somehow wrong.
I create a canvas like this:
content="""# Headline 1This is my canvas content## Headline 2this is the section 2 with a random int Some **bold** text### Headline 3Some _italic_ text"""response=awaitclient.canvases_create(
title="Test Canvas",
document_content={
"type": "markdown",
"markdown": content
},
channel_id=channel_id,
)
canvas_id=response["canvas_id"]
With the code above the canvas looks like this:
Then I want to clear the content with the canvases_sections_lookup method with the following code:
The result of the code above is that only the headers are deleted from the canvas:
Thanks again for your help, but looks like the current API is limiting to achieve what I want to achieve or is there another way to define content without markdown to create "sections" in another format so that deleting all sections could result in clearing the canvas?
Hello,
I think this is not really a bolt-python question but rather a general slack api question.
I would like to write a slack integration that periodically updates a canvas with updated business numbers. So kind of (mis)use canvas as some sort of simple "dashboard" for my team.
I see 2 options:
client.canvases_delete(canvas_id)
andclient.canvases_create(...)
client.canvases_edit( canvas_id= canvas_id, changes= [...])
but for that it seems that I have to look up section id's of the content withclient.canvases_sections_lookup(...)
. So I thought about getting the full content of the canvas withclient.canvases_sections_lookup(...)
and then do delete operations for each piece of content and the fill the empty canvas with the updated content with insert operations.I prefer the option number 2 because then the same canvas instance is kept and update and can be marked as the one that should be opened as a secondary view when the slack channel is opened.
However, it looks like I cannot lookup other content type on the canvas apart from headers with
client.canvases_sections_lookup(...)
. i.e. Could I delete a markdown table or paragraph or any simple text that is displayed inside the canvas somehow with your SDK? Do I miss anything?The text was updated successfully, but these errors were encountered: