> ## Documentation Index
> Fetch the complete documentation index at: https://help.commbox.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Child Object

> This API creates a message (child) within a conversation (object). The message can be sent either on behalf of an agent (to the customer) or on behalf of a customer (displayed to the agent).<br> The API response returns the ID of the newly created child.<br><br><br><h4>Path Parameters</h4><br>•	**STREAM_ID** – Encrypted Stream ID representing the channel<br> •	**OBJECT_ID** – ID of the conversation <br><br><h4>Request Body</h4><br>**Message on Behalf of the Customer**<br> a) 	"Type": 4, - Enter 4 as default child type (conversation)- see Enum at https://help.commbox.io/apidocs/enums#objectchildtype  <br> b) "UserStreamProviderId" – Enter the email or phone number of the person you are sending the message on their behalf.<br> c) "UserStreamProviderType" – Enter 4 for email or 5 for a phone number (See Enum at https://help.commbox.io/apidocs/enums#streamprovidertype ) <br> d)	"Message" – Enter the message   <br><br>**Message on Behalf of the Agent**<br> a) 	"Type": 4, - Enter 4 as default child type (conversation)- see Enum at https://help.commbox.io/apidocs/enums#objectchildtype <br> b)	"IsManager": true, - Add this Boolean field for the agent  <br> c) 	 "UserIdentity": 123456, - Enter the agent’s user ID in the specific brand.  You can get the agent's User ID by using the Get Managers API  https://api.commbox.io/managers <br> d) "UserStreamProviderId" – Enter the email or phone number of the agent. <br> e) "UserStreamProviderType" – Enter 4 for email or 5 for a phone number (See Enum at https://help.commbox.io/apidocs/enums#streamprovidertype ) <br> f) 	"Message" – Enter the message  <br><br>**Note:** After 24 hours from last sent message, APIs messages sent to customers will be blocked by WhatsApp.<br><br><br>**Attachments in Chat Conversations**<br>You can attach files to chat conversations using `multipart/form-data`.<br>The "Type" field defines the kind of object attached to the message.<br>For example:<br>•	1 – Link <br>•	2 – Image <br>•	4 – File (when no message is included)<br>(See the full enum list: https://help.commbox.io/apidocs/enums#objectchildtype) <br><br>**Notes:**<br>1.	Leave the file parameter key empty, set the type to `File`, and upload the file directly from your device. <br>2.	Enter `data` (file type `Text`) and for the value, copy the raw form, ensuring there are no extra parentheses.<br>3.	Base64 file upload alternative option: ` filename:{name};base64:{data}`

## OpenAPI

