Skip to content

Update Keyword Watch ​

PUThttps://api.repliz.com/public/watcher/{watcherId}

Replace the settings of a keyword watch. Send every field, as in Create Keyword Watch: a field left out is cleared, for example knowledgeIds.

Endpoint Details ​

  • Authentication: Basic Auth (Authorization: Basic Base64(AccessKey:SecretKey)) or Bearer token from Login with Repliz
  • Scope (Bearer only): watcher:write
  • Access Tier: Gold+

Parameters ​

ParameterTypeRequiredDescription
watcherIdstringYesID of the keyword watch, the _id from Get Keyword Watch or the watcherId from Create Keyword Watch.

Request Body ​

The same as Create Keyword Watch.

  • Keeping the same accountId keeps the progress and the found posts.
  • Changing accountId starts over: the posts the previous account found are deleted, and the new account only picks up posts published after the change.
  • Changing keyword or criteria only affects posts found from now on.

Example Request ​

bash
curl -X PUT "https://api.repliz.com/public/watcher/6913a5c2e4b0a1f2c3d4e5f6" \
  -H "Authorization: Basic $(echo -n 'YOUR_ACCESS_KEY:YOUR_SECRET_KEY' | base64)" \
  -H "Content-Type: application/json" \
  -d '{
    "keyword": "rekomendasi kopi",
    "filter": {
      "mode": "KEYWORD",
      "type": "",
      "username": "",
      "isIncludeReplies": false
    },
    "excludes": [
      "lowongan",
      "giveaway"
    ],
    "criteria": "Orang yang minta rekomendasi kedai kopi di Jakarta, bukan iklan atau berita.",
    "accountId": "680affa5ce12f2f72916f67e",
    "reply": {
      "type": "ai",
      "prompt": "Balas sebagai tim Kopi Kita: singkat, ramah, rekomendasikan cabang Kemang.",
      "knowledgeIds": [
        "6911b2c3d4e5f6a7b8c9d0e1"
      ],
      "approval": "review"
    }
  }'
javascript
import axios from 'axios';

const watcherId = '6913a5c2e4b0a1f2c3d4e5f6';

const response = await axios.put(
  `https://api.repliz.com/public/watcher/${watcherId}`,
  {
    keyword: 'rekomendasi kopi',
    filter: {
      mode: 'KEYWORD',
      type: '',
      username: '',
      isIncludeReplies: false,
    },
    excludes: ['lowongan', 'giveaway'],
    criteria: 'Orang yang minta rekomendasi kedai kopi di Jakarta, bukan iklan atau berita.',
    accountId: '680affa5ce12f2f72916f67e',
    reply: {
      type: 'ai',
      prompt: 'Balas sebagai tim Kopi Kita: singkat, ramah, rekomendasikan cabang Kemang.',
      knowledgeIds: ['6911b2c3d4e5f6a7b8c9d0e1'],
      approval: 'review',
    },
  },
  {
    auth: {
      username: 'YOUR_ACCESS_KEY',
      password: 'YOUR_SECRET_KEY',
    },
  },
);

console.log(response.status);
javascript
const credentials = btoa('YOUR_ACCESS_KEY:YOUR_SECRET_KEY');

const watcherId = '6913a5c2e4b0a1f2c3d4e5f6';

const response = await fetch(`https://api.repliz.com/public/watcher/${watcherId}`, {
  method: 'PUT',
  headers: {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    keyword: 'rekomendasi kopi',
    filter: {
      mode: 'KEYWORD',
      type: '',
      username: '',
      isIncludeReplies: false,
    },
    excludes: ['lowongan', 'giveaway'],
    criteria: 'Orang yang minta rekomendasi kedai kopi di Jakarta, bukan iklan atau berita.',
    accountId: '680affa5ce12f2f72916f67e',
    reply: {
      type: 'ai',
      prompt: 'Balas sebagai tim Kopi Kita: singkat, ramah, rekomendasikan cabang Kemang.',
      knowledgeIds: ['6911b2c3d4e5f6a7b8c9d0e1'],
      approval: 'review',
    },
  }),
});

console.log(response.status);

Response ​

json
// No content returned on success
json
{
  "code": 400,
  "message": "keyword watch only works with Threads accounts"
}
json
{
  "code": 404,
  "message": "keyword watch not found"
}
json
{
  "code": 401,
  "message": "unauthorized"
}