Migrate from mattermost API and DB help

Hello everyone! I’m trying to migrate from Mattermost to RocketChat. Both are self-hosted in Docker containers.

I’m extracting Mattermost data directly from a PostgreSQL database and sending it to RocketChat via the API.
I’ve successfully migrated users, channels, and private channels, but I’m stuck on messages.

When I transfer messages via the API, there’s no way to set the timestamp. As a result, the messages appear in the chat as if they were sent just now, whereas I need them to display with the correct date.

If I try inserting data directly into MongoDB, the messages don’t appear in the chat.

So I have two questions:

1 Is it possible to send a message in such a way that it appears with a past date?

2 How can I make Rocket.Chat display messages that were inserted directly into MongoDB?

Hi.

Can you tell a bit about your Rocket setup please?

Like this:

Any specific reasons why you are moving? Just curious as to what your needs are!

Yes messages will be tricky. I think it needs a direct injection to the DB.

I’ll try & see if anyone backstage has experience.

Why i want to migrate:

MM Mobile app getting worse for several years, slow UI, messaging, etc. My team mostly mobile app users, so we want to move to something different.

Seems like I figured it out.

No, api does not have such fields.

Before put data into mongo database message object must include _id field. After reading code i notice that id is random generated string not object, if message missing this - mongo generate _id as an object. So i just implement code like RC uses in internal libs in my importer and it works.

Thanks!

Cool. Nice to know and welcome!

Yes I did say that…

And…

Excellent.

Be good if you can post some code for others (open source is about sharing!)