Skip to content

Message Threads

Messages are sent from worker to dispatcher and vice versa. Messages are contained within a message thread.

You can add or delete messages threads using this API.

If you add a Job ID, we will automatically send it to the workers for that job, you do not need to specify the worker ID.

Here are the fields you can use when making a message request:

NameTypeDescription
job_idIntegerAn optional job ID that the message thread relates to.
job_third_party_idStringAn optional job Third Party ID that the message thread relates to.
user_idsStringComma-separated list of ids of users you want to the message to be available to.
subjectStringThe subject for the thread.
messagesArrayAn array of messages to add to the thread.
message.from_user_idIntegerUser ID for initial thread message. (Optional)
message.from_user_nameStringUser name of message creator. Only used (and required) if from_user_id is blank.
message.bodyStringThe body for the inital thread message.

When retrieving a message from vWork, you may also see these additional fields in the response:

NameTypeDescription
idIntegerUnique ID of thread.
summaryBooleanSummary of latest thread contents (Used internally and set automatically.)
last_reply_user_idBooleanUser ID of last reply.
last_reply_atBooleanTime thread was last replied to.
created_atDateTimeTime thread was created.
updated_atDateTimeTime thread was last updated.
messagesArrayAn array of all messages in the thread.
created_by_user_idBooleanUser ID of thread creator.
message.idStringUnique Message ID.
message.read_by_user_idsStringComma-separated list of IDs of users that have read the message.
message.received_by_user_idsStringComma-separated list of IDs of users that have received this message on their mobile devices.
message.created_atDateTimeTime message was created.
message.updated_atDateTimeTime message was last updated.

Create A New Message Thread

Request

Creates a new message thread (including an initial message) in vWork.

Security
apiKey
Query
api_keystringrequired
Headers
Accept-Encodingstringrequired

Must be gzip. The vWork API requires HTTP compression on all requests; requests without it may be rejected with 406 Not Acceptable (see Tech Notes → HTTP Compression).

Value:"gzip"
Example:gzip
Bodyapplication/xml; charset=utf-8
string

Raw XML payload — see the example.

POST
/v5/messaging.xml
curl -i -X POST \
  'https://api.vworkapp.com/v5/messaging.xml?api_key=string&api_key=YOUR_API_KEY_HERE' \
  -H 'Accept-Encoding: gzip' \
  -H 'Content-Type: application/xml; charset=utf-8' \
  -d '<?xml version="1.0" encoding="utf-8"?>
  <thread>
      <job_id/>
      <user_ids>123</user_ids>
      <subject>Sample Thread</subject>
      <messages type="array">
          <message>
              <from_user_id/>
              <from_user_name>Joe Bloggs</from_user_name>
              <body>Sample Message</body>
          </message>
      </messages>
  </thread>'

Responses

Created

Headers
Cache-Controlstring
Example:"max-age=0, private, must-revalidate"
Content-Security-Policystring
Example:"frame-ancestors *.vworkapp.com *.vwork.io *.visfleet.com *.salesforce.com *.zoho.com, default-src: google.com google-analytics.com googleapis.com gst
Datestring
Example:"Tue, 14 Jun 2016 01:39:45 GMT"
ETagstring
Example:"W/\"7b93b83bd74711eb7c647fa765ff6c31\""
Locationstring
Example:"https://api.vworkapp.com/api/v4/messaging/ded86e04-31d0-11e6-927a-37a1480f7e3a.xml"
Statusstring
Example:"201 Created"
Strict-Transport-Securitystring
Example:"max-age=31536000"
Transfer-Encodingstring
Example:"chunked"
X-Content-Type-Optionsstring
Example:"nosniff"
X-Frame-Optionsstring
Example:"SAMEORIGIN"
X-Request-Idstring
Example:"dd33e07d-7734-40a6-ae2c-bfb7da9dc884"
X-Runtimestring
Example:"1.087328"
X-Unique-IDstring
Example:"CA7C7B8A:D1C2_0A001312:01BB_575F605A_76FF74:1E66"
X-XSS-Protectionstring
Example:"1; mode=block"
Bodyapplication/xml; charset=utf-8
string

Raw XML payload — see the example.

Response
<?xml version="1.0" encoding="utf-8"?>
<thread>
    <id>ded86e04-31d0-11e6-927a-37a1480f7e3a</id>
    <job_id/>
    <user_ids>123</user_ids>
    <all_workers>false</all_workers>
    <created_by_user_id/>
    <subject>Sample Thread</subject>
    <summary>Sample Message</summary>
    <last_reply_user_id/>
    <last_reply_at>2016-06-14T01:39:44Z</last_reply_at>
    <created_at>2016-06-14T01:39:44Z</created_at>
    <updated_at>2016-06-14T01:39:45Z</updated_at>
    <messages type="array">
        <message>
            <id>23275dfc-086d-11e4-a5ac-174e8ef2ef84</id>
            <thread_id>23268152-086d-11e4-a5ac-174e8ef2ef84</thread_id>
            <from_user_id/>
            <from_user_name>Joe Bloggs</from_user_name>
            <read_by_user_ids/>
            <received_by_user_ids/>
            <body>Sample Message</body>
            <created_at>2014-07-10 20:02:36 UTC</created_at>
            <updated_at>2014-07-11 08:02:36 +1200</updated_at>
        </message>
    </messages>
</thread>