Custom activity feed notifications sent from daemon(nodejs app), not getting the data assigned to subEntityId in teams mobile client using @microsoft/teams-js sdk.

Anik Roy 1 Reputation point
2023-01-07T09:31:11.183+00:00

I'm using activityFeedNotification graph api to send push notification to the users of our teams tab app from backend using nodejs. The notification is sending successfully in both teams desktop and mobile client but we're not getting the data assigned to subEntityId in mobile client(In desktop client and browser we're getting it).
We are encoding the data(object) and assigning it to the subEntityId in context object from our nodejs application. Then in teams client, we get that data from teams context using microsoft teams sdk and redirect user to the respective page in our application based on whatever data we get in subEntityId

In desktop, deeplinking is working perfectly but in android client, we're not getting any data in subEntityId. It is just opening the homepage of our tab app but I need to redirect user to specific page based whatever data is assigned to subEntityId.

Below I've provided how we're encoding the data and assigning it to subEntityId.

Server Side Code:

const context = encodeURIComponent(  
      JSON.stringify({  
        "subEntityId": {  
         "type": "PROGRAM_PROFILE",  
         "program_id": "12345",  
          uid: uuidv4(),  
        }  
      })  
    );  
  
const body = {  
  topic: {  
    source: 'text',  
    value: notificationTopic,  
    webUrl: `https://teams.microsoft.com/l/entity/${TEAMS_APP_ID}/index?context=${context}`,  
  },  
  activityType: 'commonNotification',  
  previewText: {  
    content: notificationSubtitle,  
  },  
  templateParameters: [  
    {  
      name: 'title',  
      value: notificationTitle,  
    },  
  ],  
};  
  
const url = `https://graph.microsoft.com/v1.0/users/${userId}/teamwork/sendActivityNotification`;  
  
await axios.post(url, body));  

Client Side Code:

const context = await app.getContext();  
console.log(context?.page?.subPageId); // getting undefined  

Any kind of help is appreciated!

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,553 questions
{count} votes