Skip to content

Aggsel/messenger-sqlite-builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Messenger Archive SQLite Database Builder

This is a script used to create a SQLite database from exported facebook messenger JSON data.

Usage

  1. Request and download a collection of messages in JSON format from Facebook
  2. Clone the repo
  3. Set the following environment variables, or alternatively create a file .env file in the root directory with the configuration:
    CONVERSATION_PATH=/PATH/TO/ROOT/CONVERSATION/FOLDER/messages/inbox/chat/
    DATABASE_NAME=database.db
  1. Run the script: python main.py

JSON Schema

A more in-depth description of the JSON-schema used for the data export can be found here.

Database Tables

These are the tables and corresponding fields generated in the database by the script.

audiofiles

Field Comment
message_id Corresponds to a message id in the messages table.
uri URI to audio file resource.
creation_timestamp

gifs

Field Comment
message_id Corresponds to a message id in the messages table.
uri URI to gif resource.

messages

Field Comment
message_id Unique message id.
sender_name Person who sent the message.
timestamp When the message was sent.
content The actual message sent.
type Can one of 5 values: Generic, Share, Subscribe, Unsubscribe or Call
is_unsent Is true if the message was removed by the sender.
photos_count The number of photos sent.
videos_count The number of videos sent.
sticker_count The number of stickers sent.
audioclip_count The number of audioclips sent.
gif_count The number of gifs sent.
files_count The number of files sent.
users_count The number of users who were added or removed. Only applicable of message types Unsubscribe and Subscribe.
call_duration The duration of a call. Only applicable for message type Call.
reaction_count The number of reactions received for the message.

participants

NOTE: The JSON files participants object will only contain the participants at the time of the export. This table however will contain all users who've ever been in the conversation.

Field Comment
participant_id Unique participant id
name Name of participant

photos

Field Comment
message_id Corresponds to a message id in the messages table.
uri URI to photo.
creation_timestamp

reactions

Field Comment
message_id Message id which the reaction was made on.
actor Name of person who reacted on the message.
reaction Emoji depicting which reaction was made.

share

Field Comment
message_id Corresponds to a message id in the messages table.
link Link which was shared.
share_text Used when sharing locations.

subscriptions

Field Comment
message_id Corresponds to a message id in the messages table.
subscription_type Can be either Subscribe or Unsubscribe depending on adding or removing user from conversation.
user The user who was removed or added to the conversation. The message table contains information on who removed/added the user in this table.

videos

Field Comment
message_id Corresponds to a message id in the messages table.
uri URI to video.
creation_timestamp
thumbnail_uri URI to video (same as uri field as of today).

About

A script used to create a SQLite database from exported Facebook Messenger JSON data.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages