⚡️ Receive WhatsApp location (#1158)
Enable Typebot to recieve location messages via Whatsapp and parse them into a string. Returns a string "Location: [LAT],[LON]" for the text input block As per https://discord.com/channels/1155799591220953138/1193858969102450748 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced support for receiving and handling location messages in WhatsApp integration. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: memarius <me-marius@web.de> Co-authored-by: Baptiste Arnaud <contact@baptiste-arnaud.fr>
This commit is contained in:
@ -153,6 +153,8 @@ const getIncomingMessageContent = async ({
|
|||||||
env.NEXTAUTH_URL +
|
env.NEXTAUTH_URL +
|
||||||
`/api/typebots/${typebotId}/whatsapp/media/${mediaId}`
|
`/api/typebots/${typebotId}/whatsapp/media/${mediaId}`
|
||||||
)
|
)
|
||||||
|
case 'location':
|
||||||
|
return `${message.location.latitude}, ${message.location.longitude}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +137,15 @@ export const incomingMessageSchema = z.discriminatedUnion('type', [
|
|||||||
document: z.object({ id: z.string() }),
|
document: z.object({ id: z.string() }),
|
||||||
timestamp: z.string(),
|
timestamp: z.string(),
|
||||||
}),
|
}),
|
||||||
|
z.object({
|
||||||
|
from: z.string(),
|
||||||
|
type: z.literal('location'),
|
||||||
|
location: z.object({
|
||||||
|
latitude: z.number(),
|
||||||
|
longitude: z.number()
|
||||||
|
}),
|
||||||
|
timestamp: z.string(),
|
||||||
|
}),
|
||||||
])
|
])
|
||||||
|
|
||||||
export const whatsAppWebhookRequestBodySchema = z.object({
|
export const whatsAppWebhookRequestBodySchema = z.object({
|
||||||
|
Reference in New Issue
Block a user