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.
Name |
Type |
Description |
|
The message data to be loaded |
public show($uuid):void
Gets a message with all its successors.
Name |
Type |
Description |
|
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.
Name |
Type |
Description |
|
The reference UUID5 of the message to start from (excluding). If not set, the uuid of the newest message will be used. |
|
|
If set to FALSE, the messages older than the referenced message will be returned. |
|
|
The amount of messages to list (defaults to 50) |
public getMessages($page = self::DEFAULT_PAGE_OF_MESSAGES, $itemsPerPage = self::DEFAULT_ITEMS_PER_PAGE_OF_MESSAGES):array
Lists messages.
Name |
Type |
Description |
|
The number of the returned page of messages, default is 1 (the first) |
|
|
The amount of messages to list (defaults to 50) |
public updateReadBy($readBy, $uuid):void
Updates the readBy array of the message.
Name |
Type |
Description |
|
The ID of the user who read the message |
|
|
The UUID of the message |
Updates the tags of the message.
Name |
Type |
Description |
|
Array of tag IDs of the message |
|
|
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.
Name |
Type |
Description |
|
The message with the data to be updated |
|
|
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.
Name |
Type |
Description |
|
The controls data to be updated. |
|
|
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.
Name |
Type |
Description |
|
The doneAt date as ISO date string |
|
|
The UUID of the message |
public delete($uuid):int
Deletes a message stream by the UUID. Returns the count of messages deleted.
Name |
Type |
Description |
|
The UUID of the message |
public getAttachment($uuid, $filename):Plenty\Modules\Messenger\Models\Attachment
Return type: Attachment
Gets a message attachment.
Name |
Type |
Description |
|
The UUID of the message |
|
|
The file name of the attachment |
public getAllAttachments($uuid):Plenty\Modules\Messenger\Models\Attachment
Return type: Attachment
Gets all message attachments as zip.
Name |
Type |
Description |
|
The UUID of the message |
public updateMetaData($uuid, $metaData):Plenty\Modules\Messenger\Models\Message
Return type: Message
Updates the meta data of the message.
Name |
Type |
Description |
|
The UUID of the message |
|
|
The meta data of the message |
public getTotalEntries():int
Returns total message entries
public setFilters($filters = []):void
Sets the filter array.
Name |
Type |
Description |
|
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
Name | Type | Description |
---|---|---|
name |
The file name of the attachment |
|
message |
The UUID of the message the attachment belongs to |
|
size |
The size of the attachment in bytes |
|
contentType |
The content type fo the attachment |
|
content |
The content of the attachment |
|
createdAt |
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
Name | Type | Description |
---|---|---|
uuid |
The UUID5 identifier of the message |
|
plentyIdHash |
The plenty ID hash |
|
parentUuid |
The UUID5 of the parent message |
|
conversationId |
The UUID5 of the conversation |
|
linkedTo |
An array with MessageLinkedTo instances |
|
from |
The sender of the message as MessageFrom instance. |
|
to |
The user and role IDs and emails receiving the message |
|
whispered |
Whether the message is whispered (not visible for the contact/order linked to the message) or not |
|
tags |
An array with tag IDs assigned to the message |
|
title |
The title of the message |
|
preview |
The first two lines of the message without any markup |
|
message |
The content of the message |
|
plainMessage |
The content of the message as plain text |
|
attachedFilesCount |
The amount of attached files (readonly) |
|
referrer |
The message referrer |
|
metaData |
The meta data of the message |
|
doneAt |
The date the messages was set to done |
|
createdAt |
The creation date of the message |
|
updatedAt |
The date of the last update of the message |
|
deletedAt |
The date the message was deleted |
|
deletedBy |
The ID of the user who deleted the message |
|
attachments |
The message attachments |
Methods
public toArray()
Returns this model as an array.
MessageFrom
The MessageFrom model of the messenger.
Namespace
Plenty\Modules\Messenger\Models
Name | Type | Description |
---|---|---|
type |
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 |
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
Name | Type | Description |
---|---|---|
type |
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
Name | Type | Description |
---|---|---|
readBy |
The array of users |
|
links |
Array with links |
|
notDoneByBackend |
deactivates the toggle button in the messenger ui (backend) also has optional tooltips (reason for the deactivated toggle) |
|
controls |
An object with control options for the ui. |
|
timeCapture |
An object of the message time capture data |
|
plentyId |
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
Name | Type | Description |
---|---|---|
replyable |
Indicates whether or not is allowed to reply to this message stream (default true). |
|
attachable |
Indicates whether or not is allowed to attach files in a message (default true). |
|
linksDisabled |
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
Name | Type | Description |
---|---|---|
deactivated |
Deactivates the toggle button for the UI |
|
tooltips |
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
Name | Type | Description |
---|---|---|
chargeable |
||
minutes |
Methods
public toArray()
Returns this model as an array.
MessageMetaLink
The MessageMetaLink model of the messenger.
Namespace
Plenty\Modules\Messenger\Models
Name | Type | Description |
---|---|---|
image |
An optional image URL for the link |
|
caption |
The caption to be shown for the link |
|
url |
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 |
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 |
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
Name | Type | Description |
---|---|---|
type |
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 |
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
Name | Type | Description |
---|---|---|
user |
An array with user IDs of users receiving the message |
|
role |
An array with user role IDs of user roles receiving the message |
|
An array with emails receiving the message |
||
allUsers |
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.
Name |
Type |
Description |
|
The link type |
|
|
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.
Name |
Type |
Description |
|
The from type |
|
|
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.
Name |
Type |
Description |
|
The reference to be checked |
|
|
The value of the reference |
|
|
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.
Name |
Type |
Description |
|
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.
Name |
Type |
Description |
|
The UUID of the message |
public findOrFail($uuid):Plenty\Modules\Messenger\Models\Message
Return type: Message
Gets the message with the given UUID.
Name |
Type |
Description |
|
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.
Name |
Type |
Description |
|
The UUID of the message |
Lists the messages for the given navigation page.
Name |
Type |
Description |
|
The page of results to search for |
|
|
The number of items to list per page |
public getTotalEntries():int
Returns total entries
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.
Name |
Type |
Description |
|
The UUID of the message |
public toArray():array
public process($data):array
Name |
Type |
Description |
|
public getFilter():array
public getPostFilter():array
public getQuery():array
public getAggregations():array
public getSuggestions():array
public getSources():void
public addDependenciesToSource($sources):void
Name |
Type |
Description |
|
public getName():void
public setName($name):void
Name |
Type |
Description |
|
public setIsSourceDisabled($isSourceDisabled):void
Name |
Type |
Description |
|
public setTrackTotalHits($trackTotalHits):void
Name |
Type |
Description |
|
public addFilter($filter):Plenty\Modules\Cloud\ElasticSearch\Lib\Search\BaseSearch
Return type: BaseSearch
Name |
Type |
Description |
|
public addPostFilter($filter):Plenty\Modules\Cloud\ElasticSearch\Lib\Search\BaseSearch
Return type: BaseSearch
Name |
Type |
Description |
|
public addQuery($query):Plenty\Modules\Cloud\ElasticSearch\Lib\Search\BaseSearch
Return type: BaseSearch
Name |
Type |
Description |
|
public addSource($source):Plenty\Modules\Cloud\ElasticSearch\Lib\Search\BaseSearch
Return type: BaseSearch
Name |
Type |
Description |
|
public setSorting($sorting):Plenty\Modules\Cloud\ElasticSearch\Lib\Search\BaseSearch
Return type: BaseSearch
Name |
Type |
Description |
|
public addAggregation($aggregation):Plenty\Modules\Cloud\ElasticSearch\Lib\Search\BaseSearch
Return type: BaseSearch
Name |
Type |
Description |
|
public addSuggestion($suggestion):Plenty\Modules\Cloud\ElasticSearch\Lib\Search\BaseSearch
Return type: BaseSearch
Name |
Type |
Description |
|
public setPage($page, $rowsPerPage):Plenty\Modules\Cloud\ElasticSearch\Lib\Search\BaseSearch
Return type: BaseSearch
Name |
Type |
Description |
|
||
|
public setPagination($pagination):void
Name |
Type |
Description |
|
public setCollapse($collapse):void
Name |
Type |
Description |
|
public setScoreModifier($scoreModifier):Plenty\Modules\Cloud\ElasticSearch\Lib\Search\BaseSearch
Return type: BaseSearch
Name |
Type |
Description |
|
public setMaxResultWindow($maxResults = 10000):void
Name |
Type |
Description |
|
public setIndex($index):void
Name |
Type |
Description |
|
public isSearchAfter():void
public getFilterRaw():void
public getQueriesRaw():void
public getAggregationsRaw():array
public getSorting():void
public getScoreModifier():void