Monday, December 11, 2023

Create and manage Viva Engage communities with the Microsoft Graph API

Microsoft continues to expand its services and bring more functionalities into Microsoft Graph. The latest addition is the introduction of an API set for Viva Engage. I’m extremely positive about this recent development, as it introduces support for interacting with Viva Engage (formerly known as Yammer) via Microsoft Graph; laying a solid foundation for future enhancements to this API set and allowing developers to benefit from all Microsoft Graph features, including authentication and throttling management. This blog posts introduces the new Viva Engage API in Microsoft Graph and related scenarios.

Anatomy of a Viva Engage community

Each Viva Engage community is linked to a Microsoft 365 group; however, the ID of the associated group isn’t the same as the ID of the related community. This close relationship enables developers to expand the management scenarios on a community by operating at group level. When changes are applied to the associated group, they automatically reflect in the related community. This allows for more extensive scenarios that go beyond the capabilities supported in the Viva Engage API. For more information on the Viva Engage and Microsoft 365 group relationship, see Viva Engage and Microsoft 365 groups.



The Viva Engage API in Microsoft Graph

The Viva Engage API in Microsoft Graph supports three scenarios that allow developers to:

  • Create a community
  • Monitor the creation of a community
  • Access a community
The current API set is limited to creating and getting communities and it doesn’t support all CRUD operations. For consistency with similar API sets such as the team and group, I hope that the Viva Engage team will extend this API set with the following additional operations on the community resource in the short term: List, Update, and Delete community.

You can only use the Viva Engage API on Viva Engage networks in native mode, which has been the default for all new Viva Engage tenants since 2020. For more information on native mode, see Overview of Viva Engage in Native Mode for Microsoft 365.

Creating a community


The Create operation on the community resource triggers an async operation for the creation of a Viva Engage community. This is a similar approach used also for the creation of Microsoft Teams teams. 

You can create communities using delegated and application permissions. When you create a community using delegated permissions, you’re automatically defined as a community owner. When you create a community using application permissions, you have to specify a community owner in the request body.

The following example shows a request for creating a community using application permission. Note that the response body contains an Operation-Location header with a link that allows you to monitor the async operation.


For more details, see Create community.

Monitoring the creation of a community


Use the link in the Operation-Location header to poll for status update on the creation operation. Monitor the response body of the following request for a status update that indicates whether the creation operation is still running, failed, or succeeded.



For more details, see Get engagementAsyncOperation.

Accessing a community


Retrieve a newly created or already existing Viva Engage community via the Get operation on the community resource. The following example shows an example of a request that returns a community object in the response body.


For more details, see Get community.

You can also access the following two relationships to get more information about a community:

  • group: Returns the Microsoft 365 group associated with the community. For example, https://graph.microsoft.com/beta/employeeExperience/communities/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiI4MzIxMjc1In0/group
  • owners: Returns the administrators of the community. For example, https://graph.microsoft.com/beta/employeeExperience/communities/eyJfdHlwZSI6Ikdyb3VwIiwiaWQiOiI4MzIxMjc1In0/owners

Integrating with Viva Engage communities via the Microsoft 365 group API


As mentioned previously, every Viva Engage community is associated with a Microsoft 365 group. Operations ran on the associated group, automatically apply to the related community. This section explains five scenarios that you can implement in a Viva Engage community via the Microsoft 365 group API. For more scenarios, see Viva Engage and Microsoft 365 groups.

Adding and removing members from a community


Use the Add members API on the associated group to update the members of the related community. Likewise, you can use the Remove members API to remove the members from the related community.

Adding and removing an admin from a community 


Use the Add owners API on the associated group to add admins to the related community. Likewise, you can use the Remove owners API to remove the admins from the related community.

Renaming a community


Use the Update group API on the associated group to update the displayName property of the related community.

Conclusion


I’m positive about the new Viva Engage API support for two main reasons:
  • Microsoft Viva has been around since 2021. Initially, the extensibility options for Viva apps were limited but now Microsoft continues to expose more and more API sets that enable developers to integrate and extend the services of Viva apps such as Viva Learning, Viva Goals, and now Viva Engage.
  • I spent part of my career managing and developing provisioning engines. It was awkward to use the Yammer REST API to create Yammer groups while the provision of teams and groups happened via the Microsoft Graph API. Independent software vendors (ISVs) provisioning Viva Engage communities can finally benefit from a unified approach for creating collaboration spaces and communities.
I’ll keep a close eye on the development of the Viva Engage API and look forward to seeing more Viva apps available for integration via Microsoft Graph.


Thanks for reading,
Jarbas

Thursday, November 23, 2023

Exploring GitHub Copilot

GitHub Copilot is a game-changer in the coding world. It’s like having a coding “genius” sitting right next to you, ready to help you at any time. Yeah, you read that right. It’s like having a very senior developer available for all your questions whenever you need them. And here's why I'm especially thrilled: As I get ready for an internal workshop on December 7th at our London office, I'm preparing a session about this very exciting topic. In the run-up to this event, I've been diving deep into GitHub Copilot's capabilities, and I’m happy to share my findings with you over this blog post.

If you want to learn more about GitHub Copilot, I recommend that you take the Microsoft learning path: “GitHub Copilot Fundamentals - Understand the AI pair programmer” that served as the primary source of content for this blog post.

What is GitHub Copilot?


In a nutshell, GitHub Copilot (going forward, Copilot) is a virtual, AI pair programmer that can help you write code faster and with less work. It works tirelessly by your side offering autocomplete-style suggestions on your code and comments. 

Research reveals that developers with access to Copilot finished their programming tasks 55.8% quicker than a control group without the AI pair programmer by their side. This demonstrates that Copilot increases developer productivity significantly and is an added value for those using it. For the full research, see The Impact of AI on Developer Productivity: Evidence from GitHub Copilot.

Copilot vs. ChatGPT


During my research, I considered whether ChatGPT can serve as an alternative to an AI pair programmer such as Copilot. At the end of the day, ChatGPT is free and user friendly, plus my colleagues might already be using it. Now, although ChatGPT is free and appealing, Copilot has more to offer for people who write code. To illustrate, I created the following comparison.

Feature

ChatGPT

GitHub Copilot Individual

Subscription cost

Free

$10/month

Primary function

Conversational AI

AI pair programmer

Availability

Web-based application, mobile app

IDEs (Integrated Development Environments)

Audience

General public, various industries

People who write code

Model

GPT-3.5, focused on natural language or code

Codex, a modified version of GPT-3, focused on code

Personal use

Yes, general usage

Yes, primarily for coding

Ease of use

User-friendly interface

Requires familiarity with IDEs

Learning and improvements

Pre-trained, continuous learning from interactions

Pre-trained, learns from code repositories and interactions


Copilot is based on the OpenAI Codex model, a programming model, that is focused on any type of programming tasks such as creating functions and fixing bugs. If you use the Copilot Chat to ask for support with preparing a dinner party, you will get the following answer: Sorry, but I can only assist with programming related questions. The focus of Copilot on programming tasks and the additional features it brings around that, makes it a strong peer to any person who writes code.

Now, if you don’t have access to Copilot, ChatGPT serves as an alternative, but it isn’t as specialized in programming tasks as Copilot.

Licenses


Copilot offers three licensing plans: Individual, Business, and Enterprise (release planned for February 2024). For more details on the different licenses and benefits, see GitHub Copilot pricing. This blog post focuses on the capabilities of the GitHub Copilot Individual plan.

How Copilot works


Copilot runs as a plugin within popular IDEs such as Visual Studio Code, Visual Studio, JetBrains, or Neovim. You can also use Copilot via GitHub Codespaces, a hosted developer environment that runs in the cloud.

When you type in your IDE, Copilot considers the context of the code already written, including comments, the filename, the file extension, and other open files in the IDE. This context goes through a proxy that filters out hate speech and personal data before it’s sent to Open AI. The AI model analyzes the context and generates code suggestions. These suggestions are displayed in the IDE in real-time, offering one or more alternatives for you to choose from. You can then modify, accept, or reject these suggestions. 

Your interaction helps Copilot provide more accurate suggestions over time as it adapts to your coding style. Copilot also uses your feedback on the suggestions to further improve the model. I’m not sure however whether this feedback loop also applies to Copilot for Business that has a major focus on data privacy.

