1

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 teams context in 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:

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:

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

Any kind of help is appreciated!

Anik Roy
  • 15
  • 5

1 Answers1

0

From the documentation:

{page.subPageId}: The developer-defined unique ID for the subpage this content points defined when generating a deep link for a specific item within the page. (Known as {subEntityId} prior to TeamsJS v.2.0.0).

You are using subEntityId on the backend but accessing subPageId on the client side.

Optimal
  • 407
  • 3
  • 9
  • subEntityId in backend becomes subPageId in client. Deep linking is working fine in desktop client and browser (I'm getting data in subPageId) but in mobile client it becomes undefined. Seems like a bug in teams js SDK. – Anik Roy Jan 08 '23 at 09:42
  • This issue is being tracked [here](https://github.com/OfficeDev/microsoft-teams-library-js/issues/1518). Please follow that thread for further updates. Thanks! – Prasad-MSFT Jan 10 '23 at 15:19