Plentymarkets interface documentation

Messenger

Contracts

MessengerRepositoryContract

The MessengerRepositoryContract is the interface for the messenger repository. This interface defines methods to add and show/list messages.

Namespace

Plenty\Modules\Messenger\Contracts

Methods
public add($data):Plenty\Modules\Messenger\Models\Message
Return type: Message

Creates a new message.

Parameters

Name

Type

Description

$data

array

The message data to be loaded

public show($uuid):void

Gets a message with all its successors.

Parameters

Name

Type

Description

$uuid

string

The UUID5 of the message

public list($uuid = null, $successors = true, $amount = self::DEFAULT_MESSAGES_AMOUNT):array

Lists messages. If no reference UUID5 is given, the method returns the $amount first messages. If $successor is set to FALSE, the messages older than the referenced message will be returned.

Parameters

Name

Type

Description

$uuid

string

The reference UUID5 of the message to start from (excluding). If not set, the uuid of the newest message will be used.

$successors

bool

If set to FALSE, the messages older than the referenced message will be returned.

$amount

int

The amount of messages to list (defaults to 50)

public listArchivedMessages($conversationUuid):Plenty\Repositories\Models\PaginatedResult
Return type: PaginatedResult

Lists messages for an archived conversation

Parameters

Name

Type

Description

$conversationUuid

string

public getMessages($page = self::DEFAULT_PAGE_OF_MESSAGES, $itemsPerPage = self::DEFAULT_ITEMS_PER_PAGE_OF_MESSAGES):array

Lists messages.

Parameters

Name

Type

Description

$page

int

The number of the returned page of messages, default is 1 (the first)

$itemsPerPage

int

The amount of messages to list (defaults to 50)

public updateReadBy($readBy, $uuid):void

Updates the readBy array of the message.

Parameters

Name

Type

Description

$readBy

int

The ID of the user who read the message

$uuid

string

The UUID of the message

public updateTags($tags, $uuid):void

Updates the tags of the message.

Parameters

Name

Type

Description

$tags

array

Array of tag IDs of the message

$uuid

string

The UUID of the message

public updateVisibility($data, $uuid):void

Updates the visibility of the message. Attributes that are updated are Message.visibility, Message.linkedTo and Message.accessFor.

Parameters

Name

Type

Description

$data

array

The message with the data to be updated

$uuid

string

The UUID of the messages

public updateControls($data, $uuid):Plenty\Modules\Messenger\Models\Message
Return type: Message

Updates the message ui control options in the message meta data and returns the message.

Parameters

Name

Type

Description

$data

array

The controls data to be updated.

$uuid

string

The uuid of the message.

public setDone($doneAt = null, $uuid):void

Sets the doneAt date in the message. If $doneAt is NULL, the doneAt date will be reset.

Parameters

Name

Type

Description

$doneAt

string

The doneAt date as ISO date string

$uuid

string

The UUID of the message

public delete($uuid):int

Deletes a message stream by the UUID. Returns the count of messages deleted.

Parameters

Name

Type

Description

$uuid

string

The UUID of the message

public getAttachment($uuid, $filename):Plenty\Modules\Messenger\Models\Attachment
Return type: Attachment

Gets a message attachment.

Parameters

Name

Type

Description

$uuid

string

The UUID of the message

$filename

string

The file name of the attachment

public getAllAttachments($uuid):Plenty\Modules\Messenger\Models\Attachment
Return type: Attachment

Gets all message attachments as zip.

Parameters

Name

Type

Description

$uuid

string

The UUID of the message

public updateMetaData($uuid, $metaData):Plenty\Modules\Messenger\Models\Message
Return type: Message

Updates the meta data of the message.

Parameters

Name

Type

Description

$uuid

string

The UUID of the message

$metaData

array

The meta data of the message

public getTotalEntries():int

Returns total message entries

public setFilters($filters = []):void

Sets the filter array.

Parameters

Name

Type

Description

$filters

array

public getFilters():void

Returns the filter array.

public getConditions():void

Returns a collection of parsed filters as Condition object

public clearFilters():void

Clears the filter array.

Events

MessageCreated

The event is triggered after a new message was created.

Namespace

Plenty\Modules\Messenger\Events

Methods
public isFirstMessage():bool

If TRUE, the message is the first one. Otherwise, it is a reply message.

public broadcastWhen():void
public getMessage():Plenty\Modules\Messenger\Models\Message
Return type: Message

Get the message.

Models

Attachment

The Attachment model of the messenger.

Namespace

Plenty\Modules\Messenger\Models

Properties
Name Type Description

name

string

The file name of the attachment

message

string

The UUID of the message the attachment belongs to

size

int

The size of the attachment in bytes

contentType

string

The content type fo the attachment

content

string

The content of the attachment

createdAt

string

The createdAt date of the attachment

Methods
public toArray()

Returns this model as an array.

Message

The Message model of the messenger.

Namespace

Plenty\Modules\Messenger\Models

Properties
Name Type Description

uuid

string

The UUID5 identifier of the message

plentyIdHash

string

The plenty ID hash

parentUuid

string

The UUID5 of the parent message

conversationId

string

The UUID5 of the conversation

linkedTo

array

An array with MessageLinkedTo instances

from

MessageFrom

The sender of the message as MessageFrom instance.

to

MessageTo

The user and role IDs and emails receiving the message

whispered

bool

Whether the message is whispered (not visible for the contact/order linked to the message) or not

tags

array

An array with tag IDs assigned to the message

title

string

The title of the message

preview

string

The first two lines of the message without any markup

message

string

The content of the message

plainMessage

string

The content of the message as plain text

attachedFilesCount

int

The amount of attached files (readonly)

referrer

MessageReferrer

The message referrer

metaData

MessageMetaData

The meta data of the message

doneAt

string

The date the messages was set to done

createdAt

string

The creation date of the message

updatedAt

string

The date of the last update of the message

deletedAt

string

The date the message was deleted

deletedBy

int

The ID of the user who deleted the message

attachments

array

The message attachments

categoryId

int

The categoryID of the message/conversation

typeId

int

The typeID of the conversation

typePosition

int

The typePosition of the typeID

statusId

int

The statusID of the conversation

statusPosition

int

The statusPosition of statusID

marketplacesMetadata

MessageMarketplacesMetaData

The marketplace metadata

Methods
public toArray()

Returns this model as an array.

MessageFrom

The MessageFrom model of the messenger.

Namespace

Plenty\Modules\Messenger\Models

Properties
Name Type Description

type

string

The type of the from instance (one of {@link MessageTypesService::FROM_TYPE_USER}, {@link MessageTypesService::FROM_TYPE_CONTACT} and {@link MessageTypesService::FROM_TYPE_EMAIL})

value

The value of the instance. For type {@link MessageTypesService::FROM_TYPE_EMAIL} it is a string (the email) and the id of the user or the contact otherwise.

name

string

An optional name for the instance, e.g. the real name for type {@link MessageTypesService::FROM_TYPE_EMAIL}

Methods
public toArray()

Returns this model as an array.

MessageLinkedTo

The MessageLinkedTo model of the messenger.

Namespace

Plenty\Modules\Messenger\Models

Properties
Name Type Description

type

string

The type of the link (one of {@link MessageTypesService::LINKED_TO_TYPE_MESSAGE}, {@link MessageTypesService::LINKED_TO_TYPE_ORDER}, {@link MessageTypesService::LINKED_TO_TYPE_CONTACT} and {@link MessageTypesService::LINKED_TO_TYPE_PAYMENT})

value

The value of the link. For type {@link MessageTypesService::LINKED_TO_TYPE_MESSAGE} it is a string (uuid5) and an integer otherwise.

typeId

This can be the ID of a sub-type (e.g. the order subTypeId). (optional)

Methods
public toArray()

Returns this model as an array.

MessageMetaData

The MessageMetaData model of the messenger.

Namespace

Plenty\Modules\Messenger\Models

Properties
Name Type Description

readBy

array

The array of users

links

array

Array with links

notDoneByBackend

MessageMetaDataNotDone

deactivates the toggle button in the messenger ui (backend) also has optional tooltips (reason for the deactivated toggle)

controls

MessageMetaDataControls

An object with control options for the ui.

timeCapture

MessageMetaDataTimeCapture

An object of the message time capture data

plentyId

int

the plenty id of the related contact

Methods
public toArray()

Returns this model as an array.

MessageMetaDataControls

The message controls model. Currently supported controls: * <ul> * <li><tt>bool replyable</tt> * Indicates whether or not is allowed to reply to this message stream (default true). * It is a global control and effects only in the parent message of a stream.</li> * <li><tt>bool attachable</tt> * Indicates whether or not is allowed to attach files in a message (default true). * It is a global control and effects only in the parent message of a stream.</li> * <li><tt>bool linksDisabled</tt> * Indicates whether or not the message links should be disabled (default false). * It is a loacal control and effects every message.</li> * </ul>

Namespace

Plenty\Modules\Messenger\Models

Properties
Name Type Description

replyable

bool

Indicates whether or not is allowed to reply to this message stream (default true).

attachable

bool

Indicates whether or not is allowed to attach files in a message (default true).

linksDisabled

bool

Indicates whether or not the message links should be disabled (default false).

Methods
public toArray()

Returns this model as an array.

MessageMetaDataNotDone

The MessageMetaDataNotDone model of the messenger.

Namespace

Plenty\Modules\Messenger\Models

Properties
Name Type Description

deactivated

bool

Deactivates the toggle button for the UI

tooltips

array

Tooltips for the UI to show why the toggle is deactivated (if not set, show default values)

Methods
public toArray()

Returns this model as an array.

MessageMetaDataTimeCapture

The MessageMetaDataTimeCapture model of the messenger.

Namespace

Plenty\Modules\Messenger\Models

Properties
Name Type Description

chargeable

bool

minutes

int

Methods
public toArray()

Returns this model as an array.

The MessageMetaLink model of the messenger.

Namespace

Plenty\Modules\Messenger\Models

Properties
Name Type Description

image

string

An optional image URL for the link

caption

string

The caption to be shown for the link

url

string

The link URL <ul> <li>for {@link MessageMetaLink::TYPE_MAILTO} the email</li> <li>for {@link MessageMetaLink::TYPE_URL} the complete URL with protocol</li> <li>for {@link MessageMetaLink::TYPE_PLUGIN} the relative route to the backend</li> <li>not needed for {@link MessageMetaLink::TYPE_REPLY}</li> </ul>

type

string

One of the constants: <ul> <li>{@link MessageMetaLink::TYPE_MAILTO}</li> <li>{@link MessageMetaLink::TYPE_URL}</li> <li>{@link MessageMetaLink::TYPE_PLUGIN}</li> <li>{@link MessageMetaLink::TYPE_REPLY}</li> </ul>

content

string

The reply content, only needed for type {@link MessageMetaLink::TYPE_REPLY}

Methods
public toArray()

Returns this model as an array.

MessageReferrer

The MessageReferrer model of the messenger.

Namespace

Plenty\Modules\Messenger\Models

Properties
Name Type Description

type

string

The type of the from instance (one of {@link MessageTypesService::REFERRER_TYPE_SYSTEM}, {@link MessageTypesService::REFERRER_TYPE_BACKEND}, {@link MessageTypesService::REFERRER_TYPE_REST} and {@link MessageTypesService::REFERRER_TYPE_PLUGIN})

value

The value of the instance. It is an integer (the user id) for type {@link MessageTypesService::REFERRER_TYPE_SYSTEM}, {@link MessageTypesService::REFERRER_TYPE_EMAIL}, {@link MessageTypesService::REFERRER_TYPE_BACKEND} and {@link MessageTypesService::REFERRER_TYPE_REST} and a string (the plugin name) for type {@link MessageTypesService::REFERRER_TYPE_PLUGIN}.

name

string

An optional name for the instance. For type {@link MessageTypesService::REFERRER_TYPE_PLUGIN} it is the plugin namespace, the user name otherwise.

Methods
public toArray()

Returns this model as an array.

MessageTo

The MessageTo model of the messenger.

Namespace

Plenty\Modules\Messenger\Models

Properties
Name Type Description

user

array

An array with user IDs of users receiving the message

role

array

An array with user role IDs of user roles receiving the message

email

array

An array with emails receiving the message

allUsers

bool

Flag indicating that all system users receive the message

Methods
public toArray()

Returns this model as an array.

Services

MessageTypesService

