I have an app for Microsoft teams which is sending activity notifications to the user in a team using the /sendActivityNotification
API route. Notifications are appearing when using Microsoft Teams web or the desktop app. But I am unable to view any notification in Android app. The notification tab in android app is always blank and no push notification is coming.
I have written the code for sending activity notification following the documentation on activity notification from Microsoft. We are asking for the TeamsActivity.Send.User
permission during authentication as recommended in the documentation. There is no extra step given for making it work in mobile devices.
Following is one sample code used in our backend for sending the notification:
let activityParams = {
topic: {
source: 'text',
value: 'Zervise',
webUrl: getDeepLink(
existingCompany.msteams.entityId,
existingCompany.msteams.orgId,
existingCompany.msteams.teamId,
existingCompany.msteams.channelId
),
},
activityType: 'waitingForApproval',
previewText: {
content: `Ticket #${ticketAfterUpdate.ticketNumber} is waiting for your approval.`,
},
recipient: {
"@odata.type": "microsoft.graph.aadUserNotificationRecipient",
"userId": `${recipientMsTeamsId}`
},
templateParameters: [
{
name: 'ticketNumber',
value: `${ticketAfterUpdate.ticketNumber}`,
},
],
};
const { data, status } = await axios({
method: 'POST',
url: `https://graph.microsoft.com/v1.0/teams/${existingCompany.msteams.teamId}/sendActivityNotification`,
headers: {
Authorization: `Bearer ${accessToken}`,
'Content-Type': 'application/json',
},
data: activityParams,
});
if (status != 204 && status != 200)
throw new Error('could not send activity notification');
This code working fine for web and desktop, but no notification in android app.
Thanks for any help in advance.
1