Learn R Programming

whapi (version 0.0.2)

whapi_normalize_to: Normalize WhatsApp contact IDs (phone numbers only)

Description

Cleans and normalizes WhatsApp phone numbers by:

  • Skipping normalization if the entry already contains a JID suffix (e.g., "@s.whatsapp.net" or "@g.us");

  • Otherwise, removing all non-digit characters (+, spaces, parentheses, hyphens, etc.);

  • Removing the ninth digit (when present) right after the country code (CC) and area code (SS), in order to standardize to 12 or 13 digits.

Usage

whapi_normalize_to(to)

Value

A character vector of normalized IDs (phones -> digits only, JIDs kept as-is).

Arguments

to

Character. A character vector of WhatsApp numbers in free text format or JIDs.

Details

This function is primarily designed for Brazilian E.164 numbers (e.g., +55 (81) 9XXXX-YYYY).