Open MikeKMiller opened 1 month ago
I think this is a really good idea, and actually should be reasonably trivial to implement. Thinking off the top of my head about a rough architecture for the input file that would work, I'd suggest just a simple list of key/value, like;
CSV Format
platformName,platformAccount,textContent,featuredImageFilename,scheduledPostDate
twitter,jamesreadtweets,"This is a Tweet from #postiz",blog1.jpg,2024-09-30T22:00
JSON Format
{
"posts": [
{
"platformName": "twitter",
"platformAccount": "jamesreadtweets",
"textContent": "This is a Tweet from #postiz",
"featuredImageFilename": "blog1.jpg",
"scheduledPostDate": "2024-09-30T22:00"
}
]
}
Same could also be possible fo YAML.
This would allow a simple loop to import posts with post times.
Optionally, scheduledPostDate could be NULL, allowing for "automatic scheduling".
This would require a new service in backend, that exposes an API endpoint like /import
and accepts single-part uploads, detected on Content-Type.
Just some initial thoughts, I think the implemtnation is easy, but the design is a bit tricky. It would be good to get other thoughts about if this approach has any downsides, or missing field names.
I'd like to work on this issue. Could you please assign it to me?
Hello @MikeKMiller :) I want to work on this issue, please assign me.
@alexandredev3 , great that you'd like to contribute. Before I assign to you, can you briefly explain how you would approach this, which files you would change?
@naaa760 , if @alexandredev3 doesn't reply after a week, then you can answer instead.
Note for further comments, please don't ask to be assigned for at least 2 weeks or you will be marked as spam - the order is @alexandredev3 and then @naaa760 .
@alexandredev3 , great that you'd like to contribute. Before I assign to you, can you briefly explain how you would approach this, which files you would change?
Thanks for the opportunity, @jamesread! Here's how I would approach the task:
It seems like a pretty straight forward task. So, I would create a new method in the PostsService
class, something like importPosts
. This method would iterate over the provided key/value pairs from the CSV or JSON input and create posts accordingly. The method would handle parsing the file, mapping fields like platformName
, platformAccount
, textContent
, featuredImageFilename
, and scheduledPostDate
to their respective post creation logic.
In terms of file changes:
PostsService
: Add the new importPosts
method here.
Controller layer
: Expose a new API endpoint (e.g., posts/import) that accepts single-part uploads (CSV or JSON), with file format detection based on Content-Type
.
Validation laye
r: Ensure that the input data is properly validated before processing (e.g., ensuring required fields are present and scheduledPostDate
follows the correct format).
Error handling
: Implement checks for missing data and provide feedback in case of invalid file formats or content.
What do you think about this approach? Let me know if there's any additional functionality you'd like to see.
🔖 Feature description
Would be helpful to be able to mass import posts that we wish to post over time via CSV/JSON. This would serve similar to #160, but allow manual import via CSV or JSON or some other format.
🎤 Why is this feature needed ?
I currently create a months worth of posts on my computer, then with CSV import them to HypeFury. HypeFury then automatically assigns them to the 'schedule' based on my predefined posting windows.
✌️ How do you aim to achieve this?
Allow CSV or JSON import of posts, along with selection of what platform(s) they should be posted to.
🔄️ Additional Information
No response
👀 Have you spent some time to check if this feature request has been raised before?
Are you willing to submit PR?
None