[SOLVED] Exporting a Team or Conversation

Hey Lindy!!! We actually got it working through the database and I’ll add it here in case anyone comes looking for it –

Substitute all query results(ID's) with your own, these are made up

psql --host=127.0.0.1 --dbname=mattermost --username=mmuser --password

###To Pull Posts from Team/Channel

#Grab Team ID
-> select id,name from teams;
b393si6pteamidqufup11i7777

#Grab Channel ID using team id
mattermost=> select id, name, teamid from channels where teamid='b393si6pteamidqufup11i7777';
m88777channelid777ch41r6gw
 
Epoch dates times 

1490760000000
1491019200000

#Grab message between date and time for specified team/channelid
select message from posts where createat BETWEEN 1490760000000 and 1491019200000 and channelid='m88777channelid777ch41r6gw';

#Export to CSV
\copy (select message from posts where createat BETWEEN 1490760000000 and 1491019200000 and channelid='m88777channelid777ch41r6gw') TO 'export_posts.csv' (format CSV);
1 Like