DevelopmentConnect
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
- Message Sending:
- Messages are sent through a POST request to the
api.suitsbooks.com/send_messageendpoint. - Based on user
subscription_settings, entries are made in thechat_subscriptionstable to determine notification targets.
- Messages are sent through a POST request to the
Push Notification Delivery
- The
expo_push_token, stored in theuserstable, 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.