Only show these results:

Create a Teams Integration

In this guide, you’ll learn how to create a Microsoft Teams integration with Nylas.

You'll need to repeat the process for each account you want to connect.

Prerequisites

  • Make sure you go through the steps in Azure App.
    • Have your Azure Client ID and Secret handy.
  • A Nylas authenticated account.
    • You can follow our guides on hosted and native authentication if you need to authenticate a Nylas account.
  • Use the correct base URL based on your location:

Authenticate the Request

To authenticate the request, use your Base64 encoded <NYLAS_CLIENT_ID:CLIENT_SECRET> for basic authentication. You can use Shell or Bash to convert to base64 encoded. The command for shell is shown below:

echo ‘d57963d558d1:b35592e51016’ | base64
4oCYZDU3OTYzZDU1OGQxOmIzNTU5MmU1MTAxNuKAmQo=

Make sure to put a colon between NYLAS_CLIENT_ID and NYLAS_CLIENT_SECRET in your command.

Make a POST Request to connect/integrations

In this step, you’ll associate the Teams integration with your Nylas application.

There are two options: Single tenant and Multitenant.

Single Tenant

Single tenant requires you to pass in the tenant ID. You can find this on the Azure app's overview page.

Name Type Description
name string The name of the integration. This is for your own identification.
provider string This is always microsoft.
settings.client_id string The Client ID from Azure App.
settings.client_secret string The Client Secret from Azure App.
settings.tenant string If you're using single tenant, this is the tenant_ID. If you're using multitenant, use common.
redirect_uris array of strings An array of redirect URIs. You can have multiple URIs here but at least one needs to match the Redirect URL for OAuth in your Azure integration.
expires_in string This shows the specified expiration date of the issued JWT. The default is 14 days (1,209,600 seconds).
curl --location --request POST 'https://beta.us.nylas.com/connect/integrations' \
--header 'Authorization: Basic <NYLAS_CLIENT_ID:CLIENT_SECRET>' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Teams Test app",
"provider": "microsoft",
"settings": {
"client_id": "<AZURE_CLIENT_ID>",
"client_secret": "<AZURE_CLIENT_SECRET>",
"tenant": "<TENANT_ID>"
},
"redirect_uris": [
"https://myapp.com/callback-handler"

],
"expires_in": 1209600
}'

Response Single Tenant

{
"success": true,
"data": {
"id": "3d6d9d51-2269-434d-85b8-73d44bb86e24",
"name": "Teams Test app",
"provider": "microsoft",
"redirect_uris": [
"https://myapp.com/callback-handler"
],
"expires_in": 1209600
}
}

Multitenant

Multitenant requires that you pass in common as the tenant value.

Name Type Description
name string The name of the integration. This is for your own identification.
provider string This is always microsoft.
settings.client_id string The Client ID from Azure App.
settings.client_secret string The Client Secret from Azure App.
settings.tenant string If you're using single tenant, this is the tenant_ID. If you're using multitenant, use common.
redirect_uris array of strings An array of redirect URIs. You can have multiple URIs here but at least one needs to match the Redirect URL for OAuth in your Teams integration.
expires_in string This shows the specified expiration date of the issued JWT. The default is 14 days (1,209,600 seconds).
curl --location --request POST 'https://beta.us.nylas.com/connect/integrations' \
--header 'Authorization: Basic <NYLAS_CLIENT_ID:CLIENT_SECRET>' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Teams Test app",
"provider": "microsoft",
"settings": {
"client_id": "<AZURE_CLIENT_ID>",
"client_secret": "<AZURE_CLIENT_SECRET>",
"tenant": "common"
},
"redirect_uris": [
"https://myapp.com/callback-handler"

],
"expires_in": 1209600
}'

Response Multitenant

{
"success": true,
"data": {
"id": "3d6d9d51-2269-434d-85b8-73d44bb86e24",
"name": "Teams Test app",
"provider": "microsoft",
"redirect_uris": [
"https://myapp.com/callback-handler"
],
"expires_in": 1209600
}
}

Create a Teams Authentication Request

Now that you have a Microsoft integration, you’ll need to grant account access to Microsoft.

In this step, you’ll pass in a Nylas account_id to associate Microsoft to the correct account. The response returns the authentication URL. Make sure to review our guide on the grant endpoint for more optional fields.

Name Type Description
provider string This is always microsoft.
redirect_uri string This needs to match the Redirect URL for OAuth in your Teams integration.
expires_in string This shows the specified expiration date of the issued JWT. The default is 14 days (1,209,600 seconds). You're able to overwrite this at the grant level.
account_id string The Nylas account_id that can use the Teams integration.
scope array of strings Set the scopes you want the account to have access to in Microsoft. This is a required field.

You’ll notice some of the fields you used for Integration are also in Grants. You can set Integration defaults and override them at the Grant level.

curl --location --request POST 'https://beta.us.nylas.com/connect/auth' \
--header 'Authorization: Basic <CLIENT_ID:CLIENT_SECRET>' \
--header 'Content-Type: application/json' \
--data-raw '{
"provider": "microsoft",
"redirect_uri": "https://myapp.com/callback-handler",
"expires_in": 43200,
"account_id": "anz2nojgkfzfo4094wi291hzq",
"scope":[
"User.Read",
"offline_access",
"OnlineMeetings.ReadWrite",
"openid",
"profile",
"EAS.AccessAsUser.All",
"EWS.AccessAsUser.All"
]
}'

Response Create a Teams Auth Request

{
"success": true,
"data": {
"url": "https://beta.us.nylas.com/connect/login?id=nn9Gi0sZOdbULHuVTC8XOmLKZc1ftHlAeiAa",
"id": "nn9Gi5sZOdbULHtVTC8DOmLKZc2ftHlAeiAa",
"expires_at": 1632293094,
"request": {
"provider": "microsoft",
"redirect_uri": "https://myapp.com/callback-handler",
"scope": [
"User.Read",
"offline_access",
"OnlineMeetings.ReadWrite",
"openid",
"profile",
"EAS.AccessAsUser.All",
"EWS.AccessAsUser.All"
],
"account_id": "anz2nojgkfzfo4094wi291hzq"
}
}
}

Review our Hosted authentication endpoint documentation to learn more.

Redirect the User

In the previous step, Nylas returned an authentication URL. Direct your user to that URL so they can authenticate the account against Teams. The user will need to give consent so that the app is authorized to create conferencing objects on behalf of the user.

Nylas Directs the User

Once the user's been authenticated, Nylas will send the user to the redirect URI specified in the steps above. We’ll also include the status of the grant, the grant ID, and the provider. An example of this is shown below:

[email protected]&grant_id=377a3784-bc39-4a5f-8f57-cecfa97ba74c#   

Success!

At this point, the authentication is successful, and the user can start creating Teams meetings.

What's Next?