Save a chatbot script

Create or update the website script that loads the receptionist chatbot and, optionally, the vehicle-page widgets. This is the save for the receptionist's "Chatbot Script" task.

POSThttps://api.spyne.ai/central-config/v1/integration
AuthBearer token (console user)Rate limitNot documentedProcessingSynchronous; waits for the script service and the database write

This is the general integration-config endpoint. For the chatbot script, send domain: "publish" and entity: "SMARTVIEW". Give the dealer data.entityconfig.scriptUrl from the response to embed on the website.

Auth: Bearer token of a signed-in user, checked with the identity service. The user id is taken from the token. Rate limit: not documented. Processing: synchronous. The call waits for the script service and the database write.

Before you call it

  • The rooftop needs a website URL.
  • Call List chatbot scripts first. To change an existing script, send its whole entityconfig back with its scriptId.
  • entityconfig is stored as sent, not merged. Send every setting you want to keep.
  • The chatbot (globalConfigs.chatbotConfigs.enabled) and Vini on vehicle pages (vdpConfigs.ci_enabled) cannot both be on.
  • Send Authorization: Bearer YOUR_TOKEN and Content-Type: application/json.

How the save works

  1. entityconfig is validated against the script schema. Unknown keys are dropped.
  2. The rooftop's existing script records are loaded and matched by website origin (scheme and host).
  3. If a record already exists for the same website and you sent no scriptId, the call returns that record with 200 and changes nothing, even if the settings differ.
  4. Otherwise the script service is called. With scriptId it updates that script, falling back to create if the script is not found. Without scriptId it creates a new script.
  5. The returned scriptId and scriptUrl are stored. The matching record is updated, or a new one is inserted.

Request body

Requiredalways sendOptionalcan be left outRequired ifrequired only in the case described
Request checklist
  1. Scope it: send enterpriseId, teamId, domain: "publish" and entity: "SMARTVIEW".
  2. Website: in entityconfig, set websiteUrl, websiteProvider, active (1 or 0) and selectedTeamId (at least one rooftop).
  3. Chatbot on: set globalConfigs.chatbotConfigs.enabled: true, and make sure vdpConfigs.ci_enabled is not also true.
  4. Update: include scriptId.
ParameterTypeRequiredDescription
enterpriseIdstringRequiredDealer group.
teamIdstringRequiredRooftop.
enterpriseName, teamNamestringOptionalStored with the record and sent to the script service.
domainstringRequiredpublish.
entitystringRequiredSMARTVIEW.
entityconfigobjectRequiredScript settings. Fields below.
websiteUrlstringRequiredDealer website.
websiteProviderstringRequiredWebsite platform, for example dealeron.
activeintegerRequired1 or 0.
selectedTeamIdstring[]RequiredAt least one rooftop id.
scriptIdstringRequired ifRequired to update an existing script.
scriptUrlstringOptionalExisting script URL.
vehicleIdentificationTypestringOptionalDefault: VIN.
versionstringOptionalDefault: v2.
globalConfigs.chatbotConfigsobjectOptionalChatbot settings. Fields below.
chatbotConfigs.enabledbooleanRequired ifRequired if you send chatbotConfigs.
chatbotConfigs.defaultDesktopPresentation, initialWidgetState, agentSwitchNoticestringOptionalpinned or floating; dock or fab; pill or hidden.
chatbotConfigs.salesPages, servicePagesobjectOptionalmode (ALL_PAGES, ALL_PAGES_WITH_EXCEPTIONS or SPECIFIC_PAGES) plus pages[].
chatbotConfigs.isGAEnabled, isRooftopWebsite, headerButton, vinXPath[], stockXPath[], hideWhenVisibleXpath[]mixedOptionalOther chatbot settings, plus colors and paddings.
chatbotConfigs.activityTrackingobjectOptionalenabled, endpoint and captureValues, all required when sent.
vdpConfigsobjectOptionalVehicle details page widget settings. When sent, studio_enabled, ci_enabled, integration_type (BUTTON or PAGE_LOADER) and version are required.
vlpConfigsobjectOptionalVehicle listing page settings. When sent, studio_enabled is required.
created_by, updated_bystringOptionalKept from an earlier save.

Sample request

curl -X POST "https://api.spyne.ai/central-config/v1/integration" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "enterpriseId": "<enterpriseId>",
    "teamId": "<teamId>",
    "enterpriseName": "Example Motors Group",
    "teamName": "Example Motors",
    "domain": "publish",
    "entity": "SMARTVIEW",
    "entityconfig": {
      "active": 1,
      "websiteUrl": "https://www.examplemotors.example",
      "websiteProvider": "dealeron",
      "selectedTeamId": ["<teamId>"],
      "globalConfigs": {
        "chatbotConfigs": {
          "enabled": true,
          "defaultDesktopPresentation": "floating",
          "initialWidgetState": "fab",
          "salesPages": { "mode": "ALL_PAGES", "pages": [] },
          "servicePages": { "mode": "SPECIFIC_PAGES", "pages": [] }
        }
      }
    }
  }'
import requests

body = {
    "enterpriseId": "<enterpriseId>",
    "teamId": "<teamId>",
    "domain": "publish",
    "entity": "SMARTVIEW",
    "entityconfig": {
        "active": 1,
        "websiteUrl": "https://www.examplemotors.example",
        "websiteProvider": "dealeron",
        "selectedTeamId": ["<teamId>"],
        "globalConfigs": {"chatbotConfigs": {"enabled": True}},
    },
}
res = requests.post(
    "https://api.spyne.ai/central-config/v1/integration",
    headers={"Authorization": "Bearer YOUR_TOKEN"},
    json=body,
)
print(res.status_code, res.json())
const res = await fetch('https://api.spyne.ai/central-config/v1/integration', {
  method: 'POST',
  headers: { Authorization: 'Bearer YOUR_TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({
    enterpriseId: '<enterpriseId>',
    teamId: '<teamId>',
    domain: 'publish',
    entity: 'SMARTVIEW',
    entityconfig: {
      active: 1,
      websiteUrl: 'https://www.examplemotors.example',
      websiteProvider: 'dealeron',
      selectedTeamId: ['<teamId>'],
      globalConfigs: { chatbotConfigs: { enabled: true } },
    },
  }),
});
console.log(res.status, await res.json());

Sample response

{
  "success": true,
  "message": "Integration configuration created successfully",
  "data": {
    "_id": "<id>",
    "enterpriseId": "<enterpriseId>",
    "teamId": "<teamId>",
    "userId": "<userId>",
    "domain": "publish",
    "entity": "SMARTVIEW",
    "type": "single",
    "entityconfig": {
      "scriptId": "<scriptId>",
      "scriptUrl": "https://example.com/script.js",
      "websiteUrl": "https://www.examplemotors.example",
      "websiteProvider": "dealeron",
      "vehicleIdentificationType": "VIN",
      "active": 1,
      "selectedTeamId": ["<teamId>"],
      "globalConfigs": { "chatbotConfigs": { "enabled": true, "isGAEnabled": false, "isRooftopWebsite": true } },
      "version": "v2"
    },
    "createdAt": "2026-10-12T00:00:00.000Z",
    "updatedAt": "2026-10-12T00:00:00.000Z"
  }
}
{
  "success": true,
  "message": "script already exists",
  "data": { "enterpriseId": "<enterpriseId>", "teamId": "<teamId>", "domain": "publish", "entity": "SMARTVIEW", "entityconfig": { "scriptId": "<scriptId>", "scriptUrl": "https://example.com/script.js" } }
}
{
  "success": false,
  "message": "Validation error",
  "error": "Invalid request data",
  "errors": [
    { "code": "custom", "path": ["entityconfig", "globalConfigs", "chatbotConfigs", "enabled"], "message": "vdpConfigs.ci_enabled (Vini) and globalConfigs.chatbotConfigs.enabled (Chatbot) cannot both be true at the same time" }
  ]
}
{ "status": "401", "message": "Invalid Auth key" }
{ "success": false, "message": "Failed to create integration configuration", "error": "<message from the script service or database>" }

Response parameters (201, 200)

ParameterTypeDescription
successbooleantrue on 200 and 201.
messagestringIntegration configuration created successfully (201, for both create and update) or script already exists (200).
data.entityconfig.scriptUrlstringScript for the dealer to embed on the website.
data.entityconfig.scriptIdstringScript id. Send it back to update.
data.entityconfigobjectThe stored script settings, with defaults filled in.
data.enterpriseId, teamId, userId, domain, entity, type, createdAt, updatedAtstringRecord metadata.

Errors

StatusReasonWhen it happens
400Validation errorA required field is missing, domain and entity are not an allowed pair, selectedTeamId is empty, or both the chatbot and vdpConfigs.ci_enabled are on.
401Invalid Auth keyMissing or rejected token.
401User ID not found in tokenThe token check returned no user id.
500Failed to create integration configurationThe script service call failed, or the database write failed.

A save for a website that already has a script, sent without scriptId, returns 200 and changes nothing. To change it, resend with that script's scriptId.

What happens next

Give the dealer data.entityconfig.scriptUrl to embed on the website. No checklist call is made. The "Chatbot Script" task shows as done when List chatbot scripts returns a chatbot-enabled script with a scriptUrl for the rooftop's website.


Did this page help you?