This method allows you to retrieve detailed information about a contact or chat using a phone number or chat_id (for Telegram). It returns data from WAMM.chat about the contact, including their name, email, avatar, notes, tags, and chat settings. Useful for synchronizing contact data with external systems and CRMs.

GET /api2/contact_get/{token}/{phone}

Request Parameters
ParameterTypeRequiredDescription
tokenstringYesAPI token obtained from settings
phonestringYesPhone number in international format or chat ID (for Telegram)

Success Response
{
    "err": 0,
    "data": {
        "api_id": 100,
        "tip": "user",
        "phone": "79001234567",
        "name": "Chat Name",
        "email": "",
        "web": "",
        "avatar": "https://wamm.chat/avatar.jpg",
        "notes": "",
        "user_id": "",
        "tags": "tag1; tag2",
        "chat_banned": 0,
        "chat_mute": 1,
        "chat_favorite": 0
    }
}

Response Field Description
FieldDescription
api_idChannel number
tipContact type ("user" - user, "group" - group)
phoneContact's phone number. For Telegram, MAX - chat ID
phone_realPhone number/Nickname, if known, for Telegram, MAX, where phone is the chat ID
nameContact name or chat title
emailContact's email
webContact's URL
avatarContact's avatar URL
notesNotes for the contact
user_idID of the user assigned to the chat (responsible)
tagsTags separated by semicolon (;)
chat_bannedBan status (0 - not banned, 1 - banned)
chat_muteNotification status (0 - notifications enabled, 1 - notifications disabled)
chat_favoritePinned to top status (0 - not pinned, 1 - pinned)

Possible Errors
Error CodeDescription
token failToken error
not foundContact not found
phone failPhone number error

Usage Examples
curl -X GET "https://wamm.chat/api2/contact_get/YOUR_TOKEN/79001234567"
function getContactInfo($token, $phone) {
    // Prepare the request URL
    $url = "https://wamm.chat/api2/contact_get/$token/$phone";
    
    // Execute the request
    $response = file_get_contents($url);
    
    // Process the response
    if ($response !== false) {
        // Convert the response to an array
        $json_response = json_decode($response, true);
        
        // Check the result
        if (isset($json_response['err']) && $json_response['err'] === 0) {
            echo "Contact information retrieved:";
            echo "
";
            print_r($json_response['data']);
            echo "
"; } else { echo "Error: " . (isset($json_response['err']) ? $json_response['err'] : "Unknown error"); } } else { echo "Failed to execute request to server"; } } // Use the function to get contact information $token="YOUR_TOKEN"; $phone="79001234567"; getContactInfo($token, $phone);