Types and type validation for several types in the messenger.

Namespace

Plenty\Modules\Messenger\Services

Methods
public static getValidLinkedToTypes():array

Gets the valid types for "linked to" references.

public static isValidLinkedTo($linkType, $linkValue):bool

Checks whether the given link is valid or not.

Parameters

Name

Type

Description

$linkType

string

The link type

$linkValue

The link value

public static getValidFromTypes():array

Gets the valid types for "from" references.

public static isValidFrom($fromType, $fromValue):bool

Checks whether the given from is valid or not.

Parameters

Name

Type

Description

$fromType

string

The from type

$fromValue

The from value

public static getValidReferrerTypes():array

Gets the valid types for "referrer" references.

public static isValidReferrer($referrerType, $referrerValue, $referrerName = null):bool

Checks whether the given referrer reference is valid or not.

Parameters

Name

Type

Description

$referrerType

string

The reference to be checked

$referrerValue

The value of the reference

$referrerName

string

The name of the reference

public static getValidToTypes():array

Gets the valid key types for the 'to' array.

public static isValidTo($toKey):bool

Checks whether the given key has a valid value for to.

Parameters

Name

Type

Description

$toKey

string

The to key

MessagesSearchService

Search service for the messenger.

Namespace

Plenty\Modules\Messenger\Services

Methods
public find($uuid):Plenty\Modules\Messenger\Models\Message
Return type: Message

Gets the message with the given uuid.

Parameters

Name

Type

Description

$uuid

string

The UUID of the message

public findOrFail($uuid):Plenty\Modules\Messenger\Models\Message
Return type: Message

Gets the message with the given UUID.

Parameters

Name

Type

Description

$uuid

string

The UUID of the message

public findMany($uuid):array

Gets a stream of messages. The given UUID can be the UUID of the first message in the stream or one of the replied messages.

Parameters

Name

Type

Description

$uuid

string

The UUID of the message

Lists the messages for the given navigation page.

Parameters

Name

Type

Description

$page

int

The page of results to search for

$itemsPerPage

int

The number of items to list per page

public getTotalEntries():int

Returns total entries

public static loadMessage($path):Plenty\Modules\Messenger\Models\Message
Return type: Message

Get an instance of the model.

Parameters

Name

Type

Description

$path

string

public findByConversationId($conversationUuid):array

Gets a stream of messages. The given UUID can be the UUID of the first message in the stream or one of the replied messages.

Parameters

Name

Type

Description

$conversationUuid

string

The UUID of the message

public toArray():array
public process($data):array
Parameters

Name

Type

Description

$data

array

public getFilter():array
public getPostFilter():array
public getQuery():array
public getAggregations():array
public getSuggestions():array
public getSources():void
public addDependenciesToSource($sources):void
Parameters

Name

Type

Description

$sources

public getName():void
public setName($name):void
Parameters

Name

Type

Description

$name

public setIsSourceDisabled($isSourceDisabled):void
Parameters

Name

Type

Description

$isSourceDisabled

bool

public setTrackTotalHits($trackTotalHits):void
Parameters

Name

Type

Description

$trackTotalHits

bool

public addFilter($filter):Plenty\Modules\Cloud\ElasticSearch\Lib\Search\BaseSearch
Return type: BaseSearch
Parameters

Name

Type

Description

$filter

TypeInterface

public addPostFilter($filter):Plenty\Modules\Cloud\ElasticSearch\Lib\Search\BaseSearch
Return type: BaseSearch
Parameters

Name

Type

Description

$filter

TypeInterface

public addQuery($query):Plenty\Modules\Cloud\ElasticSearch\Lib\Search\BaseSearch
Return type: BaseSearch
Parameters

Name

Type

Description

$query

TypeInterface

public addSource($source):Plenty\Modules\Cloud\ElasticSearch\Lib\Search\BaseSearch
Return type: BaseSearch
Parameters

Name

Type

Description

$source

SourceInterface

public setSorting($sorting):Plenty\Modules\Cloud\ElasticSearch\Lib\Search\BaseSearch
Return type: BaseSearch
Parameters

Name

Type

Description

$sorting

SortingInterface

public addAggregation($aggregation):Plenty\Modules\Cloud\ElasticSearch\Lib\Search\BaseSearch
Return type: BaseSearch
Parameters

Name

Type

Description

$aggregation

AggregationInterface

public addSuggestion($suggestion):Plenty\Modules\Cloud\ElasticSearch\Lib\Search\BaseSearch
Return type: BaseSearch
Parameters

Name

Type

Description

$suggestion

SuggestionInterface

public setPage($page, $rowsPerPage):Plenty\Modules\Cloud\ElasticSearch\Lib\Search\BaseSearch
Return type: BaseSearch
Parameters

Name

Type

Description

$page

int

$rowsPerPage

int

public setPagination($pagination):void
Parameters

Name

Type

Description

$pagination

public setCollapse($collapse):void
Parameters

Name

Type

Description

$collapse

CollapseInterface

public setScoreModifier($scoreModifier):Plenty\Modules\Cloud\ElasticSearch\Lib\Search\BaseSearch
Return type: BaseSearch
Parameters

Name

Type

Description

$scoreModifier

ScoreModifierInterface

public setMaxResultWindow($maxResults = 10000):void
Parameters

Name

Type

Description

$maxResults

int

public setIndex($index):void
Parameters

Name

Type

Description

$index

public isSearchAfter():void
public getFilterRaw():void
public getQueriesRaw():void
public getAggregationsRaw():array
public getSorting():void
public getScoreModifier():void

NewMessengerStatusService

New messenger status checker service

Namespace

Plenty\Modules\Messenger\Services

Methods
public static isActive():void

Conversations

Contracts

ConversationCategoryRepositoryContract

The ConversationCategoryRepositoryContract is the interface for the messenger conversations categories. This interface defines methods to add, update and show categories.

Namespace

Plenty\Modules\Messenger\Conversations\Contracts

Methods
public getCategory($id):Plenty\Modules\Messenger\Conversations\Models\ConversationCategory
Return type: ConversationCategory

Retrieves a category based on ID

Parameters

Name

Type

Description

$id

int

Category ID

public createCategory($categoryData):Plenty\Modules\Messenger\Conversations\Models\ConversationCategory
Return type: ConversationCategory

