Microsoft Teams is cloud-based team collaboration software that offers core capabilities, including business messaging, calling, video meetings and file sharing. Businesses of all sizes can use Teams, which can be accessed via desktop, any internet-connected device and the Teams mobile app.Microsoft Teams integrates with other Microsoft business applications, including Exchange, PowerPoint and SharePoint Microsoft Teams provide features like chat, calls, video conferencing, screen sharing, polling, webinars, etc.
This article provides you an overview to get started with the Microsoft Teams connector in Peliqan. Please contact support if you have any additional questions or remarks.
Contents
- Contents
- Terminology
- Discovering Team ID
- Discovering Channel ID
- Discovering Chat ID
- Connecting Microsoft Teams in Peliqan
- Authentication
- Microsoft Teams Data Activation
- Creating a Channel
- Retrieving all Channels
- Sending message to a channel
- Get all users under the tenant
- Finding a Chat
- Creating a Chat
- Sending message to a chat
- Template: send alert to MS Teams
Terminology
- Team : Teams are groups of people who connect and collaborate on work and other projects.
- Channel : Within each team, users can create channels to organize their communications by topic, like news items, monthly reports or more lighthearted chats. A channel can be public or private. Private channel is the most secured way to share confidential data.
- Chat : Chat lets you connect with others, stay up to date on projects, and express yourself. It helps directly reaching out to teammates or any external person directly. Chats can be One-On-One and Group Chats.
- Mentions : Users can use mentions to message and alert other users
- Feeds : The activity feed provides a summary of messages, replies, mentions and other activities happening within team channels
- Threads : A series of messages creates a thread. Users replying to a message should select the Reply option instead of creating a new conversation and thread.
Discovering Team ID
- Open Microsoft Teams App.
- On the left toolbar, click on Teams icon.
- Once inside Teams, click on 3-dots at the right of the Team name and a pop-up menu will appear
- On pop-up menu, click on “Get link to Team”.
- A pop-up window will appear on the screen with Team URL. On the URL, copy value of groupId
Discovering Channel ID
- Open Microsoft Teams App.
- On the left toolbar, click on Teams icon. Inside teams, select any Channel.
- On right side of Channel Name, click on 3-dots and a pop-up menu will appear. On pop-up menu click in “Get Link to Channel”
- A pop-up window will appear on the screen with Channel URL. On the URL, copy URL encoded Channel ID placed between channel and general in URL.
Sample URL : https://teams.microsoft.com/l/channel/19%3Ad9Mcx84nowbsPcSgbvJwx7wKE-onikns_xxxxxE1%40thread.tacv2/General?groupId={team_id}&tenantId={tenant_id}
Discovering Chat ID
There are many ways to get Chat ID of a conversation, either Group Chat or one-to-one chat.
- Using Microsoft Teams Web :
- Open Microsoft Teams on browser. Use : https://teams.microsoft.com
- Open the desired chat. In the URL, one can find the chat ID after “conversations”. This feature is only supported in Classic Teams(v1)
- Using Peliqan Data Activation functions to get desired Chat providing the other user’s display Name(for one-to-one chat, like Peliqan Dev in the picture above) or Topic Name( for group chats).
This method is detailed under Microsoft Teams Data Activation( see below)
Connecting Microsoft Teams in Peliqan
Peliqan connects to Microsoft Teams performing OAuth flow. Peliqan App is verified by microsoft and signs in on behalf of the user once Authorization flow is completed.
Authentication
- Start the OAuth Connection flow by clicking on ‘Connect Microsoft Teams Writeback’.
- If you are signed in with multiple Microsoft accounts on browser, select the Microsoft Teams account and authenticate yourself by entering credentials.
- Allow Peliqan app to login on your behalf and access Microsoft Teams Data.
- Once OAuth flow is completed, you will be redirected back to Peliqan to perform Writeback operations.
Microsoft Teams Data Activation
Peliqan provides lot of data activation function which enables users to communicate with Microsoft Teams application through Python Scripts.
Supposably, we have already a team account and we fetch Team ID using the method mentioned above.
Creating a Channel
“Add Channel” data activation method helps creating a channel. It requires a team and compulsory details for the channel.
Retrieving all Channels
“Get Channels” data activation method helps fetching all channels under the team. It requires a team ID.
It returns list of channel objects present.
Sending message to a channel
“Add Channel Message” data activation method is used to send a message to a chanel. It requires Team_Id, desired Channel ID and message content.
Get all users under the tenant
“Get Users” function gets you all the users under the same tenant or organisatons.
Results from these functions are useful while creating a chat, fetching chat id or sending message into a chat.
Finding a Chat
Chat can be one-on-one( having two members) or group( with at least 2 members).
- Find One One-On-One Chat
- Find Group Chat
“Find OneonOne Chat” method is used to get one-on-one chat details by simply providing displayName of the other member. DisplayName of the user is unique and cannot be edited.
“Find Group Chat” method details about a group chat by providing the Topic name of the Group.
Creating a Chat
Chat can be one-to-one or in a group. To add people in a chat this function requires user_id of intended participants.
“Add Chat” function required user ids of members in user.binddata and type of chat( blue boxes). One can also decide the membership type of the user( red box) . Additionally, one can define multiple roles for a user like owner or guest.( green boxes)
One-on-One Chat
‘chatType’ for one-to-one chat has ‘chatType’ as ‘oneOnOne’. Point to remember, one-to-one chat can have at most 2 members
Group Chat
For Group chat, chatType changes to “group” and a group must have at least 2 members.
Sending message to a chat
“Add Chat Message” data activation function enables you to send message to a teams chat either oneOnOne or Group with Chat ID being provided.
Peliqan provides two ways to find finding the chat ID which are :
- Getting list of all the chats and fetching the required chat ID
- “Get Chats” function provides a list of chats having chat object where each object contains chat metadata which includes Chat displayName, Chat ID, last message sent, type of chat, members involved,etc.
- Required chat ID can be pulled from the list.
- Now from the list, get the desired Chat ID and send a message using “Add Chat Message” activation function.
- Finding one specific Chat based on details provided by user and sending message.
This method is available for chatType as one-to-one where we provide other member displayName and in response we get chatDetails.
“FindOne Chat” function is used which requires displayName to be passed as argument.DisplayName:
Now pulling chat_id from the same response we pass it to “Add Chat Message” method to send a message to the chat.
- Sending HyperLink in message to a chat
Use add_chat_message method to send message. When sending a hyperlink message using the HTML <a></a>(Anchor) tag, please ensure “hyperlink reference” is not enclosed in quotes.
Template: send alert to MS Teams
Click here for an example template on how to send an alert to MS Teams:
Send alert to MS Teams