whatsapp integration
This commit is contained in:
parent
d077292bbc
commit
141ca9fda3
15 changed files with 578 additions and 1 deletions
|
|
@ -788,3 +788,38 @@ export const analyticsApi = {
|
|||
return jsonRequest<UsageAnalytics>(`/api/v1/analytics/usage?${query.toString()}`)
|
||||
},
|
||||
}
|
||||
|
||||
export type WhatsAppSetup = {
|
||||
webhook_url: string
|
||||
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
|
||||
api_version: string
|
||||
recommended_fields: string[]
|
||||
docs_url: string
|
||||
}
|
||||
|
||||
export type WhatsAppWebhookEvent = {
|
||||
id: string
|
||||
waba_id: string | null
|
||||
phone_number_id: string | null
|
||||
field: string
|
||||
event_type: string
|
||||
from_wa_id: string | null
|
||||
message_id: string | null
|
||||
status: string | null
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export const whatsappApi = {
|
||||
setup: () => jsonRequest<WhatsAppSetup>('/api/v1/whatsapp/setup'),
|
||||
events: () => jsonRequest<WhatsAppWebhookEvent[]>('/api/v1/whatsapp/events'),
|
||||
sendText: (payload: { to: string; body: 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