Creates a new category

Parameters

Name

Type

Description

$categoryData

array

Array with category properties

public updateCategory($id, $data):Plenty\Modules\Messenger\Conversations\Models\ConversationCategory
Return type: ConversationCategory

Updates an existing category

Parameters

Name

Type

Description

$id

int

Category ID

$data

array

Array with cateogry properties

public updateCategoryStatus($id, $isEnabled):Plenty\Modules\Messenger\Conversations\Models\ConversationCategory
Return type: ConversationCategory
Parameters

Name

Type

Description

$id

int

$isEnabled

bool

public listCategories($page, $itemsPerPage, $sortBy, $sortOrder, $filters = []):Plenty\Repositories\Models\PaginatedResult
Return type: PaginatedResult

Lists all categories based on provided filters

Parameters

Name

Type

Description

$page

int

Page number

$itemsPerPage

int

Number of results per page

$sortBy

string

Sort column (id, position)

$sortOrder

string

Sort order (asc/desc)

$filters

array

Array with filters (isDeleted, typeId, id, name)

public deleteCategory($id):bool

Deletes a category (soft delete)

Parameters

Name

Type

Description

$id

int

Status ID

public batchDeleteCategories($categoryIds):bool

Deletes a batch of categories

Parameters

Name

Type

Description

$categoryIds

array

ConversationFolderRepositoryContract

The ConversationFolderRepositoryContract is the interface for the messenger conversations folders. This interface defines methods to add, update and show folders.

Namespace

Plenty\Modules\Messenger\Conversations\Contracts

Methods
public getFolder($uuid):Plenty\Modules\Messenger\Conversations\Models\ConversationFolder
Return type: ConversationFolder

Retrieves a folder object based on UUID

Parameters

Name

Type

Description

$uuid

string

The UUID of the folder

public createFolder($data):Plenty\Modules\Messenger\Conversations\Models\ConversationFolder
Return type: ConversationFolder

Creates a new folder. Important! The userId property will be automatically set based on the current logged in user.

Parameters

Name

Type

Description

$data

array

Array with folder properties

public updateFolder($uuid, $data):Plenty\Modules\Messenger\Conversations\Models\ConversationFolder
Return type: ConversationFolder

Updates an existing folder.

Parameters

Name

Type

Description

$uuid

string

Folder UUID

$data

array

Array with folder properties

public listFolders($userId, $page, $itemsPerPage, $sortBy, $sortOrder):Plenty\Repositories\Models\PaginatedResult
Return type: PaginatedResult

Returns a paginated result with all folders

Parameters

Name

Type

Description

$userId

int

ID of the folder owner

$page

int

Page number

$itemsPerPage

int

Items per page

$sortBy

string

Sort column

$sortOrder

string

Sort order

public deleteFolder($uuid):bool

Deletes a folder

Parameters

Name

Type

Description

$uuid

string

The UUID of the deleted folder

ConversationRepositoryContract

The ConversationRepositoryContract is the interface for the messenger conversations repository. This interface defines methods to add, update and show conversations.

Namespace

Plenty\Modules\Messenger\Conversations\Contracts

Methods
public listConversations($request):array

List all conversations and returns a paginated result

Parameters

Name

Type

Description

$request

array

List of filters, page number, items per page and "with" array

public searchConversations($getFilters, $postFilters):array

List all conversations and returns a paginated result

Parameters

Name

Type

Description

$getFilters

array

$postFilters

array

public createConversation($data):Plenty\Modules\Messenger\Conversations\Models\Conversation
Return type: Conversation

Creates a new conversation

Parameters

Name

Type

Description

$data

array

Conversation data

public getConversation($uuid5, $with = []):Plenty\Modules\Messenger\Conversations\Models\Conversation
Return type: Conversation

Retrieves a conversation

Parameters

Name

Type

Description

$uuid5

string

Conversation UUID

$with

array

Array with extra relations (possible values: ["messages"])

public updateConversation($uuid5, $data):Plenty\Modules\Messenger\Conversations\Models\Conversation
Return type: Conversation

Updates a conversation

Parameters

Name

Type

Description

$uuid5

string

Conversation UUID

$data

array

Conversation data. If a property key is missing, the old value will be kept.

public updateClose($uuids, $isClosed):int

Sets a batch of conversations closed status

Parameters

Name

Type

Description

$uuids

array

Array of conversations UUID’s

$isClosed

bool

Close status (true/false)

public updateTags($uuid, $tagIds):int

Update the list of tags for a conversation

Parameters

Name

Type

Description

$uuid

string

Conversation UUID

$tagIds

array

Array of tag ID’s

public addTags($uuids, $tagIds):int

Adds to a batch of conversations new tags. The list of tags will be extra added to the existing list of tags for each conversation

Parameters

Name

Type

Description

$uuids

array

Array of conversations UUID’s

$tagIds

array

Array of tag ID’s

public updateDeadline($uuids, $deadline = null):int

Sets deadline for a batch of conversations

Parameters

Name

Type

Description

$uuids

array

Array of conversations UUID’s

$deadline

string

Deadline in format YYYY-MM-DD H:i:s. If null is set, the deadline will be removed

public updateFollowUpDate($uuids, $followUpDate = null):int

Sets follow up date for a batch of conversations

Parameters

Name

Type

Description

$uuids

array

Array of conversations UUID’s

$followUpDate

string

Follow up date in format YYYY-MM-DD H:i:s. If null is set, the follow up date will be removed

public updateRead($uuids, $userId, $read):int

Marks a batch of conversations as red/not read by the given user

Parameters

Name

Type

Description

$uuids

array

Array of conversations UUID’s

$userId

int

ID of the user

$read

bool

Read status: true/false

public batchResubmitConversations($uuids):int

Resubmits all conversations with follow up date today (resets read by array, resets follow up date)

Parameters

Name

Type

Description

$uuids

array

Array of conversations UUID’s

public addSubscribers($uuid, $userId):int

Subscribes a user to a conversation. A subscribed user will receive notifications related to that conversation (via email or in the admin notifications area)

Parameters

Name

Type

Description

$uuid

string

Conversation UUID

$userId

int

ID of the user

public removeSubscribers($uuid, $userId):int

Unsubscribes a user from a conversation

Parameters

Name

Type

Description

$uuid

