Skip to main content

Is it possible to send notification to user when he's not on the app screen

  • July 15, 2020
  • 5 replies
  • 1236 views

vishwajeets

Hi Team,
I am trying to build an app whch may need to work on background and notify users in case there’s anything needs attention of user. Is this kind of use case supported when user is not active on view of my app .

This topic has been closed for replies.

5 replies

rob
Forum|alt.badge.img
  • monday.com Partner
  • July 15, 2020

Hey @vishwajeets
All automations using due dates are triggered when a given date is reached without forcing a user to perform any actions.


basdebruin
  • Community Expert
  • July 15, 2020

Sure this is possible, but remember you API requires a boardid to sent the notification (although it is visible in any part of the frontend). I use this function.

static async sendNotification(token, userId, targetId, notificationText) {
try {
const mondayClient = initMondayClient();
mondayClient.setToken(token);
const query = mutation create_notification($userId: Int!, $targetId: Int!, $notificationText: String!){ create_notification(user_id: $userId, target_id: $targetId, text: $notificationText, target_type: Project) { text } } ;

  const variables = { userId, targetId, notificationText };
  const response = await mondayClient.api(query, { variables });
  return response;
} catch (err) {
  console.log(err);
}

}

And this ia an example from a call to this function:

notificationText =
“The feature " +
solutionName +
" is granted a trial period of 30 days. Please visit excellent-team.nl/solutions if you want to purchase this feature.”;
mondayService.sendNotification(token, userId, boardId, notificationText);


vishwajeets
  • Author
  • Participating Frequently
  • July 15, 2020

Thank you.
I am assuming this has to be done from server side as client side code won’t exist when user is not on the given apps context . Let me know if that’s correct assumption .


rob
Forum|alt.badge.img
  • monday.com Partner
  • July 15, 2020

Yes, I confirm it.
I suggest you to take a look at existing automations for due dates like the following ones.

All “due date” automations don’t require an actual action by the user.


vishwajeets
  • Author
  • Participating Frequently
  • July 15, 2020

Sounds good thank you. I wil check the automations you have mentioned.