🚸 (whatsapp) Allow test phone numbers
This commit is contained in:
@@ -5,7 +5,7 @@ import prisma from '@/lib/prisma'
|
|||||||
import { decrypt } from '@typebot.io/lib/api'
|
import { decrypt } from '@typebot.io/lib/api'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { WhatsAppCredentials } from '@typebot.io/schemas/features/whatsapp'
|
import { WhatsAppCredentials } from '@typebot.io/schemas/features/whatsapp'
|
||||||
import { parsePhoneNumber } from 'libphonenumber-js'
|
import { formatNumber } from 'libphonenumber-js'
|
||||||
|
|
||||||
const inputSchema = z.object({
|
const inputSchema = z.object({
|
||||||
credentialsId: z.string().optional(),
|
credentialsId: z.string().optional(),
|
||||||
@@ -48,9 +48,10 @@ export const getPhoneNumber = authenticatedProcedure
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
id: credentials.phoneNumberId,
|
id: credentials.phoneNumberId,
|
||||||
name: parsePhoneNumber(display_phone_number)
|
name: formatNumber(display_phone_number, 'INTERNATIONAL').replace(
|
||||||
.formatInternational()
|
/\s/g,
|
||||||
.replace(/\s/g, ''),
|
''
|
||||||
|
),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user