FileRelay
Documentation
Try our Sandbox

Microsoft Teams

Send SAP documents and SharePoint links to Microsoft Teams channels via Microsoft Graph API.

Use Cases

  • Finance team delivery of new SAP documents
  • Document upload to Teams channel file tabs
  • SharePoint link notifications for governed copies

Two delivery options, both via Microsoft Graph API: post the file (recommended — uploads to the channel's Files tab plus a link message) or post a SharePoint link (for files already delivered to SharePoint).

Choose authentication

Option When to use
Entra app-only Unattended posting. Needs ChannelMessage.Send as an application permission — absent from some tenants.
Delegated user (alternative) Posts as you. Needs ChannelMessage.Send as a delegated permission plus a one-off browser dance for a refresh token. No admin consent required by default.

Graph API setup — app-only

  1. Azure Portal → Microsoft Entra ID → App registrations → New registration (e.g. "FileRelay Teams").
  2. API permissions → add Microsoft Graph application permissions:
    • ChannelMessage.Send — post channel messages
    • Files.ReadWrite.All — upload to the channel Files tab
    • Channel.ReadBasic.All — verify the channel exists during Test
  3. Grant admin consent (required).
  4. Certificates & secrets → new client secret. Note the client ID, tenant ID, and secret value.
  5. Find the team and channel IDs (see below).
  6. In FileRelay, add a Microsoft Teams destination: team + channel IDs, Entra credentials, and the delivery option.

Graph API setup — delegated user

Use this when the tenant's catalog has no app-only ChannelMessage.Send.

  1. Same app registration, but under API permissions → Delegated permissions add ChannelMessage.Send, Files.ReadWrite, and offline_access. User consent suffices (no admin consent required by default).
  2. Create the client secret as above.
  3. Under Authentication, add a redirect URI for the dance: Add a platform → Web → https://localhost/teams-dance (nothing runs there — you copy the code from the address bar).
  4. Open this URL in a browser (replace the {…} values) and sign in as the user who will own the posts: https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/authorize?client_id={client_id}&response_type=code&scope=ChannelMessage.Send%20Files.ReadWrite%20offline_access&redirect_uri=https://localhost/teams-dance
  5. After consent the browser lands on an unreachable localhost page — copy the code=… value from its address bar.
  6. Exchange the code for tokens:
    curl -X POST "https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token" \
      -d "client_id={client_id}&client_secret={client_secret}&grant_type=authorization_code" \
      -d "code={code}&redirect_uri=https://localhost/teams-dance" \
      -d "scope=ChannelMessage.Send%20Files.ReadWrite%20offline_access"
    
  7. Copy the refresh_token from the JSON response. It stays valid with use — FileRelay exchanges it on every send, so normal operation never lets it lapse.
  8. In FileRelay, add a Microsoft Teams destination in delegated mode with tenant + client + secret + refresh token. File upload and link posting work identically, posted as the consenting user.

If the dance fails with invalid_grant, the code expired (10-minute life) or the redirect URI mismatches the registered one — re-run from step 4.

REPLACE: Screenshot of the Graph API configuration in FileRelay

Test

Click Test — FileRelay mints a token and reads the channel back, proving the app, consent, and IDs are correct. Saving requires a passing test. (The test posts nothing; the first real delivery is the first proof a message lands.)

How each option delivers

Post the file — auths to Entra with client credentials, uploads the document to the channel's Files tab (backed by SharePoint), posts a channel message with a link to the file. Enrichment key-values are written to the file's library columns via metadata_mapping.

Post a SharePoint link — skips the upload and posts a channel message linking to file_url (the web URL from the SharePoint delivery). Enrichment key-values ride in the message text. Use when SharePoint holds the governed copy.

Message placeholders

message supports {fileName} and {fileUrl}, replaced per delivery.

Finding team + channel IDs

Graph Explorer:

GET https://graph.microsoft.com/v1.0/me/joinedTeams
GET https://graph.microsoft.com/v1.0/teams/{team_id}/channels

Teams app: right-click the channel name → Get link to channel. URL contains both:

https://teams.microsoft.com/l/channel/{channel_id}/...?groupId={team_id}&...

URL-decode channel_id from the path segment.

Troubleshooting

Symptom Cause / fix
401 on Test Secret wrong/expired, or admin consent missing.
404 on Test Team or channel ID wrong — re-copy from the channel link (URL-decode the channel segment).
403 on Test App permissions insufficient — the Test message names the missing grant.
File lands but no message Message post failed — the delivery row records it; retries re-post without duplicating the file (same path overwrite).

Tips

  • Private channels — the app must be explicitly authorised for the private channel.
  • Rate limits — Graph API throttles per app per tenant. FileRelay handles 429s with backoff.
  • Multiple channels — one destination per channel; attach as many to a routing rule as you need.
  • Files tab storage — uploads go to the channel's SharePoint library, so files are searchable, versioned, and reachable from SharePoint too.

Configuration Fields

FieldTypeRequiredDescription
team_idstringRequiredTeams team ID
channel_idstringRequiredTeams channel ID
include_filebooleanOptionalPost the file (true) or a SharePoint link instead (false, requires file_url)
file_urlstringOptionalSharePoint file URL for link mode
metadata_mappingobjectOptionalOur-key → library-column map for file mode (link mode embeds values in text)
messagestringOptionalCustom message text (supports {fileName} and {fileUrl} placeholders)

Credentials

FieldTypeRequiredDescription
client_idstringOptionalAzure AD App Client ID (required for Graph API mode)
client_secretstringOptionalAzure AD Client Secret (required for Graph API mode)
tenant_idstringOptionalAzure AD Tenant ID (required for Graph API mode)
refresh_tokenstringOptionalDelegated-mode refresh token (omit for app-only auth)

All credentials are encrypted at rest using envelope encryption.

Ready to set up Microsoft Teams?

Create a free account and add this connector in under 2 minutes.

Get Started Free