Create a topic
Creates a topic in the caller's or requested namespace.
POST
Creates a topic in the caller's or requested namespace. The subscription default is opt_out when omitted. Sending defaults must be compatible with that namespace. An organization holds at most 200 topics.
apiKeyheader
x-api-key<token>application/json- body
name*stringLength
1 <= length <= 120description?string|null|nullnamespaceId?|null|nulldefault?|nulldefaultSenderId?|null|nullreplyMailboxId?|null|nulltemplateId?|null|nullTopic
application/json- response
id*TopicIdMatch
^tpc_[0-9a-hjkmnp-tv-z]{16,24}$namespaceId*|nullname*stringdescription*string|nulldefault*stringValue in
"opt_out""opt_in"isDefault*booleandefaultSenderId*|nullreplyMailboxId*|nulltemplateId*|nullsubscriptions*createdAt*stringupdatedAt*stringimport { createClient } from "samva";
const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });
const result = await samva.topics.create({
"name": "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"
}