Skip to Content

Update a topic

Updates named fields. Changing the default does not change any explicit subscription status. Null clears a sending default.

PATCH
/v1/topics/{id}

Updates named fields. Changing the default does not change any explicit subscription status. Null clears a sending default.

Authorization

apiKey
headerx-api-key<token>

Path Parameters

id*string
Match^tpc_[0-9a-hjkmnp-tv-z]{16,24}$

Request Body

application/json
  1. body
name?|null
description?string|null|null
default?|null
defaultSenderId?|null|null
replyMailboxId?|null|null
templateId?|null|null

Response Body

Topic

application/json
  1. response
id*TopicId
Match^tpc_[0-9a-hjkmnp-tv-z]{16,24}$
namespaceId*|null
name*string
description*string|null
default*string
Value in"opt_out""opt_in"
isDefault*boolean
defaultSenderId*|null
replyMailboxId*|null
templateId*|null
subscriptions*
createdAt*string
updatedAt*string
Example Request
import { createClient } from "samva";

const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });

const result = await samva.topics.update({
  "id": "example"
});
Example Response
{
  "id": "string",
  "namespaceId": "string",
  "name": "string",
  "description": "string",
  "default": "opt_out",
  "isDefault": true,
  "defaultSenderId": "string",
  "replyMailboxId": "string",
  "templateId": "string",
  "subscriptions": {
    "sms": {
      "subscribed": 0,
      "unsubscribed": 0
    },
    "whatsapp": {
      "subscribed": 0,
      "unsubscribed": 0
    },
    "email": {
      "subscribed": 0,
      "unsubscribed": 0
    }
  },
  "createdAt": "string",
  "updatedAt": "string"
}

Related documentation