Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
import { Column, CreateDateColumn, Entity, Index, PrimaryColumn, UpdateDateColumn } from 'typeorm';
import { jsonColumnType } from '../../../common/utils/column-types';
// One configured instance of an adapter plugin (e.g. one Chatwoot account). instanceId is namespaced
// under pluginId; NOT a separate worker. Secret is host-minted and masked-on-read.
@Entity('plugin_instances')
@Index('UQ_plugin_instances_plugin_instance', ['pluginId', 'instanceId'], { unique: true })
export class PluginInstance {
@PrimaryColumn()
id!: string; // `${pluginId}:${instanceId}`
@Column()
pluginId!: string;
@Column()
instanceId!: string;
@Column({ type: 'varchar', nullable: true })
sessionScope!: string | null; // resolved session id this instance acts on; null = inherit manifest.sessions
@Column()
secret!: string; // host-minted ingress HMAC secret; stored plaintext, masked to '***' on API reads
// (via PluginInstanceService.maskedView + the provisioning controller's reveal flag), exposed
// in full only in the create and regenerate-secret responses. Config fields flagged `secret` in
// the plugin's configSchema are masked by maskedView on every read, those responses included.
@Column({ type: 'varchar', nullable: true })
verifyToken!: string | null; // optional provider challenge token
@Column({ type: jsonColumnType(), nullable: true })
config!: Record<string, unknown> | null;
@Column({ default: true })
enabled!: boolean;
@CreateDateColumn()
createdAt!: Date;
@UpdateDateColumn()
updatedAt!: Date;
}