knadh / listmonk

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.
https://listmonk.app
GNU Affero General Public License v3.0
14.54k stars 1.33k forks source link

Feature request: Import from CSV by generating json data #1997

Closed evrim closed 4 weeks ago

evrim commented 1 month ago

Hi there,

I must admit, I am happy with the status of the listmonk project. However, a missing feature is pretty much blocking the integration.

So, the import section requires/looks for json data for custom attributes. However, most of my clients only have access to programs such as spreadsheets (excel, ooffice, gdocs etc.) and it is pretty much not viable to tell them about json and friends.

So my questions is, is it possible to modify the 'import subscribers' functionality as defined in the following:

Data: A csv or some other tabular data file, Function #1: Look for name, email columns, import them as usual, Function #2: Import all other columns by converting them to json and assuming them as attributes.

This is crucial as I haven't found any method to make users life easier. This will make online users of collabora/onlyoffice to integrate with listmonk.

best, evrim.

benstaf commented 1 month ago

I agree that a feature that would be nice to have for basic use is the 'attribute' column to accept a string, and not only a JSON, which is overkill in many cases

Because your suggestion seems overly complicated: if then the users export to CSV the data that they imported, they will get a column 'attributes' with JSON data.

(Unless the export function is modified to blow up the JSON in separate columns. This will still be unpractical in the general case, because JSON data can be nested in different depth levels, so JSON will remain)

In my use-case, I perform a separate pre-processing step to transform strings into JSONs.

evrim commented 4 weeks ago

Hi there,

Thanks for the reply. My suggestion is not overly complicated, just a checkbox to "consider other columns as json data" data and that's all. Pretty much removes the restriction of the need of a preprocessing stage which mite be a secondary use-case for me.

Anyway, thnx.

knadh commented 4 weeks ago

Hi @evrim.

Adding support for reading flat columns as JSON attributes has multiple consequences:

The ideal solution here is for you to write a simple script or tool that accepts a CSV in the format that is suitable for your usecase, and convert that to listmonk's specific format before uploading.

benstaf commented 4 weeks ago

Hi there,

Thanks for the reply. My suggestion is not overly complicated, just a checkbox to "consider other columns as json data" data and that's all. Pretty much removes the restriction of the need of a preprocessing stage which mite be a secondary use-case for me.

Anyway, thnx.

If you really need this feature, what you can do is code a special-purpose web app to import CSV files the way you want, transform them into Listmonk format, and then send them to Listmonk through the import API : https://listmonk.app/docs/apis/import/#post-apiimportsubscribers

For example, this web app could be based on this video tutorial (in Laravel PHP), which also has code and blog:

https://youtu.be/STJV2hTO1Zs