Create a chatroom

POST /chat/chatrooms

Headers

  • X-Popsell-Brand integer Required

    The id of the target brand

application/json

Body

  • ids_ambassadors array[integer]

    Array of ambassador IDs. Must contain exactly two elements. Note: Either 'ids_ambassadors' or 'id_brand_tag' is required, but not both or none.

  • id_brand_tag integer

    ID of the brand tag to be associated with the chatroom. Note: Either 'ids_ambassadors' or 'id_brand_tag' is required, but not both or none.

  • source integer Required

    Source of the chatroom.

    Values are 0, 1, or 2.

Responses

  • 201 application/json

    Return the created chatroom

    Hide response attributes Show response attributes object
    • id_chatroom integer
    • ambassadors array[object]
      Hide ambassadors attributes Show ambassadors attributes object
      • id_ambassador integer(int32)
      • image string
      • firstname string
      • lastname string
      • username string
      • email string
      • email_tmp string
      • active integer(int32)
      • status integer(int32)
      • online boolean

        true: when last_action_date is less than 5 minutes ago

      • last_action_date string(date-time)
      • customer_id string
      • anonymized boolean
      • chatroom_pivot_data array[object]
        Hide chatroom_pivot_data attributes Show chatroom_pivot_data attributes object
        • id_chatroom integer(int32)
        • id_ambassador integer(int32)
        • last_read_message integer(int32)
        • is_blocked boolean
        • archived boolean
    • date_insert string(date-time)
    • last_message_date string(date-time)
    • type_chatroom integer

      0: one to one , 7: one to many

    • type_discussion integer

      0: between members, 1: between external, 2: between members and external

    • source string

      0:direct, 1:waiting_list, 2:hot_list

    • established_dialogue string(date-time)

      true: chatrooms with at least two authors, false: chatrooms with only one author

    • last_rating object

      Additional properties are allowed.

      Hide last_rating attributes Show last_rating attributes object
      • value integer
      • comment string
    • last_summary object

      Additional properties are allowed.

      Hide last_summary attributes Show last_summary attributes object
      • date_insert string
      • summary string
      • anomaly integer
      • topic integer
  • 401 application/json

    Unauthorized.

    Hide response attribute Show response attribute object
    • message string
  • 403

    Forbidden - You don't have permission to access this route

  • 422 application/json

    Unprocessable Content

    Hide response attributes Show response attributes object
    • message string

      Error message.

    • errors object
      Hide errors attributes Show errors attributes object
      • field array[string]

        Error message details.

      • * array[string] Additional properties

        Error message details.

POST /chat/chatrooms
curl \
 --request POST 'https://domain.tld/api/v2/chat/chatrooms' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --header "X-Popsell-Brand: 3" \
 --data '{"ids_ambassadors":[1,2],"id_brand_tag":1,"source":0}'
Request examples
# Headers
X-Popsell-Brand: 3

# Payload
{
  "ids_ambassadors": [
    1,
    2
  ],
  "id_brand_tag": 1,
  "source": 0
}
Response examples (201)
{
  "id_chatroom": 8,
  "ambassadors": [
    {
      "id_ambassador": 42,
      "image": "string",
      "firstname": "string",
      "lastname": "string",
      "username": "string",
      "email": "string",
      "email_tmp": "string",
      "active": 42,
      "status": 42,
      "online": true,
      "last_action_date": "2025-05-04T09:42:00Z",
      "customer_id": "string",
      "anonymized": true,
      "chatroom_pivot_data": [
        {
          "id_chatroom": 42,
          "id_ambassador": 42,
          "last_read_message": 42,
          "is_blocked": true,
          "archived": true
        }
      ]
    }
  ],
  "date_insert": "2023-10-06T13:41:09.123000Z",
  "last_message_date": "2023-10-06T13:41:09.123000Z",
  "type_chatroom": 0,
  "type_discussion": 2,
  "source": 2,
  "established_dialogue": "2023-10-06 13:41:09.123",
  "last_rating": {
    "value": 5,
    "comment": "Great ambassador"
  },
  "last_summary": {
    "date_insert": "string",
    "summary": "string",
    "anomaly": 42,
    "topic": 42
  }
}
Response examples (401)
{
  "message": "Unauthorized."
}
Response examples (422)
{
  "message": "field is required! (and 3 more error)",
  "errors": {
    "field": [
      "Error message details here"
    ],
    "additionalProperty1": [
      "Error message details here"
    ],
    "additionalProperty2": [
      "Error message details here"
    ]
  }
}