Git Product home page Git Product logo

teams-chat-backup's Introduction

Microsoft Teams Chat Backup

Enhancement:

I've added more options and feature for easy backup a chat:

  • Search user id through user displayname
  • Auto search for chat id
  • Add the options for
    • Skip download messages: skipmess
    • Skip download images: skipimg
    • Use Chat ID instead of user display name: usechatid
  • Add Darkmode for the final output. Adjust body to center.

Purpose and output

This project retrieves a full chat history (messages and uploaded files) and renders it as an HTML.

Requirements

Node.js 10 (or higher). Tested on macOS and Windows, but will most likely run on Linux too.

Setup

Like any other JS project, clone this repo and run the following command to install dependencies:

npm install

Run

To backup a chat with friend's display name, run:

npm run start 

To backup a chat with chat id (How to get chat id), run

npm run start usechatid

To skip download messages, run

npm run start skipmess

To skip download messages and images run

npm run start skipmess skipimg

This will ask several questions:

Chat ID

Chat Id: - If you use usechatid option, the program need chat id inorder to get the messages. Please login into MS Teams in Web browser: https://teams.microsoft.com/. Chose a chat or group or even team (channel) There will be something like that in the URL: teams.microsoft.com/_#/conversations/19:<somee_id>@thread.v2?ctx=chat ->

19:<some_id>@thread.v2 will be your chat id

Your display name: - Your display name. Example: John. If there are similar name in the company, the sugesst list will appear, you just need to re-run the program again with the correct one.

Friend's display name: - Friend's display name. Name of the guys that you want to backup chat messages.

Auth token (JWT) - this is needed for calling Microsoft Graph APIs.

  1. Go to https://developer.microsoft.com/en-us/graph/graph-explorer. At the top right side, under User icon, click it to sign-in.
  2. After having logged in, on the right side (where you clicked for login), click on the User's Icon and then click Consent to permissions. Enable Chat.Read and User.ReadBasic.All
  3. In the Main Window, you will see multilples tab name like Request body, Request headers, etc. Click on the tab Access token . Copy this value.

Note:

  • Your name, when first inputed, will be cached, for later use. If you want to clear it. Please remove the folder: teams-chat-backup\dat\
  • You Access Token (JWT): when first inputed, will be cached for later use

The out put will be

The exported folder (will be created in the teams-chat-backup\out\ directory in this project). And the name of sub folder is the name of your friend's displayname.

Output

An exported chat contains:

  • messages-#####.json: these are the pages of messages. Page 0000 is the most recent one (pages and messages within are in reverse order).
  • image-#####: these are images uploaded in the chat
  • index.html: is the full history rendered into a simple HTML template, referring to the downloaded images. This is the file you want for viewing.

To Do

  • Make an easier way of obtaining a token.
  • Add support for bot messages (for example a form).

teams-chat-backup's People

Contributors

edgraaff avatar dependabot[bot] avatar cicadacinema avatar lengocthuong15 avatar

Stargazers

 avatar

Forkers

ats-myo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.