string

Conversation UUID

$userId

int

ID of the user

public deleteConversation($uuid5):int

Soft deletes a conversation. Conversation will be visible in the trash folder.

Parameters

Name

Type

Description

$uuid5

string

Conversation UUID

public batchDeleteConversations($uuids):int

Soft deletes a batch of conversations. Conversations will be visible in the trash folder.

Parameters

Name

Type

Description

$uuids

string

List of conversations UUID’s separated by comma

public searchReceiver($searchTerm, $companyId = null):array

Search and returns a list of possible receivers. Search is done by contact name, contact id, order ID, user ID, user name. Search term must have minimum 3 letters

Parameters

Name

Type

Description

$searchTerm

string

The searched term

$companyId

int

The company ID for witch will make the search

public getInboxes():array

Retrieves the list of configured inboxes. If the inbox is not active it will not be returned in the response.

public updatePriority($uuids, $priorityId):int

Sets priority for a batch of conversations

Parameters

Name

Type

Description

$uuids

array

Array of conversations UUID’s

$priorityId

int

Id of priority (0 - No priority, 1 - Very low, 2 - low, 3 - Medium, 4 - High, 5 - Very high)

public updateConversationsTypeAndStatus($conversationsUuids, $typeId, $statusId):bool

Sets the type and status for a batch of conversations

Parameters

Name

Type

Description

$conversationsUuids

array

Array of conversations UUID’s

$typeId

int

Type ID of conversation. If null is set, the conversation type will be removed.

$statusId

int

Status ID of conversation. If null is set, the conversation status will be removed.

public getTotals():array

Returns the total number of unread conversations for current user

public emptyTrash($days = null):bool

Permanently deletes all the messages from trash older than $days (based on deleted at field). If days is null, all messages from trash will be permanently deleted. Emptying of the trash will be done immediately.

Parameters

Name

Type

Description

$days

int

Minimum number of days since the conversation was moved to trash

public queueEmptyTrash($days = null):bool

Adds the empty trash command to a queue. Emptying of the trash will happen sometime in the future, when the first worker is available to process the queue (less impact on Elastic Search index).

Parameters

Name

Type

Description

$days

int

Minimum number of days since the conversation was moved to trash

public archiveConversations($uuids, $isFromUI):int

Archives a batch of conversations. Conversations will be visible in archive folder (filter isArchive = true in list conversations)

Parameters

Name

Type

Description

$uuids

array

Array of conversations UUID’s

$isFromUI

bool

Flag that specifies if action is triggered from UI. If set to true, the action will be performed immediately. If set to false, the action will be queued (less impact on Elastic Search index)

public restoreArchivedConversations($uuids):int

Restores a batch of conversations from the archive. The operation is performed immediately.

Parameters

Name

Type

Description

$uuids

array

Array of conversations UUID’s

public permanentlyDeleteArchivedConversations($uuids):int

Permanently deletes a batch of conversations from the archive

Parameters

Name

Type

Description

$uuids

array

Array of conversations UUID’s. The operation is performed immediately.

public batchRestoreConversations($uuids):int

Restores from trash a batch of conversations

Parameters

Name

Type

Description

$uuids

array

Array of conversations UUID’s. The operation is performed immediately.

public updateSubscribe($uuids):int

Subscribes current user to a batch of conversations

Parameters

Name

Type

Description

$uuids

array

Array of conversations UUID’s.

public updateUnsubscribe($uuids):int

Unsubscribes the current user from a batch of conversations

Parameters

Name

Type

Description

$uuids

array

Array of conversations UUID’s.

public automaticallyArchiveConversations($days):bool

Automatically archives conversations older than $days days. The updatedAt field is taken into consideration when calculating conversation age.

Parameters

Name

Type

Description

$days

int

Minimum number of days since the conversation was last updated

public updateConversationsFoldersRelations($conversationsUuids, $foldersUuids):bool

Assigns batch of conversation to batch of folders. The list of folders must belong to the current logged in user ID.

Parameters

Name

Type

Description

$conversationsUuids

array

Array of conversations UUID’s

$foldersUuids

array

Array of folders UUID’s

public removeConversationFolders($conversationsUuid, $foldersUuidsToKeep):bool

Removes conversation from all folders except the ones passed to array $foldersUuidsToKeep. This operation will be performed only for folders belonging to current logged in user ID.

Parameters

Name

Type

Description

$conversationsUuid

string

Conversation UUID

$foldersUuidsToKeep

array

Array of folders UUID’s to keep. If array is empty, conversation will be removed from all folders

public addToFolders($conversationsUuids, $foldersUuids):bool

Add multiple conversations to multiple folders

Parameters

Name

Type

Description

$conversationsUuids

array

The conversations UUIDs

$foldersUuids

array

The folders UUIDs

public removeFromFolders($conversationsUuids, $foldersUuids):bool

Remove multiple conversations from multiple folders

Parameters

Name

Type

Description

$conversationsUuids

array

The conversations UUIDs

$foldersUuids

array

The folders UUIDs

public getHistoryByConversationUUID($UUID):array

Retrieves history for a conversation

Parameters

Name

Type

Description

$UUID

string

ConversationRoleRepositoryContract

The ConversationRoleRepositoryContract is the interface for the messenger conversations roles. * This interface defines methods to add, update, delete and show roles.

Namespace

Plenty\Modules\Messenger\Conversations\Contracts

Methods
public getRoleById($roleId):Plenty\Modules\Messenger\Conversations\Models\Roles\ConversationRole
Return type: ConversationRole

Get role details by role id

Parameters

Name

Type

Description

$roleId

int

ID of the role

public listRoles($page = 1, $itemPerPage = 25, $sortBy = &quot;id&quot;, $sortOrder = &quot;asc&quot;, $filters = []):Plenty\Repositories\Models\PaginatedResult
Return type: PaginatedResult

Get paginated results for roles

Parameters

Name

Type

Description

$page

int

Page number

$itemPerPage

int

Items per page

$sortBy

string

Column name to be sorted by

$sortOrder

string

Sort order

$filters

array

public updateRole($roleId, $data):Plenty\Modules\Messenger\Conversations\Models\Roles\ConversationRole
Return type: ConversationRole

Update a role

Parameters

Name

Type

Description

$roleId

int

The id of the role to be updated

