Skip to main content

Visit Later

N/a

General Notes

  • Conditionally deletes the associated conversation if conversationId is set on the widget
  • Repositions remaining widgets in the canvas to fill the gap (decrements position by 1 for all sibling widgets with position > deletedWidget.position)
  • All DB operations (widget deletion, conversation deletion, repositioning) are wrapped in a MongoDB transaction for atomicity
  • SUPER_ADMIN can delete any widget (bypasses userId ownership check); regular users can only delete their own widgets

Flow

Mermaid editor

Test cases

Method & URL

DELETE v1/widgets/:widgetId

Request

Headers

authorization
- Required
- Type : <string>
- Bearer session token

Query


Body


Path parameter

widgetId
- Required
- Type : <string>
- MongoDB ObjectId (24 hex characters)

Response

2xx

success
- Type : true (boolean)
- This indicates that request was executed successfully

message
- Type : <string> | null
- null on success

data
- Type : <object>
- Empty object

400

success
- Type : false (boolean)

message
- Type : <string>
- "Something went wrong. We're on it." (invalid widgetId format)

404

success
- Type : false (boolean)

message
- Type : <string>
- Widget not found