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.
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
entityconfigback with itsscriptId. entityconfigis 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_TOKENandContent-Type: application/json.
How the save works
entityconfigis validated against the script schema. Unknown keys are dropped.- The rooftop's existing script records are loaded and matched by website origin (scheme and host).
- 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. - Otherwise the script service is called. With
scriptIdit updates that script, falling back to create if the script is not found. WithoutscriptIdit creates a new script. - The returned
scriptIdandscriptUrlare stored. The matching record is updated, or a new one is inserted.
Request body
- Scope it: send
enterpriseId,teamId,domain: "publish"andentity: "SMARTVIEW". - Website: in
entityconfig, setwebsiteUrl,websiteProvider,active(1 or 0) andselectedTeamId(at least one rooftop). - Chatbot on: set
globalConfigs.chatbotConfigs.enabled: true, and make surevdpConfigs.ci_enabledis not alsotrue. - Update: include
scriptId.
| Parameter | Type | Required | Description |
|---|---|---|---|
enterpriseId | string | Required | Dealer group. |
teamId | string | Required | Rooftop. |
enterpriseName, teamName | string | Optional | Stored with the record and sent to the script service. |
domain | string | Required | publish. |
entity | string | Required | SMARTVIEW. |
entityconfig | object | Required | Script settings. Fields below. |
websiteUrl | string | Required | Dealer website. |
websiteProvider | string | Required | Website platform, for example dealeron. |
active | integer | Required | 1 or 0. |
selectedTeamId | string[] | Required | At least one rooftop id. |
scriptId | string | Required if | Required to update an existing script. |
scriptUrl | string | Optional | Existing script URL. |
vehicleIdentificationType | string | Optional | Default: VIN. |
version | string | Optional | Default: v2. |
globalConfigs.chatbotConfigs | object | Optional | Chatbot settings. Fields below. |
chatbotConfigs.enabled | boolean | Required if | Required if you send chatbotConfigs. |
chatbotConfigs.defaultDesktopPresentation, initialWidgetState, agentSwitchNotice | string | Optional | pinned or floating; dock or fab; pill or hidden. |
chatbotConfigs.salesPages, servicePages | object | Optional | mode (ALL_PAGES, ALL_PAGES_WITH_EXCEPTIONS or SPECIFIC_PAGES) plus pages[]. |
chatbotConfigs.isGAEnabled, isRooftopWebsite, headerButton, vinXPath[], stockXPath[], hideWhenVisibleXpath[] | mixed | Optional | Other chatbot settings, plus colors and paddings. |
chatbotConfigs.activityTracking | object | Optional | enabled, endpoint and captureValues, all required when sent. |
vdpConfigs | object | Optional | Vehicle details page widget settings. When sent, studio_enabled, ci_enabled, integration_type (BUTTON or PAGE_LOADER) and version are required. |
vlpConfigs | object | Optional | Vehicle listing page settings. When sent, studio_enabled is required. |
created_by, updated_by | string | Optional | Kept 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)
| Parameter | Type | Description |
|---|---|---|
success | boolean | true on 200 and 201. |
message | string | Integration configuration created successfully (201, for both create and update) or script already exists (200). |
data.entityconfig.scriptUrl | string | Script for the dealer to embed on the website. |
data.entityconfig.scriptId | string | Script id. Send it back to update. |
data.entityconfig | object | The stored script settings, with defaults filled in. |
data.enterpriseId, teamId, userId, domain, entity, type, createdAt, updatedAt | string | Record metadata. |
Errors
| Status | Reason | When it happens |
|---|---|---|
400 | Validation error | A 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. |
401 | Invalid Auth key | Missing or rejected token. |
401 | User ID not found in token | The token check returned no user id. |
500 | Failed to create integration configuration | The 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.
Updated about 1 hour ago