$data

array

Aray with Role properties to be updated

public deleteRole($roleId):bool

Delete a role

Parameters

Name

Type

Description

$roleId

int

The id of the role to be deleted

public createRole($data):Plenty\Modules\Messenger\Conversations\Models\Roles\ConversationRole
Return type: ConversationRole

Create new role

Parameters

Name

Type

Description

$data

array

public batchDeleteRoles($roleIds):bool

Deletes a batch of roles

Parameters

Name

Type

Description

$roleIds

array

Array with role ID’s

ConversationStatusRepositoryContract

The ConversationStatusRepositoryContract is the interface for the messenger conversations statuses. This interface defines methods to add, update and show statuses.

Namespace

Plenty\Modules\Messenger\Conversations\Contracts

Methods
public getStatus($id):Plenty\Modules\Messenger\Conversations\Models\ConversationStatus
Return type: ConversationStatus

Retrieves a status based on ID

Parameters

Name

Type

Description

$id

int

Status ID

public createStatus($statusData):Plenty\Modules\Messenger\Conversations\Models\ConversationStatus
Return type: ConversationStatus

Creates a new status

Parameters

Name

Type

Description

$statusData

array

Array with status properties

public updateStatus($id, $data):Plenty\Modules\Messenger\Conversations\Models\ConversationStatus
Return type: ConversationStatus

Updates an existing status

Parameters

Name

Type

Description

$id

int

Status ID

$data

array

Array with status properties

public listStatuses($page, $itemsPerPage, $sortBy, $sortOrder, $filters = []):Plenty\Repositories\Models\PaginatedResult
Return type: PaginatedResult

Lists all statuses based on provided filters

Parameters

Name

Type

Description

$page

int

Page number

$itemsPerPage

int

Number of results per page

$sortBy

string

Sort column (id, position)

$sortOrder

string

Sort order (asc/desc)

$filters

array

Array with filters (isDeleted, typeId, id, name)

public deleteStatus($id):bool

Deletes a status (soft delete)

Parameters

Name

Type

Description

$id

int

Status ID

public batchDeleteStatuses($statusIds):bool

Deletes a batch of statuses

Parameters

Name

Type

Description

$statusIds

array

Array with status ID’s

ConversationTypeRepositoryContract

The ConversationTypeRepositoryContract is the interface for the messenger conversations types. This interface defines methods to add, update and show types.

Namespace

Plenty\Modules\Messenger\Conversations\Contracts

Methods
public getType($id):Plenty\Modules\Messenger\Conversations\Models\ConversationType
Return type: ConversationType

Retrieves a type based on ID

Parameters

Name

Type

Description

$id

int

Type ID

public createType($typeData):Plenty\Modules\Messenger\Conversations\Models\ConversationType
Return type: ConversationType

Creates a new type

Parameters

Name

Type

Description

$typeData

array

Array with type properties

public updateType($id, $typeData):Plenty\Modules\Messenger\Conversations\Models\ConversationType
Return type: ConversationType

TUpdates an existing type

Parameters

Name

Type

Description

$id

int

Type ID

$typeData

array

Array with type properties

public listTypes($page, $itemsPerPage, $sortBy, $sortOrder, $filters = [], $with = []):Plenty\Repositories\Models\PaginatedResult
Return type: PaginatedResult

Lists all types based on filters and returns a paginated result

Parameters

Name

Type

Description

$page

int

Page number

$itemsPerPage

int

Number of results per page

$sortBy

string

Sort column (id, position)

$sortOrder

string

Sort order (asc/desc)

$filters

array

Array with filters (name, isDeleted, id)

$with

array

(allStatuses ,activeStatuses)

public deleteType($id):bool

Deletes a type

Parameters

Name

Type

Description

$id

int

Type ID

public batchDeleteTypes($typeIds):bool

Deletes a batch of types

Parameters

Name

Type

Description

$typeIds

array

Array of type ID’s

Events

DeadlineChangeConversationEvent

The event is triggered when the conversation deadline is changed.

Namespace

Plenty\Modules\Messenger\Conversations\Events

Methods
public getConversationUUID():void

NewConversationEvent

The event is triggered when a new conversation is created by a user (via UI or REST API).

Namespace

Plenty\Modules\Messenger\Conversations\Events

Methods
public getConversationUUID():void

NewEmailFromCustomerConversationEvent

The event is triggered when a new conversation is created by a customer (received via inbox).

Namespace

Plenty\Modules\Messenger\Conversations\Events

Methods
public getConversationUUID():void

NewReplyConversationEvent

The event is triggered when an user replyes to an existing conversation (via UI or REST API).

Namespace

Plenty\Modules\Messenger\Conversations\Events

Methods
public getConversationUUID():void

NewReplyFromCustomerConversationEvent

The event is triggered when the customer replyes to an existing conversation (reply received via inbox).

Namespace

Plenty\Modules\Messenger\Conversations\Events

Methods
public getConversationUUID():void

PriorityChangeConversationEvent

The event is triggered when the conversation priority is changed.

Namespace

Plenty\Modules\Messenger\Conversations\Events

Methods
public getConversationUUID():void

StatusChangeConversationEvent

The event is triggered when the conversation status is changed.

Namespace

Plenty\Modules\Messenger\Conversations\Events

Methods
public getConversationUUID():void

TagAddedConversationEvent

The event is triggered when a tag is added to a conversation.

Namespace

Plenty\Modules\Messenger\Conversations\Events

Methods
public getConversationUUID():void

TagRemovedConversationEvent

The event is triggered when a tag is removed from a conversation.

Namespace

Plenty\Modules\Messenger\Conversations\Events

Methods
public getConversationUUID():void

Models

Conversation

The Conversation model of the messenger.

Namespace

Plenty\Modules\Messenger\Conversations\Models

Properties
Name Type Description

uuid

string

The UUID of the conversation

shortId

string

The Short ID of the Conversation

plentyIdHash

string

The plentyIdHash

plentyId

int

The plentyId of the relation contact

inboxId

string

The inboxId from the assistant

title

string

The Title of the Conversation

conversationRelation

array

The relations to other entities

tagIds

array

Array of tag IDs

isClosed

bool

Boolean that indicates if the conversation is closed

isDeleted

bool

Boolean that indicates if the conversation is deleted

referrer

