Whats91
Developers

Update a contact book name through public v2.

Update Contact Book

Summary

Update a contact book name through public v2.

Prerequisites

  • Authorization: Bearer w91_live_xxx
  • Content-Type: application/json for JSON requests

Endpoint: POST /api/v2/contact-books/{bookUid}. Only name is editable through public v2 in this phase.

POST/api/v2/contact-books/{bookUid}
ParameterTypeRequiredDescription
AuthorizationheaderRequiredBearer w91_public_token_here. Must be a global public API token.
Content-TypeheaderRequiredContent-Type: application/json.
bookUidstringRequiredContact book UID, for example grp_abc.
namestringRequiredReplacement contact book name.
Update contact book
curl -X POST "https://graph.whats91.com/api/v2/contact-books/grp_abc" \
  -H "Authorization: Bearer w91_public_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Retail Leads Updated"
  }'
Update response
{
  "success": true,
  "message": "Contact book updated",
  "data": {
    "contactBook": {
      "contactBookUid": "grp_abc",
      "uid": "grp_abc",
      "name": "Retail Leads Updated",
      "description": "Retail campaign contacts",
      "color": "#0f62fe",
      "status": "ACTIVE",
      "contactCount": 120
    }
  },
  "metadata": {
    "apiVersion": "v2",
    "requestId": "request-uuid"
  }
}

Use dashboard tools for fields outside the public v2 update contract. Public API update currently changes the contact book name only.

SDK Examples

Use these examples as starting points for server-side implementations.

cURL
curl -X POST "https://graph.whats91.com/api/v2/contact-books/{bookUid}" \
  -H "Authorization: Bearer w91_live_xxx" \
  -H "Content-Type: application/json" \
  -d 'curl -X POST "https://graph.whats91.com/api/v2/contact-books/grp_abc" \
  -H "Authorization: Bearer w91_public_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Retail Leads Updated"
  }''
Node.js
const response = await fetch("https://graph.whats91.com/api/v2/contact-books/{bookUid}", {
  method: "POST",
  headers: {
    "Authorization": "Bearer w91_live_xxx",
    "Content-Type": "application/json"
  },
  body: JSON.stringify(curl -X POST "https://graph.whats91.com/api/v2/contact-books/grp_abc" \
  -H "Authorization: Bearer w91_public_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Retail Leads Updated"
  }')
});

const data = await response.json();
console.log(data);
PHP
$ch = curl_init("https://graph.whats91.com/api/v2/contact-books/{bookUid}");
curl_setopt_array($ch, [
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer w91_live_xxx",
    "Content-Type: application/json"
  ],
  CURLOPT_POSTFIELDS => json_encode(curl -X POST "https://graph.whats91.com/api/v2/contact-books/grp_abc" \
  -H "Authorization: Bearer w91_public_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Retail Leads Updated"
  }')
]);

$response = curl_exec($ch);
curl_close($ch);
echo $response;
Python
import requests

response = requests.request(
    "POST",
    "https://graph.whats91.com/api/v2/contact-books/{bookUid}",
    headers={
        "Authorization": "Bearer w91_live_xxx",
        "Content-Type": "application/json",
    },
    json=curl -X POST "https://graph.whats91.com/api/v2/contact-books/grp_abc" \
  -H "Authorization: Bearer w91_public_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Retail Leads Updated"
  }'
)

print(response.json())
C#
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer w91_live_xxx");

var request = new HttpRequestMessage(HttpMethod.Post, "https://graph.whats91.com/api/v2/contact-books/{bookUid}");
request.Content = new StringContent(
  """curl -X POST \"https://graph.whats91.com/api/v2/contact-books/grp_abc\" \
  -H \"Authorization: Bearer w91_public_token_here\" \
  -H \"Content-Type: application/json\" \
  -d '{
    \"name\": \"Retail Leads Updated\"
  }'""",
  Encoding.UTF8,
  "application/json"
);

var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());

Related APIs