Update Conversation


Update conversation using PATCH HTTP request.

If you don't know the ID of the conversation you want to update, you'll need to send GET request, more on that here: requesting all conversations

PATCH

/conversation/:id/

Parameters
Type
Description
id
integer
Unique ID of a conversation
Data
assigned_to
integer
ID of agent group assigned to conversation
active
boolean
Conversation status
curl -X PATCH -H "Authorization: Token <your_64_char_api_key>" -H "Content-Type: application/json" -d '{
  "assigned_to": "Update assigned agent group ID",
  "active": "Update conversation status"
}' "https://<your_app_subdomain>.user.com/api/public/conversation/:id/"
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://<your_app_subdomain>.user.com/api/public/conversation/:id/",
  "method": "PATCH",
  "headers": {
    "authorization": "Token <your_64_char_api_key>",
    "content-type": "application/json"
  },
  "processData": false,
  "data": "{\n  \"assigned_to\": \"Update assigned agent group ID\",\n  \"active\": \"Update conversation status\"\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
var data = JSON.stringify({
  "assigned_to": "Update assigned agent group ID",
  "active": "Update conversation status"
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("PATCH", "https://<your_app_subdomain>.user.com/api/public/conversation/:id/");
xhr.setRequestHeader("authorization", "Token <your_64_char_api_key>");
xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);
var request = require("request");

var options = { method: 'PATCH',
  url: 'https://<your_app_subdomain>.user.com/api/public/conversation/:id/',
  headers:
   { 'content-type': 'application/json',
     authorization: 'Token <your_64_char_api_key>' },
  body:
   { assigned_to: 'Update assigned agent group ID',
     active: 'Update conversation status' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://<your_app_subdomain>.user.com/api/public/conversation/:id/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PATCH",
  CURLOPT_POSTFIELDS => "{\n  \"assigned_to\": \"Update assigned agent group ID\",\n  \"active\": \"Update conversation status\"\n}",
  CURLOPT_HTTPHEADER => array(
    "authorization: Token <your_64_char_api_key>",
    "content-type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import requests

url = "https://<your_app_subdomain>.user.com/api/public/conversation/:id/"

payload = "{\n  \"assigned_to\": \"Update assigned agent group ID\",\n  \"active\": \"Update conversation status\"\n}"
headers = {
    'authorization': "Token <your_64_char_api_key>",
    'content-type': "application/json"
    }

response = requests.request("PATCH", url, data=payload, headers=headers)

print(response.text)
import http.client

conn = http.client.HTTPSConnection("<your_app_subdomain>.user.com")

payload = "{\n  \"assigned_to\": \"Update assigned agent group ID\",\n  \"active\": \"Update conversation status\"\n}"

headers = {
    'authorization': "Token <your_64_char_api_key>",
    'content-type': "application/json"
    }

conn.request("PATCH", "/api/public/conversation/:id/", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))