MessageReferrer

Array of referrers

readBy

array

Array of user ids (int)

subscribers

ConversationSubscribers

Subscribers of the conversation

createdAt

Creation Date

updatedAt

Update Date

deletedAt

Deletion Date

deadline

Deadline Date

followUpDate

FollowUpDate Date

messages

array

Conversation messages

int

attachmentsCount Attachment messages count

int

billedMsgCount Conversation billed msg count

int

billedMinutesCount Conversation billed minutes count

bool

validRelation Conversation has the relations validated

priorityId

string

The Priority of the Conversation

from

ConversationFrom

Conversation from

typeId

int

ID of conversation type

typePosition

int

Sort order of conversation type

statusId

int

ID of conversation status

statusPosition

int

Sort order of conversation status

hasWhisperedMessages

bool

Flag that indicates if a conversation contains whispered messages

messagesTitles

array

Array of all message titles

messagesBodies

array

Array with all message bodies stripped of tags

messagesTags

array

Array with all tag ID’s from all messages

messagesReferrers

array

Array with all referrers from all messages

messagesFroms

array

Array with all from fields from all messages

messagesPaths

array

Array with s3 messages paths

messagesIds

array

Array with all messages UUID’s

isMigratedToEs

int

Flag that indicates if the conversation is synced to ES (used during messenger migration to new structure)

isArchived

bool

Flag that indicates if the conversation is archived

conversationPreview

string

Strip last the message from messagesBodies to 200 characters, used for preview.

categoryId

int

Flag that indicates if the conversation is archived

linkedFolders

array

List of linked folders

marketplacesMetadata

array

marketplaces Meta data

owners

array

Conversation Owners

Methods
public toArray()

Returns this model as an array.

ConversationCategory

The ConversationCategory model of the messenger.

Namespace

Plenty\Modules\Messenger\Conversations\Models

Properties
Name Type Description

names

array

Collection of category names for different languages

types

array

Collection of types that belong to that category

id

int

The ID of the type

position

int

The position of the type (used in sorting)

userId

int

The user ID which performed the last update

icon

string

The icon for messenger tab

iconType

string

The icon type

isDeleted

bool

Flag that indicates if the type was deleted

isEnabled

bool

Flag that indicates if the type is enabled

Methods
public toArray()

Returns this model as an array.

ConversationCategoryNames

The ConversationCategoryNames model of the messenger.

Namespace

Plenty\Modules\Messenger\Conversations\Models

Properties
Name Type Description

lang

string

The language of the name

name

string

The category name

Methods
public toArray()

Returns this model as an array.

ConversationFolder

The Conversation model of the messenger.

Namespace

Plenty\Modules\Messenger\Conversations\Models

Properties
Name Type Description

uuid

string

The UUID of the folder

name

string

The name of the folder

userId

int

The user ID which is the folder owner

Methods
public toArray()

Returns this model as an array.

ConversationFolderProperty

The ConversationFolderProperty model of the messenger.

Namespace

Plenty\Modules\Messenger\Conversations\Models

Properties
Name Type Description

userId

string

foldersUuids

array

Methods
public toArray()

Returns this model as an array.

ConversationFrom

The ConversationFrom model of the messenger.

Namespace

Plenty\Modules\Messenger\Conversations\Models

Properties
Name Type Description

type

string

The type of the from instance (one of {@link ConversationFrom::FROM_TYPE_USER}, {@link ConversationFrom::FROM_TYPE_CONTACT} and {@link ConversationFrom::FROM_TYPE_EMAIL})

value

The value of the instance. For type {@link ConversationFrom::FROM_TYPE_EMAIL} it is a string (the email) and the id of the user or the contact otherwise.

name

string

An optional name for the instance, e.g. the real name for type {@link ConversationFrom::FROM_TYPE_EMAIL}

Methods
public toArray()

Returns this model as an array.

ConversationOwner

The ConversationOwners model of the messenger.

Namespace

Plenty\Modules\Messenger\Conversations\Models

Properties
Name Type Description

roleId

int

The id of the role

ownerId

int

The user id value

Methods
public toArray()

Returns this model as an array.

ConversationRelation

The ConversationRelation model of the messenger.

Namespace

Plenty\Modules\Messenger\Conversations\Models

Properties
Name Type Description

type

string

The type of the relation (one of {@link ConversationRelation::RELATION_TYPE_CONTACT}, {@link ConversationRelation::RELATION_TYPE_ORDER}, {@link ConversationRelation::RELATION_TYPE_EMAIL}, {@link ConversationRelation::RELATION_TYPE_PAYMENT}) {@link ConversationRelation::RELATION_TYPE_USER}, {@link ConversationRelation::RELATION_AMAZON_ORDER}) {@link ConversationRelation::RELATION_TYPE_CONTACT_EMAIL}, {@link ConversationRelation::RELATION_TYPE_CONTACT_ID}) {@link ConversationRelation::RELATION_TYPE_CONTACT_NUMBER}, {@link ConversationRelation::RELATION_TYPE_INVOICE_NUMBER}) {@link ConversationRelation::RELATION_TYPE_ORDER_ID}), {@link ConversationRelation::RELATION_ORDER_EXTERNAL_ID})

value

Array with entity values

Methods
public toArray()

Returns this model as an array.

ConversationStatus

The ConversationStatus model of the messenger.

Namespace

Plenty\Modules\Messenger\Conversations\Models

Properties
Name Type Description

names

array

Collection of status names for different languages

id

int

The ID of the status

position

int

The position of the status (used in sorting)

userId

int

The suer ID which performed the last update

isDeleted

bool

Flag that indicates if the status was deleted

int

typeId The ID of the parent type

int

progress Percentage of progress (0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100)

string

