Flowdock

Expand all | Collapse all

Endpoint for marking a message as read?

Jump to Best Answer
  • 1.  Endpoint for marking a message as read?

    Posted 04-19-2018 11:50 AM

    Is there an API Endpoint to mark a message as read? By digging through the developer console I found https://www.flowdock.com/rest/notifications/markers  but that actually doesn't help me on my mission. Also the /notifications endpoint doesn't seem to have any documentation nor does the /markers endpoint

     

    e.g.:
    User A writes "Hello @FancyBot"
    FancyBot is a Bot and needs to mark the message as read after receiving it.



  • 2.  Re: Endpoint for marking a message as read?
    Best Answer

    Posted 04-20-2018 08:58 AM

    Guther,

     

    This is handled via 'tags' on a message.  See the 'Usertags' section of Tags | Flowdock API .

     

    What I found that worked was to get the tags array of the message in question, delete the entry ':unread:1234' (where 1234 is the user id of the bot), append the entry ':highlight:1234' and then use a PUT to update the message via the '/flows/:organization/:flow/messages/:id' endpoint.  Some more information about this is at Messages | Flowdock API .

     

    The payload is simply the tags array:

    {"tags": [":user:1234", ":highlight:1234"]}

     

    Hope that helps you.

     

    Michael



  • 3.  Re: Endpoint for marking a message as read?

    Posted 04-21-2018 08:29 AM

    This brings me one step closer but for some reason it's not working as expected.

     

    The Docs say:
    Any existing tags that aren’t included in this parameter are removed from the message. As in the web UI, anyone can edit the tags of any message they can see.

     

    So I'm just sending the payload you told you me to send without deleting the unread tag.

    params.add(new BasicNameValuePair("tags[0]", ":user:1234"));
    params.add(new BasicNameValuePair("tags[1]", ":highlight:1234"));

     

    I even tried the Json way:

    List<NameValuePair> params = new ArrayList<NameValuePair>();

    JSONArray tags = new JSONArray();
    tags.put(":highlight:1234");
    tags.put(":user:1234");

    params.add(new BasicNameValuePair("tags", tags.toString()));

     

    I'm getting a 200 in both examples but the @name mention just turns into normal text and is no longer a mention:

     

    What am I doing wrong here?

     

    Edit:

    Looks like I had to use a comma separated tags list instead of arrays.

    params.add(new BasicNameValuePair("tags", ":user:1234,:highlight:1234,"));

    Seems to be working fine now. Thanks for the help

     

    By the way your example payload is missing a colon in front of hightlight. Took me a second to figure out because I just copied it over.



  • 4.  Re: Endpoint for marking a message as read?

    Posted 04-23-2018 02:55 AM

    Guther,

     

    Great I am glad that got it going for you.  I updated the example so it was correct.  Thanks for pointing that out.

     

    Michael