Skip to main content
Skip table of contents

Threads and new messages commands

The threads and messages are for annotating tasks and equipment etc.

GetThreads

Get all threads+messages belonging to the specified object

Input

objecttypestringThe type of the object for which to retrieve threads. Either “customer” or “todo” or “tool”
objectidnumberThe id of the object for which to retrieve threads.
exclmessagesboolSet to 1 to exclude the messages

Output

threadscollection[ thread ]The threads

GetThreadByID

Get a thread.

Input

threadidnumberThe MB ID of the thread
exclmessagesboolSet to 1 to exclude the messages
messagedatedateOnly get messages from this date or newer

Output

threadthreadThe thread

GetThreadsByLastChange

Get all threads that have changed.

Input

changedatedate
changetimetime
resumekeystringIf a partial result is returned, provide the resumekey received along with the partial result, to get the rest of the entries
exclmessagesboolIf 1 then the messages are not included
ignoreclosedboolIf 1 then don't sent threads that current user do not have access to
onlysubscriberboolIf 1 then only get threads the current user is subscriber
skip_deletedboolIf 1 then don't send deleted threads

Output

threadscollection[ thread ]The threads
numunreadmessagesnumberThe number of unread messages in all threads
unreadmessagessetNumber of unread messages for each object type and object, see below
resumekeystringSometimes the entire result cannot be returned because it's to large. In that case a resumekey is returned along with the results. Execute the command again with this resumekey to get the remaining results.

The unreadmessages field holds a structure like this:

{"todo":{"271":3,"437":2},"tools":{"135":6}}

meaning that the todo object with ID 271 has 3 unread messages, the todo object with ID 437 has 2 unread messages, and the tool object with ID 135 has 6 unread messages.

PostMessage

Create or update a message, possible create a new thread.

If the tmessage object has the field threadid set to 0 then a new thread is created, in which case the title, objecttype and objectid fields are required.

If the tmessage object has the field id set to 0 then a new message is created, otherwise the message is update.

Input

messagetmessageThe message
titlestringThe title of the new thread
tagstringA tag for the new thread
objecttypestringThe type of the object for which to create the new thread
objectidnumberThe MB ID of the object for which to create the new thread
ispublicbooleanIf the thread should be shown on the extranet and elsewhere
nextcheckinbooleanIf the messsage should be sent to the next who checks in
internalsubscriberscollection[number]MB IDs of the users who should be set as subscribers when creating a thread
externalsubscriberscollection[number]MB IDs of the persons who should be set as subscribers when creating a thread
notificationstring

The message which should be given as notification to the responsible people of the task.

"Works only with tasks"

Output

messagetmessage
threadthread

objecttype can be 'todo' or 'customer' or 'tools'.

The fields ispublic and nextcheckin are only used when creating a thread, ie. when threadid is 0.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.