Chatty

Database Location

The SMS content and associated metadata is stored in a database at /home/purism/.purple/chatty/db/chatty-history.db.

Export Chatty messages (SMS, Matrix)

You can export the messages from Chatty with a few commands.

Note

SQL is a very powerful language to search for data in databases, and the possibilities are so numerous, we cannot cover every single possible use-case out there. The steps we provide should provide you a good starting place to explore on your own.

  1. Install sqlite3 from the Terminal application.

    sudo apt install sqlite3
    
  2. Open the Terminal and create a Sqlite connection to the database.

sqlite /home/purism/.purple/chatty/db/chatty-history.db
  1. Find the thread_id values for the messages that are desired. Write down the IDs for later.

SELECT m.thread_id, m.time, m.body FROM messages AS m;
  1. Switch the output mode to a parsable format, add the column headers, and declare the output file name. For this guide, the CSV format will be used, however, please refer to the Sqlite command line shell reference for the other available formats.

    .mode csv
    .headers on
    

    Note

    • .mode sets the output format.

    • .headers on will add the column names to the top of the output.

  2. By default, the column output will be separated by commas. If you want to change the separator, enter the .separator mode and provide the separator value. The example below sets it to the caret character (^) but you can set it to almost anything.

    .separator ^
    
  3. Run a test SELECT query to check that the output is what you want.

    Important

    Replace the part that say :thread_id with the thread ID value obtained earlier.

    SELECT m.time, m.body FROM messages AS m WHERE m.thread_id = :thread_id ORDER BY m.time ASC;
    

    If you have multiple thread IDs, use IN instead of = like so:

    SELECT m.time, m.body FROM messages AS m WHERE m.thread_id IN (:thread_id1, :thread_id2) ORDER BY m.time ASC;
    
  4. If the output looks good, enable file output and set the file name.

    .out my_messages.csv
    

    Note

    In this guide, the file is placed in the current directory from where the sqlite3 command was invoked.

  5. Run the same SQL query as before to export the data this time. Because of the .out command used earlier, the output of the query will be written to the specified file, though the query result will not be printed to the screen so make sure the query is correct.