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

objecttype

string

The type of the object for which to retrieve threads. Either “customer” or “todo” or “tool”

objectid

number

The id of the object for which to retrieve threads.

exclmessages

bool

Set to 1 to exclude the messages

Output

threads

collection[ thread ]

The threads

GetThreadByID

Get a thread.

Input

threadid

number

The MB ID of the thread

exclmessages

bool

Set to 1 to exclude the messages

messagedate

date

Only get messages from this date or newer

Output

thread

thread

The thread

GetThreadsByLastChange

Get all threads that have changed.

Input

changedate

date

changetime

time

resumekey

string

If a partial result is returned, provide the resumekey received along with the partial result, to get the rest of the entries

exclmessages

bool

If 1 then the messages are not included

ignoreclosed

bool

If 1 then don't sent threads that current user do not have access to

onlysubscriber

bool

If 1 then only get threads the current user is subscriber

skip_deleted

bool

If 1 then don't send deleted threads

Output

threads

collection[ thread ]

The threads

numunreadmessages

number

The number of unread messages in all threads

unreadmessages

set

Number of unread messages for each object type and object, see below

resumekey

string

Sometimes 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 titleobjecttype 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

message

tmessage

The message

title

string

The title of the new thread

tag

string

A tag for the new thread

objecttype

string

The type of the object for which to create the new thread

objectid

number

The MB ID of the object for which to create the new thread

ispublic

boolean

If the thread should be shown on the extranet and elsewhere

nextcheckin

boolean

If the messsage should be sent to the next who checks in

internalsubscribers

collection[number]

MB IDs of the users who should be set as subscribers when creating a thread

externalsubscribers

collection[number]

MB IDs of the persons who should be set as subscribers when creating a thread

notification

string

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

"Works only with tasks"

Output

message

tmessage

thread

thread

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.

PostMessageToUserID

Create or update a message, possible create a new thread, to a specific userid.

If the tmessage object has the field threadid set to 0 then a new thread is created, in which case the titleobjecttype 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

message

tmessage

The message

title

string

The title of the new thread

tag

string

A tag for the new thread

objecttype

string

The type of the object for which to create the new thread

objectid

number

The MB ID of the object for which to create the new thread

userid

number

The user ID for the one receiving the notification.

ispublic

boolean

If the thread should be shown on the extranet and elsewhere

nextcheckin

boolean

If the messsage should be sent to the next who checks in

internalsubscribers

collection[number]

MB IDs of the users who should be set as subscribers when creating a thread

externalsubscribers

collection[number]

MB IDs of the persons who should be set as subscribers when creating a thread

notification

string

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

"Works only with tasks"

Output

message

tmessage

thread

thread

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.