````json POST /streams/{STREAM_ID}/objects/{OBJECT_ID}/child
{
  "openapi": "3.0.3",
  "info": {
    "title": "CommBox API",
    "x-logo": {
      "url": "https://www.commbox.io/logo/commbox_logo_large.png"
    },
    "version": "2.07",
    "termsOfService": "https://www.commbox.io/end-user-license-agreement-eula/",
    "contact": {
      "name": "commbox",
      "url": "https://www.commbox.io",
      "email": "contactus@commbox.io"
    }
  },
  "servers": [
    {
      "url": "https://api.commbox.io/",
      "description": "Production server"
    }
  ],
  "paths": {
    "/streams/{STREAM_ID}/objects/{OBJECT_ID}/child": {
      "post": {
        "tags": [
          "Objects"
        ],
        "summary": "Create Child Object",
        "description": "This API creates a message (child) within a conversation (object). The message can be sent either on behalf of an agent (to the customer) or on behalf of a customer (displayed to the agent).<br> The API response returns the ID of the newly created child.<br><br><br><h4>Path Parameters</h4><br>•\t**STREAM_ID** – Encrypted Stream ID representing the channel<br> •\t**OBJECT_ID** – ID of the conversation <br><br><h4>Request Body</h4><br>**Message on Behalf of the Customer**<br> a) \t\"Type\": 4, - Enter 4 as default child type (conversation)- see Enum at https://help.commbox.io/apidocs/enums#objectchildtype  <br> b) \"UserStreamProviderId\" – Enter the email or phone number of the person you are sending the message on their behalf.<br> c) \"UserStreamProviderType\" – Enter 4 for email or 5 for a phone number (See Enum at https://help.commbox.io/apidocs/enums#streamprovidertype ) <br> d)\t\"Message\" – Enter the message   <br><br>**Message on Behalf of the Agent**<br> a) \t\"Type\": 4, - Enter 4 as default child type (conversation)- see Enum at https://help.commbox.io/apidocs/enums#objectchildtype <br> b)\t\"IsManager\": true, - Add this Boolean field for the agent  <br> c) \t \"UserIdentity\": 123456, - Enter the agent’s user ID in the specific brand.  You can get the agent's User ID by using the Get Managers API  https://api.commbox.io/managers <br> d) \"UserStreamProviderId\" – Enter the email or phone number of the agent. <br> e) \"UserStreamProviderType\" – Enter 4 for email or 5 for a phone number (See Enum at https://help.commbox.io/apidocs/enums#streamprovidertype ) <br> f) \t\"Message\" – Enter the message  <br><br>**Note:** After 24 hours from last sent message, APIs messages sent to customers will be blocked by WhatsApp.<br><br><br>**Attachments in Chat Conversations**<br>You can attach files to chat conversations using `multipart/form-data`.<br>The \"Type\" field defines the kind of object attached to the message.<br>For example:<br>•\t1 – Link <br>•\t2 – Image <br>•\t4 – File (when no message is included)<br>(See the full enum list: https://help.commbox.io/apidocs/enums#objectchildtype) <br><br>**Notes:**<br>1.\tLeave the file parameter key empty, set the type to `File`, and upload the file directly from your device. <br>2.\tEnter `data` (file type `Text`) and for the value, copy the raw form, ensuring there are no extra parentheses.<br>3.\tBase64 file upload alternative option: ` filename:{name};base64:{data}`",
        "operationId": "Create_Child_Object",
        "parameters": [
          {
            "name": "STREAM_ID",
            "in": "path",
            "description": "The unique identifier for the channel",
            "required": true,
            "schema": {
              "$ref": "#/components/parameters/STREAM_ID/schema"
            }
          },
          {
            "name": "OBJECT_ID",
            "in": "path",
            "description": "The unique identifier for the conversation",
            "required": true,
            "schema": {
              "$ref": "#/components/parameters/OBJECT_ID/schema"
            }
          }
        ],
        "requestBody": {
          "description": "Payload containing child object information",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Object_Child"
              },
              "examples": {
                "On behalf of Agent - Sending an email": {
                  "value": {
                    "data": {
                      "IsManager": true,
                      "UserIdentity": 36574658,
                      "Type": 4,
                      "UserStreamProviderId": "best.agent@commbox.com",
                      "UserStreamProviderType": 4,
                      "Message": "A new message on behalf of the agent"
                    }
                  }
                },
                "On behalf of Agent - Sending a WhatsApp message": {
                  "value": {
                    "data": {
                      "IsManager": true,
                      "UserIdentity": 36574658,
                      "Type": 4,
                      "UserStreamProviderId": "972542660000",
                      "UserStreamProviderType": 7,
                      "Message": "A new message on behalf of the agent"
                    }
                  }
                },
                "On behalf of Customer": {
                  "value": {
                    "data": {
                      "Type": 4,
                      "UserStreamProviderId": "MrDoe@gmail.com",
                      "UserStreamProviderType": 4,
                      "Message": "A message on behalf of Mr. John Doe"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": 200
                    },
                    "description": {
                      "type": "string",
                      "example": "OK"
                    },
                    "response_time": {
                      "type": "string",
                      "example": "2024-08-06T07:51:52.2581942Z"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer",
                          "example": 294159
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request could not be understood by the server. Incoming parameters might not be valid",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "example": 400
                    },
                    "description": {
                      "type": "string",
                      "example": "Bad Request"
                    },
                    "response_time": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - The supplied credentials, if any, are not sufficient to access the resource",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "example": 401
                    },
                    "description": {
                      "type": "string",
                      "example": "Unauthorized access"
                    },
                    "response_time": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource is not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "example": 404
                    },
                    "description": {
                      "type": "string",
                      "example": "Not found"
                    },
                    "response_time": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests - Too many requests have been made in a short period of time (Throttling)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "example": 429
                    },
                    "description": {
                      "type": "string",
                      "example": "Too Many Requests"
                    },
                    "response_time": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - The server could not return the representation due to an internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "example": 500
                    },
                    "description": {
                      "type": "string",
                      "example": "Operation failed"
                    },
                    "response_time": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                },
                "example": {
                  "status": 500,
                  "description": "Operation failed",
                  "response_time": "2025-04-15T07:24:52.956691Z"
                }
              }
            }
          },
          "501": {
            "description": "Not Implemented - The requested operation is not supported"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Object_Child": {
        "type": "object",
        "properties": {
          "type": {
            "type": "integer",
            "format": "int64",
            "description": "The type of the object of the child. See Enum"
          },
          "IsManager": {
            "type": "boolean",
            "description": "Indicates whether the message is from the agent or admin (true) or from a customer (false)"
          },
          "UserIdentity": {
            "type": "integer",
            "description": "Enter the agent's user ID. Ignore when creating customer's message. Get the agent's User ID by using the Get Managers API"
          },
          "UserStreamProviderId": {
            "type": "string",
            "description": "The email or phone number of the person you are sending the message on their behalf"
          },
          "UserStreamProviderType": {
            "type": "integer",
            "description": "The channel type’s code. See Enum "
          },
          "Message": {
            "type": "string",
            "description": "The message on behalf of the agent / customer"
          }
        }
      }
    }
  }
}
````

