Only show these results:

Create a Teams Integration

You’ll learn how to create a Teams integration with Nylas.

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

Prerequisites

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.

echo ‘d57963d558d1:b35592e51016’ | base64
4oCYZDU3OTYzZDU1OGQxOmIzNTU5MmU1MTAxNuKAmQo=

Make sure there is a colon between NYLAS_CLIENT_ID and NYLAS_CLIENT_SECRET.

Step 1: Make a POST Request to connect/integrations

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

There are two options based on 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 Name of the integration. This is for your own identification.
provider string Always microsoft
settings.client_id string The client ID from Create a Azure App.
settings.client_secret string The client secret from Create a Azure App
settings.tenant string If using single tenant, the tenant_ID. If using multitenant, then use common.
redirect_uris array of strings An array of redirect URIs. You can have multiple URIs here. At least one needs to match the Redirect URL for OAuth in your Azure integration.
expires_in string Issue the JWT token with the specified expiration date. Defaults to 14 days (1,209,600 seconds) optional.
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 you pass in common as the tenant value.

Name Type Description
name string Name of the integration. This is for your own identification.
provider string Always microsoft
settings.client_id string The client ID from Create a Azure App.
settings.client_secret string The client secret from Create a Azure App
settings.tenant string If using single tenant, the tenant_ID. If using multitenant, then use common.
redirect_uris array of strings An array of redirect URIs. You can have multiple URIs here. At least one needs to match the Redirect URL for OAuth in your Teams integration.
expires_in string Issue the JWT token with the specified expiration date. Defaults to 14 days (1,209,600 seconds) optional.
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
}
}

Step 2: Create a Teams Auth Request

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

During 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 the Grant endpoint for more optional fields.

Name Type Description
provider string Always microsoft
redirect_uri string Needs to match the Redirect URL for OAuth in your Teams integration.
expires_in string Issue the JWT token with the specified expiration date. Defaults to 14 days (1,209,600 seconds) optional. You're able to overwrite at the grant level
account_id string Nylas account_id that can use the Teams integration.
scope array of strings Set the scopes you want the account to have access to on 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 but 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"
}
}
}

Step 3: Redirect the User

In Step 2: Create a Teams Auth Request, 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.

Step 4: Nylas Directs the User

Once the user has been authenticated, Nylas will send the user to the redirect URI specified in Step 1 or Step 2. We’ll also include the status of the grant, grant ID, and provider.

[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?