meta embed flow
This commit is contained in:
parent
ae72b59878
commit
99ed8f2477
10 changed files with 2256 additions and 151 deletions
|
|
@ -1115,18 +1115,78 @@ 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
|
||||
phone_number_id: string | null
|
||||
business_account_id: string | null
|
||||
meta_app_id: string | null
|
||||
verify_token_visible: boolean
|
||||
api_version: string
|
||||
recommended_fields: string[]
|
||||
docs_url: string
|
||||
}
|
||||
|
||||
export type WhatsAppSignupConfig = {
|
||||
app_id: string | null
|
||||
config_id: string | null
|
||||
api_version: string
|
||||
ready: boolean
|
||||
}
|
||||
|
||||
export type WhatsAppPhoneAsset = {
|
||||
id: string
|
||||
phone_number_id: string
|
||||
display_phone: string
|
||||
verified_name: string | null
|
||||
quality: string | null
|
||||
status: string
|
||||
code_verification_status: string | null
|
||||
}
|
||||
|
||||
export type WhatsAppAccount = {
|
||||
id: string
|
||||
waba_id_masked: string | null
|
||||
name: string
|
||||
business_name: string | null
|
||||
business_id_masked: string | null
|
||||
status: string
|
||||
usable: boolean
|
||||
messaging_status: string
|
||||
management_status: string
|
||||
templates_status: string
|
||||
webhooks_status: string
|
||||
template_count: number
|
||||
quality: string | null
|
||||
primary_phone: WhatsAppPhoneAsset | null
|
||||
phones: WhatsAppPhoneAsset[]
|
||||
last_error: string | null
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
export type WhatsAppSignupResult = {
|
||||
status: string
|
||||
message: string
|
||||
accounts: WhatsAppAccount[]
|
||||
}
|
||||
|
||||
export type WhatsAppTemplateRow = {
|
||||
name: string | null
|
||||
category: string | null
|
||||
language: string | null
|
||||
status: string | null
|
||||
quality: string | null
|
||||
}
|
||||
|
||||
export type WhatsAppDeveloperConfig = {
|
||||
webhook_url: string
|
||||
verify_token_configured: boolean
|
||||
verify_token_visible: boolean
|
||||
recommended_fields: string[]
|
||||
webhooks_status: string
|
||||
docs_url: string
|
||||
}
|
||||
|
||||
export type WhatsAppAccountLogs = {
|
||||
audits: { id: string; event: string; detail: string; created_at: string }[]
|
||||
events: { id: string; field: string; event_type: string; from_wa_id: string | null; status: string | null; created_at: string }[]
|
||||
}
|
||||
|
||||
export type WhatsAppWebhookEvent = {
|
||||
id: string
|
||||
waba_id: string | null
|
||||
|
|
@ -1142,7 +1202,30 @@ export type WhatsAppWebhookEvent = {
|
|||
export const whatsappApi = {
|
||||
setup: () => jsonRequest<WhatsAppSetup>('/api/v1/whatsapp/setup'),
|
||||
events: () => jsonRequest<WhatsAppWebhookEvent[]>('/api/v1/whatsapp/events'),
|
||||
sendText: (payload: { to: string; body: string }) =>
|
||||
signupConfig: () => jsonRequest<WhatsAppSignupConfig>('/api/v1/whatsapp/signup/config'),
|
||||
accounts: () => jsonRequest<WhatsAppAccount[]>('/api/v1/whatsapp/accounts'),
|
||||
completeSignup: (payload: {
|
||||
event: string
|
||||
code?: string | null
|
||||
waba_id?: string | null
|
||||
phone_number_id?: string | null
|
||||
business_id?: string | null
|
||||
error_message?: string | null
|
||||
}) =>
|
||||
jsonRequest<WhatsAppSignupResult>('/api/v1/whatsapp/signup/complete', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
}),
|
||||
account: (accountId: string) => jsonRequest<WhatsAppAccount>(`/api/v1/whatsapp/accounts/${accountId}`),
|
||||
refreshAccount: (accountId: string) =>
|
||||
jsonRequest<WhatsAppAccount>(`/api/v1/whatsapp/accounts/${accountId}/refresh`, { method: 'POST' }),
|
||||
disconnectAccount: (accountId: string) =>
|
||||
jsonRequest<WhatsAppAccount>(`/api/v1/whatsapp/accounts/${accountId}/disconnect`, { method: 'POST' }),
|
||||
templates: (accountId: string) =>
|
||||
jsonRequest<{ available: boolean; templates: WhatsAppTemplateRow[] }>(`/api/v1/whatsapp/accounts/${accountId}/templates`),
|
||||
logs: (accountId: string) => jsonRequest<WhatsAppAccountLogs>(`/api/v1/whatsapp/accounts/${accountId}/logs`),
|
||||
developer: (accountId: string) => jsonRequest<WhatsAppDeveloperConfig>(`/api/v1/whatsapp/accounts/${accountId}/developer`),
|
||||
sendText: (payload: { to: string; body: string; phone_number_id: string }) =>
|
||||
jsonRequest<Record<string, unknown>>('/api/v1/whatsapp/messages/send', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue