1. Create an Entra App in App Registrations.
2. Go to API permissions and give all the necessary permissions via Microsoft Graph. Some permissions might be superfluous. You’ll figure it out. :)
3. Generate a client secret and store it somewhere safe — you only see the value once.
4. From a terminal, exchange the client credentials for a Graph access token, then call `/teams/{team-id}/channels/{channel-id}/messages?$top=50` and page through `@odata.nextLink` until you’ve drained the channel.

```bash
curl -X POST "https://login.microsoftonline.com/$TENANT_ID/oauth2/v2.0/token" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET&scope=https://graph.microsoft.com/.default&grant_type=client_credentials"
```

5. Map each message to a Slack-compatible CSV row: `timestamp,user,channel,text`. Slack’s importer is forgiving — keep the columns simple and it ingests.
0%