privacy policy and business integration
This commit is contained in:
parent
141ca9fda3
commit
cd3751219d
16 changed files with 1592 additions and 30 deletions
|
|
@ -648,6 +648,66 @@ export type AdminTemplateConfig = TemplateConfig & {
|
|||
user: { id: string; name: string; email: string }
|
||||
}
|
||||
|
||||
export type AdminWhatsAppConfig = {
|
||||
business_phone: string
|
||||
phone_number_id: string | null
|
||||
business_account_id: string | null
|
||||
meta_app_id: string | null
|
||||
access_token_configured: boolean
|
||||
app_secret_configured: boolean
|
||||
webhook_url: string
|
||||
verify_token_configured: boolean
|
||||
ready_to_send: boolean
|
||||
supported_operations: string[]
|
||||
}
|
||||
|
||||
export type AdminWhatsAppMessage = {
|
||||
id: string
|
||||
direction: 'inbound' | 'outbound'
|
||||
wa_message_id: string | null
|
||||
from: string
|
||||
to: string
|
||||
body: string | null
|
||||
message_type: string
|
||||
status: string
|
||||
media?: {
|
||||
id?: string
|
||||
mime_type?: string
|
||||
caption?: string
|
||||
filename?: string
|
||||
} | null
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export type AdminWhatsAppTemplate = {
|
||||
id?: string
|
||||
name: string
|
||||
language: string
|
||||
status?: string
|
||||
category?: string
|
||||
}
|
||||
|
||||
export type AdminWhatsAppSendPayload = {
|
||||
to: string
|
||||
message_type: 'text' | 'template' | 'image' | 'document' | 'audio' | 'video' | 'interactive_buttons' | 'interactive_list' | 'reaction'
|
||||
text?: string
|
||||
reply_to?: string
|
||||
template_name?: string
|
||||
template_language?: string
|
||||
template_components?: Record<string, unknown>[]
|
||||
media_link?: string
|
||||
media_caption?: string
|
||||
media_filename?: string
|
||||
interactive_body?: string
|
||||
interactive_header?: string
|
||||
interactive_footer?: string
|
||||
interactive_buttons?: Array<{ id: string; title: string }>
|
||||
interactive_list_button?: string
|
||||
interactive_list_sections?: Record<string, unknown>[]
|
||||
reaction_message_id?: string
|
||||
reaction_emoji?: string
|
||||
}
|
||||
|
||||
export const adminApi = {
|
||||
me: () => jsonRequest<{ username: string }>('/api/v1/admin/me'),
|
||||
login: (username: string, password: string) =>
|
||||
|
|
@ -708,6 +768,30 @@ export const adminApi = {
|
|||
method: 'PATCH',
|
||||
body: JSON.stringify(payload),
|
||||
}),
|
||||
whatsappConfig: () => jsonRequest<AdminWhatsAppConfig>('/api/v1/admin/whatsapp/config'),
|
||||
updateWhatsAppConfig: (payload: {
|
||||
phone_number_id?: string
|
||||
business_account_id?: string
|
||||
app_secret?: string
|
||||
}) => jsonRequest<AdminWhatsAppConfig>('/api/v1/admin/whatsapp/config', {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(payload),
|
||||
}),
|
||||
listWhatsAppMessages: (limit = 50, peer?: string) =>
|
||||
jsonRequest<AdminWhatsAppMessage[]>(
|
||||
`/api/v1/admin/whatsapp/messages?limit=${limit}${peer ? `&peer=${encodeURIComponent(peer)}` : ''}`,
|
||||
),
|
||||
listWhatsAppTemplates: () =>
|
||||
jsonRequest<{ data?: AdminWhatsAppTemplate[] }>('/api/v1/admin/whatsapp/templates'),
|
||||
markWhatsAppRead: (waMessageId: string) =>
|
||||
jsonRequest<{ success?: boolean }>(`/api/v1/admin/whatsapp/messages/${encodeURIComponent(waMessageId)}/read`, {
|
||||
method: 'POST',
|
||||
}),
|
||||
sendWhatsAppMessage: (payload: AdminWhatsAppSendPayload) =>
|
||||
jsonRequest<AdminWhatsAppMessage>('/api/v1/admin/whatsapp/messages/send', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
}),
|
||||
}
|
||||
|
||||
export type LogType = 'outbound' | 'inbound' | 'sms' | 'otp'
|
||||
|
|
@ -791,6 +875,7 @@ export const analyticsApi = {
|
|||
|
||||
export type WhatsAppSetup = {
|
||||
webhook_url: string
|
||||
verify_token: string | null
|
||||
verify_token_configured: boolean
|
||||
app_secret_configured: boolean
|
||||
access_token_configured: boolean
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue