Go-whatsapp: download account & group profile picture

Created on 6 Mar 2019  Â·  1Comment  Â·  Source: Rhymen/go-whatsapp

how do i download profile picture based on account id or group id

Most helpful comment

type ThumbUrl struct {
    EURL string 'json:"eurl"'
    Tag string 'json:"tag"'
    Status int64 'json:"status"'
}

// RemoteJID is the sender ID the one who send the text or the media message or basically the WhatsappID just pass it here
profilePicThumb, _ := wac.GetProfilePicThumb(RemoteJID)
profilePic := <- profilePicThumb

thumbnail := ThumbUrl{}
err := json.Unmarshal([]byte(profilePic), &thumbnail)

if err != nil {
    // print error
}

if thumbnail.Status = 404 {
    // meaning thumbnail is not available because the person has no profile pic so what i did is return empty string
}

// Basically the EURL is what holds the profile picture of the person
return thumbnail.EURL

>All comments

type ThumbUrl struct {
    EURL string 'json:"eurl"'
    Tag string 'json:"tag"'
    Status int64 'json:"status"'
}

// RemoteJID is the sender ID the one who send the text or the media message or basically the WhatsappID just pass it here
profilePicThumb, _ := wac.GetProfilePicThumb(RemoteJID)
profilePic := <- profilePicThumb

thumbnail := ThumbUrl{}
err := json.Unmarshal([]byte(profilePic), &thumbnail)

if err != nil {
    // print error
}

if thumbnail.Status = 404 {
    // meaning thumbnail is not available because the person has no profile pic so what i did is return empty string
}

// Basically the EURL is what holds the profile picture of the person
return thumbnail.EURL

Was this page helpful?
0 / 5 - 0 ratings

Related issues

elpulga picture elpulga  Â·  4Comments

denislee picture denislee  Â·  6Comments

sbruder picture sbruder  Â·  9Comments

anton-rs picture anton-rs  Â·  10Comments

Valdenirmezadri picture Valdenirmezadri  Â·  5Comments