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 attribute Show ambassadors attribute object
      • 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
      Hide last_rating attributes Show last_rating attributes object
      • value integer
      • comment string
  • 403

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

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": [
    {
      "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"
  }
}