Skip to content

Export contacts #175

Jun 21, 2022 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Is there any way to export all contacts

        // import "encoding/csv"

	client.FetchAppState(appstate.WAPatchCriticalUnblockLow, true, false)
	contacts, err := client.Store.Contacts.GetAllContacts()
	if err != nil {
		fmt.Println("Error reading contacts:", err)
	}
	fmt.Println("You have:", len(contacts), "contacts")

	file, err := os.Create("contacts.csv")
	if err != nil {
		log.Fatalln("failed to open file", err)
	}
	//	defer file.Close()

	w := csv.NewWriter(file)
	// defer w.Flush()

	// Using Write
	for jid, info := range contacts {
		row := []string{
			jid.User,
			info.FirstName,
			info.FullName,
			info.PushName,
			info.BusinessName,
			strconv.FormatBool(info.Found),
		}
		if

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@abbasudo
Comment options

@masewo
Comment options

Answer selected by abbasudo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants