XYLEX Group

Push Notifications in SuitsConnect Mobile App

Push Notifications in SuitsConnect Mobile App

Push notifications in the SuitsConnect Mobile App are integral to providing real-time updates to users. The system leverages Expo's push notification service to deliver these messages directly to the user's device.

How Push Notifications Work

  1. Message Sending:
    • Messages are sent through a POST request to the api.suitsbooks.com/send_message endpoint.
    • Based on user subscription_settings, entries are made in the chat_subscriptions table to determine notification targets.

Push Notification Delivery

  • The expo_push_token, stored in the users table, is used to identify devices for push notifications.
  • Notifications are sent via Expo's service using the following structure:

Push notifications are delivered using the following example API request:

curl --location 'https://api.expo.dev/v2/push/send' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '[
    {
        "to": "ExponentPushToken[HjSrheEZi9GW5GfgAoKXjp]",
        "title": "Case status has been updated",
        "body": "Case Vat filling has been updated to in progress",
        "sound": "default",
        "data": {
            "ticket_id": "f61ae894-28fa-4a65-ba52-8500d409a30f"
        }
    }
]'
```typescript

- `expo_push_token` is being stored in `users` table as soon as user logs in and has system notifications ENABLED for SuitsBooks app
- expo notifications web tool : https://expo.dev/notifications

2. **User Settings**:

- Notification preferences, such as enabling push notifications, are managed per user.
- The `connect_client_status` table is used to check which chat or ticket the user currently has open, which influences notification delivery.

This setup allows for real-time communication and ensures that users are notified of important updates and messages while maintaining control over their notification preferences.