Ask a Question

Job/Job Activity APIs stopped working

Hi, SM8 is returning the Internal Error on our Job/Job Activity API calls ("<https://api.servicem8.com/api_1.0/job.json?%24filter=active%20eq%20'1'">). There is not much data (no more than 1,000 records). Everything was working till Saturday morning (i.e. 2/12/2023). Is there a problem with your Server? Thanks, Andriy

API - Create a new Job

I am using JavaScript to create a new job via the API. The documentation states that "a UUID will be automatically generated for the new record and returned in the response header as x-record-uuid". When I examine the response headers the only keys that are available are: cache-control content-length content-type expires Can anyone please shed light on where I can find the UUID? Thanks

GA4 Tracking

Hi, Just wondering if anyone has been able to get GA4 tracking to work with ServiceM8 website form. Thanks

Add online bookings addon to the API to trigger on new form filled

Would you be able to add online bookings addon to your api-so it triggers when an enquiry/booking is made?

403 error when trying to retrieve attachments (Oauth2)

I am getting a 403 error (Insufficient Scope) whenever I try to retrieve attachments via an Oauth2 connection. The error message says "\"read_attachments\" scope required to complete this request" But I have included the read_attachments scope in my Oauth2 connection. I have tried adding "manage_attachments" "read_job_attachments" and "publish_attachments" to the scope, but I'm getting a 403 error whenever I send a request. I can access and use the attachments endpoint using basic authorisation, but need to use multiple Oauth2 endpoints in the workflow that I am using, so don't know what else to try here. ![](<>) ![](<>) ![](<>)


Hi. Podium has shown how the SM8 sms system is a little poor from the customers side and demonstrated these issues against how their 2way sms system works. We are using it now due to this and the stripe fees being 1/2 of what it costs through SM8. I am not sure why Podium is not an add on and ask if that is something that will happen or perhaps you do not allow them due to a conflict of interest regarding stripe and sms income impacting SM8 income by their engagement? Please advise, as i hope to take advantage of their system whilst getting a seamless integration to SM8 such as they do with some other systems. Kind regards, Brett

Issue with access_token and refresh_token inside servicem8

This is my code to get the access token and refresh token. The webhook I created was working fine around 3 days ago but suddenly stopped when the access token expired. It wasn't able to fetch the refresh token. Can some help me figure out what I am doing wrong. Has somebody faced similar issue when doing an integration. The token.json file holds the information about the access token, refresh_token. Is it a code issue or is it an issue with the Servicem8. Note: The token expires after 3600second. The webhook seems fine I believe. if(!empty($\_REQUEST['code'])){ $token = get_token($\_REQUEST['code']); }else{ $token = get_access_token(); } define("TOKEN",$token); function get_access_token(){ if(file_exists(**DIR**."/token.json")){ $fp = fopen(**DIR**."/token.json", "r"); $dt = fread($fp,filesize(**DIR**."/token.json")); $token_data = json_decode($dt); $expires_in = $token_data->expires_in; $datetime1 = new DateTime($token_data->current_date); $datetime2 = new DateTime(date("Y-m-d H:i:s")); $diff = $datetime1->diff($datetime2); $secs = ((($diff->format("%a") _ 24) + $diff->format("%H")) \_ 60 + $diff->format("%i")) \* 60 + $diff->format("%s"); if($secs > $expires_in){ return refresh_token($token_data->refresh_token); }else{ return $token_data->access_token; } }else{ return authenticate(); } } function refresh_token($refresh_token){ $vars = array( 'client_id' => CLIENT_ID, 'client_secret' => CLIENT_SECRET, 'redirect_uri' => REDIRECT_URL, 'refresh_token' => $refresh_token, 'grant_type' => 'refresh_token' ); $url = "<https://go.servicem8.com/oauth/access_token">; $c = curl_init($url); curl_setopt($c, CURLOPT_POST, true); curl_setopt($c, CURLOPT_POSTFIELDS, http_build_query($vars)); curl_setopt($c, CURLOPT_RETURNTRANSFER, true); $response = json_decode(curl_exec($c)); curl_close($c); $response->current_date = date("Y-m-d H:i:s"); $fp = fopen(**DIR**."/token.json", "w"); fwrite($fp, json_encode($response)); fclose($fp); return $access_token = $response->access_token; } function authenticate(){ $url_code = "<https://go.servicem8.com/oauth/authorize?">; $vars = array( 'response_type' => 'code', 'scope' => 'read_jobs read_job_contacts read_job_materials read_job_notes read_customers read_customer_contacts read_job_categories read_staff manage_badges', 'client_id' => CLIENT_ID, 'redirect_uri' => REDIRECT_URL ); $url = $url_code . http_build_query($vars); header("Location: $url"); } function get_token($code){ $url_code = "<https://go.servicem8.com/oauth/access_token">; $vars = array( 'grant_type' => 'authorization_code', 'client_id' => CLIENT_ID, 'client_secret' => CLIENT_SECRET, 'code' => $code, 'redirect_uri' => REDIRECT_URL, ); $json = json_encode($vars); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url_code); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json")); $response = curl_exec($ch); curl_close($ch); $response = json_decode($response); $response->current_date = date("Y-m-d H:i:s"); $fp = fopen(**DIR**."/token.json", "w"); fwrite($fp, json_encode($response)); fclose($fp); return $access_token = $response->access_token; }

My custom webhook stopped working

My custom webhook worked fine 2,3 days ago but suddenly stopped working. I have checked online for solution but can't find one.

ServiceM8 Phone

Has anyone used the ServiceM8 phone and have some feedback for it? We are looking at implementing it for our company but haven't found anyone that used it

Service m8 forms populated with wordpress form information

is there a way of us using standard contact forms on our wordpress sites and using servicem8 API system can the forms within service m8 be automatically be populated with the information from a wordpress contact form