🕷

Kintone Webhookの型定義

2022/01/10に公開

すぐにコピって使えるよう備忘メモ✍

定義はこちら

https://jp.cybozu.help/k/ja/user/app_settings/set_webhook/webhook_notification.html

import { Record, Comment } from '@kintone/rest-api-client/lib/client/types';

export interface AppInfo {
  id: string;
  name: string;
}

export interface UserInfo {
  code: string;
  name: string;
}

export interface ModifyRecordKintoneWebhookPayload {
  id: string;
  type: 'ADD_RECORD' | 'UPDATE_RECORD' | 'UPDATE_STATUS';
  app: AppInfo;
  record: Record;
  recordTitle: string;
  url: string;
}

export interface DeleteRecordKintoneWebhookPayload {
  id: string;
  type: 'DELETE_RECORD';
  app: AppInfo;
  recordId: string;
  deletedBy: UserInfo;
  deletedAt: string;
}

export interface WriteCommentKintoneWebhookPayload {
  id: string;
  type: 'ADD_RECORD_COMMENT';
  app: AppInfo;
  comment: Comment;
  recordId: string;
  url: string;
}

export type KintoneWebhookPayload =
  | ModifyRecordKintoneWebhookPayload
  | DeleteRecordKintoneWebhookPayload
  | WriteCommentKintoneWebhookPayload;

そんだけ😌

Discussion