Thêm khách vào tệp đối tượng tùy chỉnh

  • Thêm khách hàng vào tệp đối tượng tùy chỉnh.

Request

  • Chú ý:

    • dataType hỗ trợ 2 loại dữ liệu là raw hoặc hash (dùng hàm hash("sha256", "text")). VD bạn có 2 số điện thoại là 0987654321

      • raw: 0987654321

      • hash: f9dd5cfd005ea36d8db32ecfb6867c9a22a8e3d7c95e14abcee629e155ebc2b2

    • Mảng audienceData hỗ trợ tối đa 1000 khách hàng.

    • Một khách hàng có thể gửi tối đa 3 số điện thoại và 3 email, bắt buộc phải có tối thiểu 1 số điện thoại hoặc 1 email. VD:

# VD chỉ có số điện thoại
"audienceData": [
  {
    "phone": "0987654321",
  },
  {
    "phone": "0987654322",
  }
]

# VD chỉ có enmail
"audienceData": [
  {
    "email": "[email protected]"
  },
  {
    "email": "[email protected]"
  }
]

# VD nhiều số điện thoại, nhiều email
"audienceData": [
  {
    "phone": "0987654321",
    "phone_2": "0987654329",
    "phone_3": "0987654328",
    "email": "[email protected]",
    "email_2": "[email protected]"
  }
]

dataType raw

curl --location 'https://vpage.open.nhanh.vn/v3.0/marketing/customaudienceaddsubscriber?appId={{appId}}&businessId={{businessId}}' \
--header 'Authorization: {{accessToken}}' \
--header 'Content-Type: application/json' \
--data '{
    "audienceId": "{{audienceId}}",
    "dataType": "raw",
    "audienceData": [
        {
          "phone": "0987654321",
          "phone_2": "0987654329",
          "phone_3": "0987654328",
          "email": "[email protected]",
          "email_2": "[email protected]"
        },
        {
          "phone": "0987654322",
          "email": "[email protected]",
          "email_2": "[email protected]",
          "email_3": "[email protected]"
        }
    ]
}'

dataType hash

  • Chú ý:

    • Email cần convert sang lower case trước khi hash.

    • Phone cần convert về dạng có mã quốc gia phía trước, bỏ hết các ký tự đặc biệt, dấu cách, số 0 ở đầu đi. VD số 0987654321 ở Vietnam (+84), cần chuyển thành 84987654321 trước khi hash.

curl --location 'https://vpage.open.nhanh.vn/v3.0/marketing/customaudienceaddsubscriber?appId={{appId}}&businessId={{businessId}}' \
--header 'Authorization: {{accessToken}}' \
--header 'Content-Type: application/json' \
--data '{
    "audienceId": "{{audienceId}}",
    "dataType": "hash",
    "audienceData": [
        {
          "phone": "17756315ebd47b7110359fc7b168179bf6f2df3646fcc888bc8aa05c78b38ac1",
          "phone_2": "f9dd5cfd005ea36d8db32ecfb6867c9a22a8e3d7c95e14abcee629e155ebc2b2",
          "phone_3": "bc73d47c6459288d514cc759d417a43a8f3981d1a150dad3b4ab4de0199eac5d",
          "email": "5aa0c39831f6953a69ffd9a275969a563bb4be9900e3ee8e0e34501b37778d27",
          "email_2": "e01c2ae5208665cf7cc8e4bc270a1dcbfdcce629a1ffce1acbb2e4cf6873d6ec"
        },
        {
          "phone": "d88a8cfc6a4483536de276fc6c0b9b906ed26425ca26d6e8dbea33be769f1ac6",
          "email": "c1822e15467e69822503ed226df5b565aeb36005b672b357ee32fc2ee18173b6",
          "email_2": "4af0a859010eca3ea17561a9ed607f873d927767079fa788a09274cdaa9a1c96",
          "email_3": "59d1ecd2696d9b301d78136238014d8a6e4357768daec8569080116b807b3c46"
        }
    ]
}'

Response

Failed response

Successful response

{
  "code": 1,
  "data": [
    {
      "num_received": "(number) số khách hàng đã upload thành công",
    }
  ]
}

Last updated