API > Messages

Basic JavaScript object

createConversation

Creates new conversation.

Parameters

  • users
    Array of user IDs with who is needed to create a conversation.
  • message
    A message which will be sent to users.

Result

Returns object which contains such properties: success in a case of success and html in a case of error success, message.

  • success
    Request status true in a case of success or false in a case of error.
  • html
    Object with properties:

    • conversationListItem Template render membership-by-supsystic/src/Membership/Messages/views/partials/conversations-list.twig
    • conversationMessages Template render membership-by-supsystic/src/Membership/Message/views/partials/conversations.twig
  • message
    Error message.

Example


getMessages

Gets messages in a cartain conversation.

Parameters

  • conversationId
    Conversation ID.
  • limit
    Maximum number of messages which has to be returned. By default 5, minumum value 1, maximum value 50.
  • `lastMessageIdMessage ID regarding to which list will be created.
  • direction
    If the parameter is equal to -1 request will return old messages, if it’s equal to 1 it will return only new messages regarding to parameterlastMessageId

Result

Returns object with properties success и html

  • success
    Request status true in a case of success or false in a case of error.
  • html
    Template render membership-by-supsystic/src/Membership/Messages/views/partials/messages.twig'

Example


checkUnreadMessages

Checks conversation of the current user if there are new messages.

Result

Returns object with properties success и html

  • success
    Request status true in a case of success or false in a case of error.
  • html
    Object with properties:

    • conversationListItem Template render membership-by-supsystic/src/Membership/Messages/views/partials/conversations-list.twig
    • conversationMessages Template render membership-by-supsystic/src/Membership/Message/views/partials/conversations.twig

Example


sendMessage

Send messages to all conversation participants.

Parameters

  • conversationId
    Conversation ID.
  • message
    A message which will be sent to users.

Result

Returns object which contains such properties: success in a case of success and html in a case of error success, message.

  • success
    Request status true in a case of success or false in a case of error.
  • html
    Template render membership-by-supsystic/src/Membership/Messages/views/partials/messages.twig
  • message
    Error message.

Example


sendMessageToUser

Send message to a certain user.

Parameters

  • userId
    User ID.
  • message
    A message which will be sent to user.

Result

Returns object which contains such properties: success in a case of success and html in a case of error success, message.

  • success
    Request status true in a case of success or false in a case of error.
  • html
    Object with properties:

    • conversationListItem Template render membership-by-supsystic/src/Membership/Messages/views/partials/conversations-list.twig
    • conversationMessages Template render membership-by-supsystic/src/Membership/Message/views/partials/conversations.twig
  • message
    Error message.

Example


deleteMessages

Removes certain messages from a conversation.

Parameters

  • conversationId
    Conversation ID.
  • messages
    Array of messages IDs.

Result

Returns object which contains such properties: success in a case of success and html in a case of error success, message.

  • success
    Request status true in a case of success or false in a case of error.

Example


deleteConversation

Removes certain conversation.

Parameters

  • conversationId
    Conversation ID.

Result

Returns object which contains such properties: success in a case of success and html in a case of error success, message.

  • success
    Request status true in a case of success or false in a case of error.

Example


blockUser

Blocks receiving messages from the specified user.

Parameters

  • userId
    User ID.

Result

Returns object with properties success и message.

  • success
    Request status true in a case of success or false in a case of error.
  • message
    Message about success blocking or error message.

Example


unblockUser

Unblocks receiving messages from the specified user.

Parameters

  • userId
    User ID.

Result

Returns object with properties success и message.

  • success
    Request status true in a case of success or false in a case of error.
  • message
    Message about success unblocking or error message.

Example


Categories
Latest Articles
Get plugins bundle today and save over 80%