template
This commit is contained in:
parent
a109df2deb
commit
8901d99dd2
11 changed files with 380 additions and 13 deletions
|
|
@ -1315,6 +1315,7 @@ export const whatsappApi = {
|
|||
recipients: string[]
|
||||
body_parameters?: string[]
|
||||
product_policy?: 'STRICT' | 'CLOUD_API_FALLBACK'
|
||||
use_sample_header?: boolean
|
||||
}) =>
|
||||
jsonRequest<{
|
||||
template_name: string
|
||||
|
|
@ -1349,6 +1350,9 @@ export type WaTemplateDraft = {
|
|||
text: string
|
||||
examples: string[]
|
||||
handle: string
|
||||
sample_id: string
|
||||
sample_name: string
|
||||
sample_type: string
|
||||
preview_name: string
|
||||
preview_url: string
|
||||
}
|
||||
|
|
@ -1391,6 +1395,9 @@ export type WaManagedTemplate = {
|
|||
quality: string | null
|
||||
rejected_reason: string | null
|
||||
parameter_format: string
|
||||
header_format: string
|
||||
sample_stored: boolean
|
||||
sample_name: string
|
||||
definition: Partial<WaTemplateDraft>
|
||||
components: unknown[]
|
||||
messages_sent: number
|
||||
|
|
@ -1422,6 +1429,16 @@ export const waTemplateApi = {
|
|||
const body = new FormData()
|
||||
body.append('account_id', accountId)
|
||||
body.append('file', file)
|
||||
return jsonRequest<{ handle: string; format: string }>('/api/v1/whatsapp/message-templates/media', { method: 'POST', body })
|
||||
return jsonRequest<{ handle: string; format: string; sample_id: string; sample_name: string; sample_type: string }>('/api/v1/whatsapp/message-templates/media', { method: 'POST', body })
|
||||
},
|
||||
saveSample: (templateId: string, file: File) => {
|
||||
const body = new FormData()
|
||||
body.append('file', file)
|
||||
return jsonRequest<WaManagedTemplate>(`/api/v1/whatsapp/message-templates/${templateId}/sample`, { method: 'POST', body })
|
||||
},
|
||||
sampleBlob: async (templateId: string) => {
|
||||
const response = await fetch(`${API_BASE_URL}/api/v1/whatsapp/message-templates/${templateId}/sample`, { credentials: 'include' })
|
||||
if (!response.ok) throw new Error('The sample file could not be opened')
|
||||
return response.blob()
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue