Dealer SMS API Documentation

Introduction

The Dealer SMS API enables your application to send a SMS/MMS message to a consumer mobile number on behalf of an authorized dealer.

Here are the basic steps for using the API:

  • Make a POST to the https://www.cargurus.com/Cars/api/1.0/dealerSMS.action URL specifying the parameters described below
  • Retrieve and process the response which will be a JSON string representing the DealerSMSResponse object also described below.

HTTP Request

URL https://www.cargurus.com/Cars/api/1.0/dealerSMSRequest.action
Method POST
Parameters
Name Description Object Type
appId The application id - provided by CarGurus String
authToken The authentication token - provided by CarGurus String
body JSON representation of the DealerSMSRequest object described below DealerSMSRequest object

DealerSMSRequest Fields

Name Description Object Type
dealer_id The CarGurus dealer id. Find this id in the dealer's URL on cargurus.com.
For example: https://www.cargurus.com/Cars/m-Quirk-Volkswagen-sp61504
So Quirk Volkswagen's CarGurus dealer_id is sp61504
Either dealer_id or from may be provided, but dealer_id is preferred
String
from The dealer's phone number. Format with a '+' and country code e.g., +16175551212 (E.164 format).
Either dealer_id or from may be provided, but dealer_id is preferred
String
to The consumer's phone number. Format with a '+' and country code e.g., +16175551212 (E.164 format). String
body The text of the message you want to send, limited to 1600 characters. You must provide either a body or at least one Media URL. String
media_urls The URLs of the media you wish to send out with the message. gif, png and jpeg content is currently supported and will be formatted correctly on the recipient's device.
Other types are also accepted by the API as specified by our current SMS provider Twilio. The media size limit is 5MB. You may include up to 10 Media URLs per message. You must provide either a body or at least one Media URL.
Array of String

HTTP Response

The API returns a JSON formatted string representing an DealerSMSResponse object described below.

DealerSMSResponse Fields

Name Description Object Type
success Whether the request was processed successfully. This flag describes the overall status of the request. If success is false, then the error object described below will contain the appropriate error code and description. boolean (true/false)
error An ApiError object containing a specific error code and description ApiError object
sid The unique id for this message if successful. String

ApiError Fields

Name Description Object Type
error_code The error code integer
description The error's description string

Error Codes

Top Level Response Error Codes

  • 100 - bad or malformed request
  • 101 - missing or invalid authentication credentials
  • 102 - invalid application id
  • 103 - I/O error
  • 105 - unexpected error
  • 108 - invalid dealer
  • 110 - missing/invalid 'to' phone number
  • 111 - missing/invalid sms content (body/media_urls)
  • 112 - invalid 'from' phone number
  • 113 - blocked 'to' phone number (user replied w/STOP)

Examples

Example 1 - (Valid Request)

HTTP Request's 'body' parameter:

      {
          "dealer_id" : "sp284739",
          "to" : "+15551234567",
          "body" : "Check out these sweet rims!",
          "media_urls" : ["https://i.imgur.com/7zhYvkC.jpg", "https://i.imgur.com/E30aDqi.jpg"]
      }

HTTP Response

      {
           "sid": "MM00018b64c0eb44699cbc08e7d7b5641e",
           "success": true
      }

Example 2 - (Missing or invalid authToken)

HTTP Response

      {
          "success": false
          "error": {
              "description": "Invalid auth credentials.  Details: Invalid auth token",
              "error_code": 101
          },
      }