Showing results for 
Show  only  | Search instead for 
Did you mean: 

Archiving Posts

So we had a process of "archiving" posts that were over 1 year old within our Community.  Our process was to go board by board, find any post that was created over a year ago, post a new reply to the thread with a message stating "the thread was archived, but saved for education purposes and to create a new post if they need help," and blocking new replies.


We stopped this process because we thought that there should probably be a little more going into what gets archived besides just the date on the post.  So I wanted to get some thoughts on this.  I saw this post, and while there is some great information there, it does not seem like the right fit for our Community and the posts that we have.  We also are currently not deleteing any posts, just commenting & blocking new replies. 


How do you archive within your Community?  Do you have a specific Archive board?  How do you determine what gets archived and what does not? 


Thanks in advance

Samantha O'Connor
Community Manager
22 Replies 22

Looking to ape the archiving by too old+no reply but is there a way to hack the search query string to exclude certain boards - my results are pulling all content from archived boards!

Our developer build a component that allows us to archive topics that have not seen activity in a specified date range, board by board.

@fuenteso. Can you help Mike out a bit?

Learning from others and helping where I can!
Community Passionista!

Anything that you can share would be appreciated, @fuenteso!  The archive tool that you built is really interesting and in my opinion, really crucial to Communities. While we wait to see if Lithium will make a standard Community solution, any way to make this process easier is going to be helpful!

Samantha O'Connor
Community Manager

That would be great. Manual process is killing me! Still Spotify is getting a good workout



Sure. It's a two part tool; we have a custom component on each of the category/board pages visible only to admins/mods where they can select a time range (two simple form date fields), the board we want to 'clean' and the destination board (or archive board). Additionally we added a few options in the form of checkboxes to archived only solved threads, or archive them by original post date instead of conversation.last_post_date.


This component then calls an endpoint and send all this information as parameters. This endpoint uses an API v2 call to pull the threads


SELECT count(*) FROM messages WHERE conversation.last_post_time <= ${endDate} AND conversation.last_post_time > ${startDate} AND depth = 0 AND'${board}'

Then loop through the list and move each thread individually. We add a couple of tags to preserve the original board id and mark the thread as Archived.

<#assign apiResults = rest('/messages/id/${}/tagging/tags/add?tag.add=Archived') />
<#assign apiResults = rest('/messages/id/${}/tagging/tags/add?tag.add=source-board-id:${}') />
<#assign apiResults = rest('/messages/id/${}/move/board/id/${moveTo}?move_message.include_replies=true&move_message.ignore_notification=true') />

It might be a good idea to pull the threads in batches. For example we're processing 100 threads at a time (getting the total number of threads in scope, dividing it by 100 and then use that "page" number with OFFSET to )

<#assign resultPages = (postCount/queryLimit)?int+1 /> 
<#list 0..resultPages as page>
<#assign postsToArchive = rest(apiVersion, "/search?q=" + "SELECT id, board, conversation, view_href, metrics, post_time FROM messages WHERE conversation.last_post_time <= ${endDate} AND conversation.last_post_time > ${startDate} AND depth = 0 AND'${board}'${notSolvedQuery} ORDER BY conversation.last_post_time DESC LIMIT ${queryLimit} OFFSET ${page*queryLimit}"?url).data.items />

I also added an extra step to make sure the post's conversation.last_post_time fell into the specified date range. I think there was a bug on the API call that was returning threads that didn't meet the contraints.


Finally, the endpoint returns a JSON with useful information, like the IDs of all the threads that were moved. You can choose to create a report with this information or just ignore it.


Hope that helps, let me know if you have any questions.



This looks awesome, I've not got this deep into the code before, so please excuse my ignorant questions.
First block is an endpoint?
Next 2 blocks are new components I create and then drop into pages?

Hi @VF_MikeHales


Not exactly, that's like a general description of how it works.


I can share with you the actual code but since it was built specifically for our community it needs a certain degree of personalization for it to work on a different environment (archive board structure, board names, roles, styling, etc). 

That would be awesome and if you could mark the site-specific parts that would be great. Have managed to batch process my entire community down to one year but anything that can help automate in the future would be super cool.
Thanks again

@fuenteso, if the offer is an open one, would you mind sharing this with me, too?  I'm happy to send along my email address if that is easiest for you. 




Samantha O'Connor
Community Manager

I think @fuenteso deserves an extra call out this month 😉
Learning from others and helping where I can!
Community Passionista!

Welcome to the Technology board!

Curious about our platform? Looking to connect on social technology? You've come to the right place!

Are you a Khoros customer? For direct assistance from our Support team, please visit the Support Forum.