This method allows an app to fetch specific messages from a conversation.

The method endpoint is https://api.flock.co/v1/chat.fetchMessages and follows the method calling conventions.

Your app provides a list of message uids to fetch, and Flock will, in response, return a list of Message objects. 

Parameters

NameTypeRequiredDescription
tokenStringYesToken of the user on whose behalf the message is being sent
chatStringYesIdentifier for user or group for which messages are to be fetched
uidsArrayYes

A comma separated list of message uids (max length: 25).

 If a message doesn't exist for any uid, it is silently skipped.

Example: ["fd4877b719b1", "59e2da001af2"]

Response

A list of Message objects.

[ { "from": "u:1e6429de-16b7-48b3-acc0-c2d7ec5ad195",
    "to": "u:cfc76545-3400-4864-892a-513a9f4ae409",
    "uid": "fd4877b719b1",
    "text": "Hello" },
  { "from": "u:cfc76545-3400-4864-892a-513a9f4ae409",
    "to": "u:1e6429de-16b7-48b3-acc0-c2d7ec5ad195",
    "uid": "59e2da001af2",
    "text": "Hello again" } ]

Errors

Error CodeHTTP StatusDescriptionAdditional Parameters
UnknownChat400The group or userId provided in chat is not known. 

3 Comments

  1. chatStringYesIdentifier for user or group for which messages are to be fetched
    Please add the error responses too, like chat is a group and the user is not authorized to read in the group
    1. I have added UnknownChat error specific to this method – the same should be returned even if the group exists but user isn't a member.

    2. Also, if no message exists for one or more uids, it should be silently skipped.