colour Color of the status background (example: #0084ff)

Methods
public toArray()

Returns this model as an array.

ConversationStatusNames

The ConversationStatusNames model of the messenger.

Namespace

Plenty\Modules\Messenger\Conversations\Models

Properties
Name Type Description

lang

string

The language of the name

name

string

The name of the status

Methods
public toArray()

Returns this model as an array.

ConversationSubscribers

The ConversationSubscribers model of the messenger.

Namespace

Plenty\Modules\Messenger\Conversations\Models

Properties
Name Type Description

userIds

array

The array of userIds subscribed to a message

roleIds

array

The array of roleIds subscribed to a message (not used)

Methods
public toArray()

Returns this model as an array.

ConversationType

The ConversationType model of the messenger.

Namespace

Plenty\Modules\Messenger\Conversations\Models

Properties
Name Type Description

names

array

Collection of type names for different languages

statuses

array

Collection of statuses that belong to that type

id

int

The ID of the type

position

int

The position of the type (used in sorting)

userId

int

The suer ID which performed the last update

isDeleted

bool

Flag that indicates if the type was deleted

categoryId

bool

The ID of the parent category

Methods
public toArray()

Returns this model as an array.

ConversationTypeNames

The ConversationTypeNames model of the messenger.

Namespace

Plenty\Modules\Messenger\Conversations\Models

Properties
Name Type Description

lang

string

The language of the name

name

string

The type name

Methods
public toArray()

Returns this model as an array.

SearchReceiver

The Conversation model of the messenger.

Namespace

Plenty\Modules\Messenger\Conversations\Models

Properties
Name Type Description

id

int

The ID of the entity

name

string

The name of the entity

email

string

The email of the entity

lang

string

The lang of the entity

externalId

string

The external ID of the entity

type

string

The entity type

Methods
public toArray()

Returns this model as an array.

Ebay

Contracts

EbayAccountsRepositoryContract

The EbayAccountsRepositoryContract is the interface for Merketplaces Ebay EbayAccount

Namespace

Plenty\Modules\Messenger\Conversations\Marketplaces\Ebay\Contracts

Methods
public listEbayAccounts():Illuminate\Support\Collection
Return type: Collection

Get all ebay accounts

public getActiveEbayAccounts():Illuminate\Support\Collection
Return type: Collection

Get all ebay active accounts

public createEbayAccount($data):Plenty\Modules\Messenger\Conversations\Marketplaces\Ebay\Models\EbayAccount
Return type: EbayAccount

Create a new Ebay account

Parameters

Name

Type

Description

$data

array

public updateEbayAccounts($data):Illuminate\Support\Collection
Return type: Collection

Update an existing array of Ebay account settings

Parameters

Name

Type

Description

$data

array

public deleteEbayAccount($accountSettingsId):bool

Delete an Ebay account (the account will be flagged with deleted=1) The action will not delete the account

Parameters

Name

Type

Description

$accountSettingsId

int

public getEbayAccount($accountSettingsId):Plenty\Modules\Messenger\Conversations\Marketplaces\Ebay\Models\EbayAccount
Return type: EbayAccount

Get Ebay account details

Parameters

Name

Type

Description

$accountSettingsId

int

Models

EbayAccount

The Ebay Settings model of the messenger.

Namespace

Plenty\Modules\Messenger\Conversations\Marketplaces\Ebay\Models

Properties
Name Type Description

id

int

The id of the messenger ebay settings account

ebayAccountId

int

The id of the ebay account

name

string

The name of the ebay account

isEnabled

bool

The status of the messenger ebay settings account

isDeleted

bool

The deleted status of the messenger ebay settings account

settings

array

The list of settings of the messenger ebay settings account *

Methods
public toArray()

Returns this model as an array.

MarketplacesMetaDataEbayProperties

The Ebay properties model of the messenger.

Namespace

Plenty\Modules\Messenger\Conversations\Marketplaces\Ebay\Models

Properties
Name Type Description

ebayCreatedAt

string

The creation datetime

ebaySenderName

string

The name of the sender

ebayMessageId

string

The message id

ebayExternalMessageId

string

The external message id

ebaySellerName

string

The name of the seller

ebayItemId

string

The id of the item

ebayItemEndTime

string

The end time of the item

ebayType

string

Ebay message type

ebayResponseEnabled

bool

Ebay response enabled/disabled

ebayAccountId

int

Ebay account ID

ebayMessengerAccountId

int

Messenger Ebay account ID

Methods
public toArray()

Returns this model as an array.

Settings

The EbayAccount's settings model of the messenger.

Namespace

Plenty\Modules\Messenger\Conversations\Marketplaces\Ebay\Models

Properties
Name Type Description

markAsRead

bool

Mark the conversation as read

defaultStatus

int

The conversation’s default status

defaultType

int

The conversation’s default status

Methods
public toArray()

Returns this model as an array.

Marketplaces

Models

MessageMarketplacesMetaData

The marketplaces data model of the messenger.

Namespace

Plenty\Modules\Messenger\Conversations\Marketplaces\Models

Properties
Name Type Description

ebayProperties

MarketplacesMetaDataEbayProperties

Ebay properties

Methods
public toArray()

Returns this model as an array.

Models

Roles

ConversationRole

The ConversationRole model of the messenger.

Namespace

Plenty\Modules\Messenger\Conversations\Models\Roles

Properties
Name Type Description

id

int

position

int

userId

int

isDeleted

bool

names

ConversationRoleNames

Methods
public toArray()

Returns this model as an array.

ConversationRoleNames

The ConversationRoleNames model of the messenger.

Namespace

Plenty\Modules\Messenger\Conversations\Models\Roles

Properties
Name Type Description

lang

string

name

string

Methods
public toArray()

Returns this model as an array.

TicketSystemMigration

Contracts

TicketMigrationStatusRepositoryContract

TicketMigrationRepositoryContract is the interface for the ticketMigrationStatus repository. * This interface allows to list, get, create ticketMigrationStatus.

Namespace

Plenty\Modules\Messenger\TicketSystemMigration\Contracts

Methods
public saveTicketMigrationStatus($data):bool

Adds a new ticketMigrationStatus entry

Parameters

Name

Type

Description

$data

array

The ticketMigrationStatus data as array.

Models

TicketMigrationStatus

The ticket migration status model.

Namespace

Plenty\Modules\Messenger\TicketSystemMigration\Models

Referenceable

id

Properties
Name Type Description

id

int

The PK ID

ticketId

int

The ticket ID

migrationStatus

int

The status of the migration that took place: <ul> <li> failed </li> <li> migrated</li> </ul>

errorMessage

string

The details of the failed migration

conversationId

string

The new conversation Id that the ticket is mapped to

createdAt

The date the ticket status of the migration was created

updatedAt

The date the ticket status of the migration was last updated

Methods
public toArray()

Returns this model as an array.