Discussions

Ask a Question

Your OAuth2 token is incorrect or has expired ?

Hi, I am trying to retrieve staff via the REST API , using your website examples Despite haveing read_staff with a valid login the return I get is always "Your OAuth2 token is incorrect or has expired" ? Thanks in advance Gordon

Separating Name field into First and Last Name

Hello! I manage an active campaign account for a client who is using your software. I am having an issue integrating new clients from S8 to AC using Zapier. It seems as though S8 only takes the full name, and then that gets sent to Active Campaign. When this happens, it swaps the names so the first appears last and last appears first in Active Campaign. Very bad for remarketing, to have a last name where a first name should be! Is there a way to solve this in ServiceM8, to designate first and last name fields instead of Full Name?

Error Adding Webhook

After having reviewed https://developer.servicem8.com/docs/webhooks-overview I am on https://developer.servicem8.com/reference/get_webhook_subscriptions Neither page tells me what to pass in the body of the Post call. I am trying this : {"object":"job", "fields":"status", "callback_url":"https://hook.integromat.com/rxxxxxxx"} but getting error message : Please specify an object for subscription what do I need to change for this to work?

Issue uploading attachment via API

I'm writing setting up a simple add on which will take PDFs from Google Drive and attach them to a ServiceM8 Job, for simplicity I'm doing writing all the code via Google Apps Scripts. It was a lot of trial and error to get to the point I got, however I have now come to a point which I see a few others have gotten to (by looking through the discussion threads here) but none of them seem to show me a final response. I was able to get to get an Ok message, and after a lot of trialling I have been able to get the PDF document to actually show up on the Job Diary, however upon opening the file it is empty. I had no luck at all with images, they would not even show up on the Job Diary. Here is my code: function createAttachmentRecord() { const options = { 'method': 'POST', 'headers': { Accept: 'application/json', 'Content-Type': 'application/pdf', Authorization: 'Basic email/password' }, 'payload': JSON.stringify({ active: 1, attachment_name: 'test.pdf', file_type: '.pdf', related_object: 'job', related_object_uuid: '3e31d242-2f15-4dd5-8a87-1d837d817c5b' }) }; const url = 'https://api.servicem8.com/api_1.0/attachment.json'; var response = UrlFetchApp.fetch(url, options); Logger.log(response.getContentText()); var obj = response.getAllHeaders(); var newUUID = obj["x-record-uuid"]; getAttachement(newUUID); Logger.log("New UUID " + newUUID); } function getAttachement(newUUID){ var fileToAttach = DriveApp.getFileById('1Yle6cG5EZuk_EMFd7ZE3IIUq72bspxuo'); var type = fileToAttach.getBlob().getContentType(); var fileData = fileToAttach.getBlob().getBytes(); uploadAttachment(newUUID, fileData, type); } function uploadAttachment(newUUID, fileData){ const url = 'https://api.servicem8.com/api_1.0/Attachment/' + newUUID + '.file'; const options = { 'method': 'POST', 'headers': { Accept: 'application/json', 'Content-Type': 'application/pdf', Authorization: 'Basic email/password' }, 'payload': JSON.stringify({ file: fileData, active: 1 }) }; var response = UrlFetchApp.fetch(url, options); Logger.log(response.getContentText()); } Hopefully someone can identify where my mistake is, or guide me with an alternative way of converting the data to binary (which is where I think my problem might be). Any assistance on this front will be greatly appreciated.
ANSWERED

Error Packaging Simple Function Add-On

I am developing a simple function add-on that on save is validating successfully, but then gives me the message 'Error Packaging Function. Please try again or contact support for assistance'. I have a manifest uploaded and I've tried re-creating it a couple times now. I have other add-ons that I've made that are working fine, though. I tested re-saving on a couple. Any ideas?
ANSWERED

Swagger format for API

Is there a swagger format for the REST API? Or some postman collection? This would be very helpful for integrating servicem8 with microsoft flow or logic apps as a custom connector. Thanks a lot
ANSWERED

How to get the service for a job from the Rest API?

Hi ServiceM8, The app can see the Service selected for a job, when that Add on is used. So there must be a way to fetch that data via the API? I can't seem the see the value in the raw JSON returned for a job. Thanks
ANSWERED

Webhook POST Response

I am getting a response of 204 No Content. This is the Notification that is noted on the docs. But in my Ngrok which I use for getting responses, I am getting a 204 No Content POST /api/values HTTP/1.1 Host: localhost:50754 User-Agent: ServiceM8-Platform/1.0 Content-Length: 233 Accept: */* Content-Type: application/x-www-form-urlencoded X-Forwarded-For: 35.176.170.33 X-Original-Host: d9193544.ngrok.io {"object":"JOB","entry":[{"uuid":"d4798ca6-5022-4527-b4ac-b6c7e822490b","changed_fields":["status"],"time":"2018-09-26 10:46:39"}],"resource_url":"https:\/\/api.servicem8.com\/api_1.0\/JOB\/d4798ca6-5022-4527-b4ac-b6c7e822490b.json"} Am I in a right track?

Scheduling

Is there a way to create a client in the dispatch board eg. Real Estate client, then send the tenant a link to book in the job. similar to the new services ability, but the company creates the job and they can only select a time slot? That way you can receive the workorder, email the tenant with the job card already sorted with a link to the booking page and they can book their time in but can't mess up any of the client file.
ANSWERED

Adding tab to Dispatch Board

Is it possible to create an add-on that will add a new tab to the Dispatch Board? I would like to add a job list view here. The vertical listing of jobs on the right-hand side does not work for us.