whatsapp broadcast
This commit is contained in:
parent
63011f7d96
commit
70ccb720aa
9 changed files with 570 additions and 4 deletions
|
|
@ -1290,6 +1290,11 @@ export const whatsappApi = {
|
|||
method: 'POST',
|
||||
body: JSON.stringify({ pin: pin || null }),
|
||||
}),
|
||||
enableDelivery: (accountId: string, appSecret: string) =>
|
||||
jsonRequest<WhatsAppAccount>(`/api/v1/whatsapp/accounts/${accountId}/delivery`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ app_secret: appSecret }),
|
||||
}),
|
||||
messages: (accountId: string) =>
|
||||
jsonRequest<CustomerWhatsAppMessage[]>(`/api/v1/whatsapp/accounts/${accountId}/messages`),
|
||||
sendAccountMessage: (accountId: string, payload: CustomerWhatsAppSend) =>
|
||||
|
|
@ -1299,6 +1304,29 @@ export const whatsappApi = {
|
|||
}),
|
||||
templates: (accountId: string) =>
|
||||
jsonRequest<{ available: boolean; templates: WhatsAppTemplateRow[] }>(`/api/v1/whatsapp/accounts/${accountId}/templates`),
|
||||
createMarketingTemplate: (accountId: string, payload: { name: string; language: string; body: string }) =>
|
||||
jsonRequest<{ id?: string | null; name: string; language: string; category: string; status: string }>(
|
||||
`/api/v1/whatsapp/accounts/${accountId}/templates`,
|
||||
{ method: 'POST', body: JSON.stringify(payload) },
|
||||
),
|
||||
sendBroadcast: (accountId: string, payload: {
|
||||
template_name: string
|
||||
template_language: string
|
||||
recipients: string[]
|
||||
body_parameters?: string[]
|
||||
product_policy?: 'STRICT' | 'CLOUD_API_FALLBACK'
|
||||
}) =>
|
||||
jsonRequest<{
|
||||
template_name: string
|
||||
template_language: string
|
||||
product_policy: string
|
||||
sent: number
|
||||
failed: number
|
||||
results: { to: string; status: string; error?: string; message_id?: string | null }[]
|
||||
}>(`/api/v1/whatsapp/accounts/${accountId}/broadcasts`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
}),
|
||||
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 }) =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue