Hiện tại chúng tôi không cung cấp nhập danh bạ trực tiếp từ file. Tuy nhiên, bạn có thể sử dụng API để import hàng loạt liên hệ.

Importing contacts with Python

Nếu bạn có danh sách liên lạc trong tệp CSV và biết dùng Python, bạn có thể sử dụng tập lệnh sau để nhập danh sách.

import csv
import requests
from time import sleep

EMAIL_INDEX = 0
FILE_NAME = 'data.csv'
DELIMITER = ','

with open(FILE_NAME, 'r', errors='ignore') as csv_file:
    csv_reader = csv.reader(csv_file, delimiter=DELIMITER)

    for line in csv_reader:
        if len(line) == 0:
            continue

        retries = 3
        success = False
        while retries > 0 and not success:
            try:
                response = requests.post('https://api.mailsparky.com/v1/contacts', json={
                    'email': line[EMAIL_INDEX].strip(),
                    'subscribed': True,
                }, headers={
                    'Authorization': 'Bearer YOUR SECRET KEY'
                })
                response.raise_for_status()
                print(response.json())
                success = True
            except requests.exceptions.RequestException as e:
                print(f"Request failed: {e}")
                retries -= 1
                if retries > 0:
                    sleep(1)
                else:
                    print("Failed after 3 retries, continuing to next line.")

Cần hỗ trợ

Nếu bạn cần hỗ trợ, hãy liên hệ chúng tôi theo email này support@mailsparky.com.

Gửi cho chúng tôi file CSV and public key, Chúng tôi sẽ giúp bạn import danh bạ.