2
0

🚸 (whatsapp) Allow test phone numbers

This commit is contained in:
Baptiste Arnaud
2023-08-29 19:25:13 +02:00
parent a1179e3934
commit 5d402d9a38

View File

@@ -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, ''), ''
),
} }
}) })