How to send a message to a specific user

Copper Contributor

I want to send a message to a specific user from external service using the user ID.

 

In the sample code, I can use "getPagedInstallations" to loop through all users.

-----------------------------------------

const pagedData = await notificationApp.notification.getPagedInstallations(
  pageSize,
  continuationToken
);
 
const installations = pagedData.data;
for (const target of installations) {
   ...
}

-----------------------------------------

 

I think this is bad performance.

Is there any other better way?

 

1 Reply

@narita1234 -
You can send a new chatMessage in the specified chat using this API.
Send message in a chat - Microsoft Graph v1.0 | Microsoft Learn


This API cannot create a new chat; you must use the 
list chats method to retrieve the ID of an existing chat before creating a chat message.

If you want to create a new chat you can use below API:

 Create chat - Microsoft Graph v1.0 | Microsoft Learn

 

 

Thanks, 

Prasad Das

------------------------------------------------------------------------------------------ 

If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.