Some practical tips 😉


During my hands-on trial with Copilot, I didn’t see the code block suggestions. A quick Ctrl + Enter (Windows) brings up the Copilot completions panel with many code suggestions. Also, you can accept a code suggestion using the Tab key (Windows). 

One special aspect that applies to Copilot, as described by Microsoft, is “Surround”. This means that Copilot uses the code you've already written—including comments, the filename, the file extension, and other open files in the IDE—to provide more tailored code suggestions. Consider opening more files in your IDE to provide extra context to Copilot.

Prompt engineering


You can't talk about successful generative AI interaction without talking about prompt engineering. The art of prompt engineering is crucial in reaching Copilot's full potential. A prompt is your instruction to the AI, and the more accurate and clear your prompts are, the better code suggestions Copilot generates. For example, using a comment like “// Create an API endpoint” isn't specific enough and can result in an output that doesn't meet your intentions. However, if you are more specific and define a clear scope, such as “// Create an API endpoint using the React framework that accepts a JSON payload in a POST request”, the output will more likely meet your expectations. Like anything in life, repeatedly practicing helps you get better, in this case, with prompt engineering. To learn more about prompt engineering, see Prompt Engineering Guide.

Summary


GitHub Copilot is more than a tool; it's the next level in programming and I wish Copilot had been there when I was an active developer. Its seamless integration into IDEs transforms it into the perfect programming “buddy” directly where you need it.

There might be many other features that I haven't explored, but I definitely loved these:
  • Code suggestion: Suggestion of one or more code alternatives that you can accept, reject, or modify. The suggestions appear when you start to write code or by writing natural-language comments that describe your intent.
  • GitHub Copilot Chat: A feature that makes difference, offering a conversational programming experience and responding to your questions with insights from your code's context and cursor position in the IDE. This helps you avoid context switching and navigating interruptions to look for support on the internet.
  • Surround: Copilot’s ability to use additional information (the code already written, including comments, the filename, the file extension, and other open files in the IDE) around a comment or code as context for the response.

I look forward to finishing my slides for the upcoming workshop and soon having a great time with my colleagues as we discuss and apply Copilot.

See more


Thanks for reading,
Jarbas

Wednesday, November 8, 2023

Integrate with Announcements in Viva Connections using the Microsoft Graph API

In the constantly evolving Microsoft 365 world, there's always something new to explore. One of the latest additions to catch our attention is the Announcements feature in Viva Connections. This feature introduces publishing capabilities to Viva Connections, enhancing communication within organizations by allowing communicators to share targeted, time-sensitive updates and information with their team members. In this post, I share with you my findings about how to extend Viva Connections Announcements using the Microsoft Graph API.

Anatomy of Announcements 

First things first, behind the scenes Announcements is not a common list in SharePoint, but a document library that can be accessed directly via Viva Connections or in SharePoint via the following URL: {SiteUrl}/_layouts/15/announcements.aspx. Communicators can use this area to create, manage, and share announcements to keep their team informed. Technically, an announcement is stored in XML format as an .aspx page.

Key properties for announcements:

  • Audience Targeting: When creating an announcement, audience targeting is essential and mandatory. You can target up to 10 audiences, which can be Microsoft Entra ID security groups or Microsoft 365 groups. This ensures that your message reaches the right people.
  • End date and time: Setting an end date and time for your announcement is mandatory. You can schedule it to remain visible for up to two weeks from the original publishing date.
  • Message: The message is where you convey the details. Maximum of 250 characters.
  • Title: Each announcement must have a title but keep it concise as you're limited to 60 characters.
  • Schedule to send later: If timing is crucial, you can schedule your announcement to send later. Scheduling is available only in half-hour increments, so plan accordingly.

Accessing Announcements


The most recent announcement takes the spotlight in Viva Connections. The next four announcements are accessible through a carousel format. If you want to view all announcements, a "See all" button opens a modal dialog listing all announcements in descending order.

Announcements in Viva Connections


Extending Announcements 


Microsoft Viva Connections has had so far limited extensibility options, primarily related to Dashboard cards (aka. adaptive card extensions). However, the landscape is changing with the introduction of new Viva Connections features such as Announcements and Company Links. These features leverage the SharePoint infrastructure, opening the door to a wider range of integration scenarios. Now, you can integrate with SharePoint to enhance the Viva Connections experience.

Extending via the Microsoft Graph API


At the time of this written, Microsoft hasn’t introduced a dedicated API set to integrate with Announcements in Viva Connections. However, you can use the driveItem API to seamlessly integrate with the Announcements library in SharePoint. The following examples show the requests I used to create a new announcement in Viva Connections.

Downloading an announcement


I first ran a GET request to download an existing announcement from the Announcements library.


This is what the response object looks like:


Uploading an announcement


You can upload announcements in the form of .aspx pages to the Announcements library. For this example, I updated the XML content of the previous response before uploading the new announcement to the Announcements library.


The previous request creates a new announcement in the Announcements library; however, the announcement isn’t yet visible in Viva Connections. To ensure your announcement appears in Viva Connections, remember to publish the page. Note that you'll need to check out the .aspx page before you can proceed with checking it in and publishing it.

Checking out the .aspx page (announcement)



Checking in and publishing the .aspx page (announcement)



Exploring deeper with internal APIs


For those who enjoy taking a deeper look at internal APIs, I found an endpoint that returns announcements the signed-in user has dismissed.

https://example.sharepoint.com/sites/homesite/_api/EmployeeExperience/GetAnnouncementsState. 

The EmployeeExperience path in this endpoint already exists in Microsoft Graph. I’m curious whether Microsoft plans to extend the employeeExperience resource in the future to expose other Viva APIs publicly 🤔

API integration considerations


While Announcements in Viva Connections offer powerful communication capabilities, it's worth noting that Microsoft doesn't provide dedicated Viva Connections APIs for seamless integration. To work with Announcements, you have to rely on SharePoint operations. However, this approach can be risky, as Microsoft can change the structure of the Announcements library without prior notice. Announcements are saved in XML format on .aspx pages and relying on this XML structure can be challenging because Microsoft can alter it at any time. This represents a challenge for building production-ready integrations, especially considering the ever-changing landscape of Microsoft 365.

In conclusion, Announcements in Viva Connections are a valuable tool for enhancing communication within your organization. Communicators have an additional instrument with support for audience targeting that they can use to increase their reach. As a developer or ISV, understanding the extensibility options and the potential challenges can help you make the most of this feature and potentially extend Microsoft’s services.

See also



Thanks for reading,
Jarbas

Sunday, May 21, 2023

Attending the IntraTeam event Copenhagen 2023



I look forward to attending the IntraTeam event in Copenhagen on May 25th, 2023. IntraTeam is an industry conference focused on modern intranets, collaboration, and communication. The amazing lineup of speakers comprises of employee communication leaders, Microsoft employees, and software vendors. The agenda looks great and I'm especially curious about the following sessions:

  • Viva Engage for communications and engagement by Dan Holme (Product leader, Viva Engage at Microsoft)
    Curious about: Understand how Viva Engage empowers leaders and employees to engage at scale, and how the results are measured
     
  • The Digital Era: A new frontier for internal comms by Steffen Henke (Global Head of Internal Communications at Deutsch Post DHL - DPDHL)
    Curious about: Understand how DPDHL approaches employee communication with 600.000 employees

  • Generative AI – what internal comms needs to know by David Bowman (Product Director at Fresh Intranet)
    Curious about: Understand how communicators can apply generative AI in employee communication

Let's get in touch if you're also going to participate in the event!!!


Event information in:


Saturday, April 29, 2023

Speaking at Staffbase VOICES 2023 Partners Pre-Day in Berlin

Staffbase VOICES is an employee comms event that brings together the employee communicators community and industry experts together to learn, network, and find joy in our shared work. On May 2nd in a pre-day event for the Staffbase business partners, Felicia Flemming (Team Lead, Go-to-Market Strategy) and I (Group Product Manager) will talk to our partners about employee communication and how Staffbase and Microsoft come together to address this topic.



I look forward to speaking and networking with our partners, attending the VOICES event, and spending time with my colleagues and our customers.

Let's get in touch if you're also going to participate in this event!

See you soon 😉