Skip to:
Content

BuddyPress.org

Opened 19 months ago

Closed 19 months ago

Last modified 18 months ago

#8695 closed enhancement (fixed)

BP REST API endpoint to mark messages as read/unread

Reported by: niftythree's profile niftythree Owned by:
Milestone: 10.3.0 Priority: normal
Severity: normal Version:
Component: REST API Keywords: has-copy-review
Cc:

Description

Hi there,

We’re currently working on the messaging portion of our mobile app which interfaces to the BP REST API to facilitate the receiving and sending of messages. Currently, as far as we can see, the BP REST API does not seem to provide an endpoint to be able to mark messages as read or unread. This is a rather crucial element to messaging, as whenever a message is opened on the app, the app needs to be able to mark the message as read on the server so that both the website and the app are synchronised as to which messages are read/unread. It’s also needed in order to implement a notification system on the app to alert the user when they receive a new message. Would such an endpoint be on the current roadmap? At the minimum, the endpoint just needs to be able to clear the unread count for a given message thread (i.e. “mark as read”). Additionally, if it is able to mark the last incoming message as unread it would be a bonus.

Thanks.

Attachments (1)

Messages.png (41.2 KB) - added by niftythree 19 months ago.

Download all attachments as: .zip

Change History (3)

@niftythree
19 months ago

#1 @espellcaste
19 months ago

  • Keywords has-copy-review added
  • Milestone changed from Awaiting Review to 10.3.0
  • Resolution set to fixed
  • Status changed from new to closed

@niftythree This is actually already possible using the PUT endpoint but it was actually not documented.

I updated the documentation with this information: https://developer.buddypress.org/bp-rest-api/reference/private-messaging/#update-metadata-about-a-specific-message-of-the-thread

bp.apiRequest( {
  path: '/buddypress/v1/messages/5',
  type: 'PUT',
  data: {
    context: 'edit',
    unread: true // unread or read. 
  }
} ).done( function( data ) {
  return data;
} ).fail( function( error ) {
  return error;
} );

#2 @niftythree
18 months ago

Thanks @espellcaste. 🙂

Note: See TracTickets for help on using tickets.