LemonChannels. Adapters. WhatsApp. Inbound
(lemon_channels v0.1.0)
View Source
Inbound message normalization for WhatsApp.
Converts bridge message events (JSON-decoded maps with string keys) into
LemonCore.InboundMessage structs.
Summary
Functions
Normalize a raw WhatsApp bridge event to an InboundMessage.
Extracts the phone number from a WhatsApp JID.
Functions
@spec normalize(term()) :: {:ok, LemonCore.InboundMessage.t()} | {:error, term()}
Normalize a raw WhatsApp bridge event to an InboundMessage.
Bridge events are maps with string keys from JSON decoding bridge stdout.
Only events with "type" => "message" and "from_me" => false are accepted.
Extracts the phone number from a WhatsApp JID.
JIDs are typically in the form phone@s.whatsapp.net for DMs or
phone-timestamp@g.us for groups. Returns the local part before @.