Microsoft Graph: Import Third Party Platform Messages In Teams

Managing multiple points of interactions across diverse messaging platforms is not only tedious but also becomes a point of confusion with potential loss of information. What is discussed in one platform is not always carried ahead in other platforms.

For instance, if a company uses Microsoft Teams for internal interaction, and quite another platform with stakeholders and clients, chances are the project manager or client servicing manager might miss an update in one platform or the other or in both.

Taking cognizance of this, Microsoft Graph has launched a seamless capture of critical conversations and information in the messages in customers’ legacy platforms. The Microsoft Graph APIs enable the migration of messages to Microsoft Teams. Microsoft has launched a public preview last October of APIs which enabled importing of third-party platform messages to Teams. These APIs are now GA. One can now import channel messages into a new team, specify the message sender, add timestamp and link to files.

What is the Microsoft Teams Import API?

The new APIs within Microsoft Graph allows to programmatically import third-party platform messages into Microsoft Teams. It is not platform specific, meaning these APIs can be used for any third-party messaging system, or it could even be Teams itself (Teams to Teams migrations). This new functionality is now generally available for Microsoft 365 commercial clients.

How to import?

There are 5 basic parameters for the import process:

  • Create a team with a back-in-time timestamp
  • Create a channel with a back-in-time timestamp
  • Import external back-in-time dated messages
  • Complete the team and channel migration process
  • Add team members

Requirements before using the new Import API include:

  • Analyze and prepare message data
  • Review the third-party data to decide what will be migrated
  • Extract the selected data from the third-party chat system
  • Map the third-party chat structure to the Teams structure
  • Convert import data into format needed for migration

Set up your Office 365 tenant:

  • Ensure that an Office 365 tenant exists for the import data
  • Make sure that team members are in Azure Active Directory (AAD)

Working remotely expedite your teams adoption blog banner

Once all the parameters are checked, this is how one can set up the APIs

1. Create a team

Before initiating data migration, create a new team with a back-in-time timestamp using the team resource 'createdDateTime' property. This is essential, as existing data needs to be migrated, with the original message timestamps and prevent any messaging activity during the migration process. When the above property is made, place the new team in migration mode - a state that bars users from most activities until the migration process is done. Include the 'teamCreationMode' instance attribute with the migration value in the POST request to explicitly identify the new team as being created for migration. Remember, this process is only for past messages, if there's 400 Bad Request check the date time attribute and also if 'teamCreationMode' is set to invalid value.

2. Create a channel

Similar to the process of creating a team, while creating a new channel, a back-in-time (past data) timestamp should be made using the channel resource 'createdDateTime' property. Just as in creating a team, setting the new channel in migration mode will prevent most chat activities within the channel till the process is complete. Include the 'channelCreationMode' instance attribute with the migration value in the POST request to explicitly identify the new team as being created for migration. And again if there's an error, check the date time attribute and also if 'channelCreationMode' is set to invalid value.

3. Import messages

With the creation of a new team and channel, one can begin sending back-in-time messages using the 'createdDateTime' and 'from' keys in the request body. Ensure messages imported with 'createdDateTime' is no earlier than the message thread 'createdDateTime'; the 'createdDateTime' is unique across messages in the same thread and supports timestamps with milliseconds precision.

An example, if the incoming request message has the value of createdDateTime set as 2020-09-16T05:50:31.0025302Z, then it would be converted to 2020-09-16T05:50:31.002Z when the message is ingested.

Unleash the Power of MS Power Platform & Build Biz Solutions 3X Faster

4. Complete migration mode

At the end of the message migration process, both the team and channel are taken out from the migration mode using the 'completeMigration' attribution. By this, the team and channel is open for general use by team members. The action is bound to the team instance. All channels must be completed out of migration mode before the team can be completed.

5. Add team members

Add relevant members to a team with the Team UI or Microsoft Graph Add member API

Microsoft graph enables brands protect their sensitive user information and digital business assets while fostering productivity and seamless collaboration within business functions and teams.

Espire Infolabs is a Global Partner for Microsoft Teams implementation. We have been continuously transforming the digital journey of our clients with an impressive customer experience delivery, aligning to their business objectives & ensuring positive business benefits. Drop us your feedback at and stay tuned to this space for recent trends and insights around everything digital!

Subscribe To Our Blog

By clicking on "SUBSCRIBE NOW" you acknowledge having read our Privacy Notice.

Let's get you started on the digital-first & transformation journey. Reserve your free consultation or a demo today!