API Reference

Tài liệu Pancake API

List pages

GET https://pages.fm/api/v1/pages

Danh sách trang

Query Parameters

NameTypeDescription

access_token*

String

Chuỗi token pancake của người dùng. Bạn có thể truy cập link dưới đây sau đó click vào ADVANCE để lấy token này https://pages.fm/account

Conversations

GET https://pages.fm/api/public_api/v1/pages/[:page_id]/conversations

Danh sách cuộc trò truyện

Query Parameters

NameTypeDescription

page_access_token*

string

Chuỗi token của page (Khách hàng có thể tạo ở mục cài đặt công cụ)

until*

timestamp

Thời gian kết thúc(dạng unix in seconds).

Khoảng thời gian bé hơn bằng 1 tháng

since*

timestamp

Thời gian bắt đầu(dạng unix in seconds)

page_id*

string

ID trang của khách hàng

page_number*

number

Trang hiện tại(nhỏ nhất 1)

order_by

String

Sắp xếp hội thoại (mặc định inserted_at) : inserted_at: thời gian tạo hội thoại

updated_at: thời gian cập nhật hội thoại

tags

String

Danh sách ID các thẻ cần lọc Ví dụ: 1,2,3,4

(Danh sách thẻ)

{
  "conversations": [{
      "page_id": "wa_c.us@84328290781",
      "customer_id": "72bea3ea-722a-4e33-b415-2b2281f44724",
      "assignee_histories": [{
          "conversation_id": "wa_84328290781@c.us_62818166016@c.us",
          "inserted_at": "2021-08-26T06:29:56",
          "payload": {
              "added_users": [{
                  "email": "phamdongtx@gmail.com",
                  "fb_id": "1831989023699268",
                  "id": "82be33ea-729a-4e83-be15-2b7c83f34724",
                  "name": "Pham Dong"
              }],
              "deleted_users": []
          }
      }],
      "type": "INBOX",
      "inserted_at": "2021-08-26T06:29:56",
      "tags": [],
      "recent_phone_numbers": [],
      "customers": [{
          "avatar_url": "84328290781@c.us_1621224114",
          "fb_id": "wa_c.us@62818166016",
          "id": "d8526c77-832a-425c-8aee-e5d7dfcd7cd0",
          "name": "Babywearit (+62 81 816 6016)"
      }],
      "has_phone": false,
      "tag_histories": [],
      "post_id": null,
      "id": "wa_84328290781@c.us_62818166016@c.us",
      "last_sent_by": {
          "avatar_url": "84328290781@c.us_1621224114",
          "id": "wa_c.us@62818166016",
          "name": "Babywearit (+62 81 816 6016)",
          "phone_number": "62818166016"
      },
  }],
  "success": true,
  "total": 1
}

Chú thích
    "conversations": Danh sách hội thoại
        Chi tiết hội thoại:
            "page_id": id trang
            "customer_id": id khách hàng 
            "assignee_histories": Lịch sử phân công hội thoại
            "type": Kiểu hội thoại(INBOX, COMMENT, RATING)
            "inserted_at": Thời  tạo hội thoại
            "tags": Tag hiện tại được gắn
            "recent_phone_numbers": Số điện thoại của hội thoại
            "customers": Thông tin khách hàng
            "has_phone": Có số điện thoại hay không
            "tag_histories": Lịch sử gắn gỡ tag
            "post_id": ID bài post nếu là comment
            "last_sent_by": Người gửi tin nhắn
            "current_assign_users": Danh sách phần công thời điểm hiện tại
            "ad_ids": Danh sách ad_id
    "total": Tổng số hội 

Tag conversation

POST https://pages.fm/api/public_api/v1/pages/[:page_id]/conversations/[:conversation_id]/tags

Thêm gỡ thẻ hội

Path Parameters

NameTypeDescription

page_id*

String

ID trang của khách hàng

page_access_token*

String

Chuỗi token của page (Khách hàng có thể tạo ở mục cài đặt công cụ)

conversation_id*

String

ID của hội thoại lấy từ api danh sách hội th

Request Body

NameTypeDescription

action*

String

Hành động (add: thêm thẻ, remove: gỡ thẻ)

tag_id*

String

ID của thẻ lấy từ api list

{
  "data": [  // Danh sách thẻ hiện sau khi update
    0,
    1,
    2,
    4,
    5
  ],
  "success": true, 
  "timestamp": 1652845231603964 // Thời điểm thao tác 
}

Conversation assignment

GET https://pages.fm/api/public_api/v1/pages/[:page_id]/conversations/[:conversation_id]/assign

Phân công nhân viên vào hội thoại

Query Parameters

NameTypeDescription

page_id*

String

ID trang của khách hàng

conversation_id*

String

page_access_token*

String

Chuỗi token của page (Khách hàng có thể tạo ở mục cài đặt công cụ)

Request Body

NameTypeDescription

assignee_ids*

Array

Danh sách id của nhân viên được phân công vào hội thoại vui lòng xem tại API danh sách người dùng

{
  "assignee_group_id": "2",
  "assignee_ids": [
    "3fadfd70-1ead-4a16-a456-1fa007e38e5c",
    "6aa49b8e-c554-44e4-81ba-c50a2d5b51b3",
    "28f4673e-14f2-4556-840d-7aae58e9b8ed"
  ],
  "customers": [
    {
      "fb_id": "2810250135746666",
      "id": "03996852-8fa6-4ae9-b2d0-d95bd67d9d8e",
      "name": "Quyết Nguyễn"
    }
  ],
  "from": {
    "email": "2810250135746666@facebook.com",
    "id": "2810250135746666",
    "name": "Quyết Nguyễn"
  },
  "from_psid": "2810250135746666",
  "has_phone": true,
  "id": "110699180573884_2810250135746666",
  "inserted_at": "2020-07-11T09:02:30",
  "is_combined": false,
  "is_removed": false,
  "last_customer_interactive_at": "2023-04-05T02:21:57",
  "last_sent_by": {
    "admin_id": "570423649807405",
    "admin_name": "Quyết Nguyễn",
    "id": "110699180573884",
    "name": "MemeViet"
  },
  "message_count": 584,
  "page_id": "110699180573884",
  "post_id": null,
  "read_watermarks": [
    {
      "message_id": "m_ffBfntulf9g2vp6pR7YwsKeDRTqVhl7NbvRZnivNqM6Ne5MDNuQ0joWh0hV_vkZpeR3ufBRiwFcHlvl-Ru4csg",
      "psid": "2810250135746666",
      "watermark": 1680661734
    }
  ],
  "recent_phone_numbers": [
    {
      "captured": "0328290781",
      "length": 10,
      "m_content": "0328290781",
      "m_id": "m_8RFElPVHVrjAQU6873W5NqeDRTqVhl7NbvRZnivNqM7Pix1jcT6D8wAqt-Iz4hQrd00MZ5wSSCbA_nJ2GXKOEQ",
      "offset": 0,
      "phone_number": "0328290781",
      "status": 1
    },
    {
      "captured": "0812997207",
      "length": 10,
      "m_content": "0812997207",
      "m_id": "m_dLjh8RpYYE0ArTATcXnsuKeDRTqVhl7NbvRZnivNqM5XGk23-yiMFXeRa-Cxb786YiyNbIQVNnSB9Y6Ou0OsRw",
      "offset": 0,
      "phone_number": "0812997207",
      "status": 0
    },
    {
      "captured": "0328290798",
      "length": 10,
      "m_content": "0328290798",
      "m_id": "m_4-wlt-8bPT8zXzsJlf-U26eDRTqVhl7NbvRZnivNqM66wsnYisL2VAL-yJOv5hrQf5K9dIbKA84Jf4ZcaVghpA",
      "offset": 0,
      "phone_number": "0328290798",
      "status": 0
    },
    {
      "captured": "0328290799",
      "length": 10,
      "m_content": "0328290799",
      "m_id": "m_WmdnGmAIuYBVRREPw82Sr6eDRTqVhl7NbvRZnivNqM5_PmAyAZ-qAQjuyF_CKt76PA6MNbDbp663uf3LQfSAcg",
      "offset": 0,
      "phone_number": "0328290799",
      "status": 2
    },
    {
      "captured": "0328290781",
      "length": 10,
      "m_content": "0328290781",
      "m_id": "m_GnlF3xzsH_I9UKSttrEeRqeDRTqVhl7NbvRZnivNqM4Qh9eoZuPTPCPRSutyxWHyF85M5gEeHW2c0yfpl5FsHA",
      "offset": 0,
      "phone_number": "0328290781",
      "status": 1
    }
  ],
  "recent_seen_users": [
    {
      "fb_id": "570423649807405",
      "fb_name": "Quyết Nguyễn",
      "seen_at": "2023-04-05T02:22:06.689494"
    }
  ],
  "seen": true,
  "snippet": "[Photo]",
  "success": true,
  "tags": [
    -99,
    1,
    26,
    28,
    29,
    30,
    31,
    32,
    35,
    36,
    39,
    40,
    41,
    42,
    43,
    44,
    45
  ],
  "thread_id": "159952432315225",
  "thread_key": "t_1495217373994690",
  "type": "INBOX",
  "unread_count": 0,
  "updated_at": "2023-04-06T04:31:45"
}

Mark read / unread conversation

Đánh dấu hội thoại thành đã đọc hoặc chưa đọc.

Mark read

POST https://pages.fm/api/public_api/v1/pages/[:page_id]/conversations/[:conversation_id]/read?page_access_token=[:page_access_token]

Mark unread

POST https://pages.fm/api/public_api/v1/pages/[:page_id]/conversations/[:conversation_id]/unread?page_access_token=[:page_access_token]

Query Parameters

NameTypeDescription

page_id*

string

ID của trang

conversation_id*

string

ID của hội thoại

page_access_token*

string

Chuỗi token của page (Khách hàng có thể tạo ở mục cài đặt công cụ)

Response

{"success": true}

Get messages

GET https://pages.fm/api/public_api/v1/pages/[:page_id]/conversations/[:conversation_id]/messages

Danh sách tin nhắn

Query Parameters

NameTypeDescription

current_count

number

Dùng để đánh index vị trí muốn lấy tin nhắn - Khi gọi API không truyền current_count hệ thống sẽ trả về 20 tin nhắn mới nhất. - Tiếp tục khi truyền tham số current_count là 20 hệ thống sẽ trả về 25 tin nhắn cũ hơn từ vị trí thứ 20 - Lưu ý: khi không truyền current_count sẽ trả về 20 tin nhắn, có current_count sẽ trả về 25 tin nhắn

page_access_token*

string

Chuỗi token của page (Khách hàng có thể tạo ở mục cài đặt công cụ)

customer_id*

string

ID của khách hàng(Lấy từ api get conversation)

conversation_id*

string

ID hội thoại của bạn muốn lấy tin nhắn(Lấy từ api get conversation)

page_id*

string

ID trang của bạn muốn lấy dữ

{
  "messages": [
    {
      "attachments": [], // Media của tin nhắn
      "conversation_id": "256469571178082_3100878013328342", // ID hội thoại
      "from": { // Thông tin khách hàng
        "email": "3100878013328342@facebook.com",
        "id": "3100878013328342",
        "name": "Quyết Nguyễn"
      },
      "has_phone": false, // Có chứa số điện thoại không
      "id": "m_Ec_f7RJrKyJlRKXVdEYW5gWswhac17zNH0kIRGkMGhuBkqMkamKpUyJSpemXfRB0kULuVY8WA-ATEthHwher9g", // ID tin nhắn
      "inserted_at": "2023-12-26T08:44:29.000000", // Thời gian tạo tin nhắn
      "is_hidden": false, // Đã ẩn hay chưa chỉ dùng cho comment
      "is_livestream_order": null, 
      "is_parent": false, // Có phải comment cha không chỉ dùng cho comment
      "is_parent_hidden": false, // Comment cha đã bị ẩn chưa chỉ dùng cho comment
      "is_removed": false, // Đã bị xoá chưa
      "like_count": null, // Số lượt like chỉ dùng cho comment
      "message": "asda", // Nội dung tin nhắn
      "page_id": "256469571178082", // ID của trang
      "phone_info": [], // Thông tin số điện thoại có trong tin nhắn
      "type": "INBOX", // Loại tin nhắn [INBOX, COMMEMNT, RATING]
    }
  ],
  "success": true
}

Ads statistics

GET https://pages.fm/api/public_api/v1/pages/[:page_id]/statistics/pages_campaigns

Thống kê quảng cáo(bạn cần đăng nhập tài khoản có quyền xem báo cáo quảng cáo ở facebook và chọn page bạn muốn lấy thống kê trước khi gọi api)

Query Parameters

NameTypeDescription

page_id*

String

ID trang của bạn

page_access_token*

String

Chuỗi token của page (Khách hàng có thể tạo ở mục cài đặt công cụ)

since*

timestamp

Thời gian bắt đầu(dạng unix in seconds)

until*

timestamp

Thời gian kết thúc (dạng unix in seconds)

[
    {
        "account_id": "11112430409201147",
        "ad_id": "2384887411112310288",
        "adset_id": "2312324572270288",
        "budget_remaining": "3000",
        "cpc": null,
        "cpm": null,
        "ctr": null,
        "currency": "USD",
        "daily_budget": "3000",
        "impressions": null,
        "lifetime_budget": "0",
        "link_click": null,
        "messaging_conversation_started_7d": null,
        "messaging_first_reply": null,
        "name": "QC FB thúc đẩy doanh thu",
        "post_comments": null,
        "purchase_roas": null,
        "purchases": null,
        "purchases_conversion_value": null,
        "reach": null,
        "spend": null,
        "status": "PAUSED"
    }
]

Engagement statistics

GET https://pages.fm/api/public_api/v1/pages/[:page_id]/statistics/customer_engagements

Thống kê tương tác

Query Parameters

NameTypeDescription

by_hour

boolean

Thống kê theo giờ

date_range*

string

Khoảng thời gian thống kê (ví dụ: 27/07/2021 00:00:00 - 26/08/2021 23:59:59)

page_access_token*

string

Chuỗi token của page (Khách hàng có thể tạo ở mục cài đặt công cụ)

user_ids

String

Danh sách id nhân viên cần lọc phân tách nhau bằng dấu ,. Xem ở api https://docs.pancake.vn/developers/api-reference#user-list

{
    "data": {
        "categories": ["26/8", "25/8", "24/8", "23/8", "22/8", "21/8", "20/8", "19/8", "18/8", "17/8", "16/8", "15/8", "14/8", "13/8", "12/8", "11/8", "10/8", "9/8", "8/8", "7/8", "6/8", "5/8", "4/8", "3/8", "2/8", "1/8", "31/7", "30/7", "29/7", "28/7", "27/7"],
        "series": [{
            "data": [0, 0, 2, 1, 0, 0, 1, 2, 2, 0, 3, 0, 3, 2, 0, 0, 6, 2, 0, 0, 0, 2, 1, 0, 0, 0, 0, 6, 1, 3, 1],
            "name": "inbox"
        }, {
            "data": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            "name": "comment"
        }, {
            "data": [0, 0, 2, 1, 0, 0, 1, 2, 2, 0, 3, 0, 3, 2, 0, 0, 6, 2, 0, 0, 0, 2, 1, 0, 0, 0, 0, 6, 1, 3, 1],
            "name": "total"
        }, {
            "data": [0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 1],
            "name": "new_customer_replied"
        }, {
            "data": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            "name": "customer_engagement_new_inbox"
        }]
    },
    "success": true
}

Chú thích:

    categories: danh sách ngày thống
    series: Dữ liệu thống kê
    series.data: Dữ liệu thống kê theo ngày tương ứng với danh sách categories
    series.name: Kiểu thống kê
        "inbox": Tương tác tin nhắn
        "comment": Tương tác comment
        "total": Tổng tương tác tin nhắn và 
        "new_customer_replied": Tương tác khách hàng 
        "customer_engagement_new_inbox": Hội thoại khách hàng 
        
        

by_hour:        
        
{
    "statistics": [{
        "comment": 0,
        "hour": "2021-08-26T13:00:00",
        "inbox": 1,
        "new_customer": 0,
        "new_customer_from_inbox": 0,
        "total": 1
    }, {
        "comment": 0,
        "hour": "2021-08-26T10:00:00",
        "inbox": 1,
        "new_customer": 0,
        "new_customer_from_inbox": 0,
        "total": 1
    }],
    "success": true
}

Page statistics

GET https://pages.fm/api/public_api/v1/pages/[:page_id]/statistics/pages

Query Parameters

NameTypeDescription

page_id*

String

ID trang của bạn

page_access_token*

String

Chuỗi token của page (Khách hàng có thể tạo ở mục cài đặt công cụ)

since*

timestamp

Thời gian bắt đầu(dạng unix in seconds)

until*

timestamp

Thời gian kết thúc (dạng unix in seconds)

{
    // Response
}

Tag statistics

GET https://pages.fm/api/public_api/v1/pages/[:page_id]/statistics/tags

Thống kê thẻ hội thoại

Query Parameters

NameTypeDescription

page_id*

String

ID trang của bạn

page_access_token*

String

Chuỗi token của page (Khách hàng có thể tạo ở mục cài đặt công cụ)

since*

timestamp

Thời gian bắt đầu(dạng unix in seconds)

until*

timestamp

Thời gian kết (dạng unix in seconds)

{
    // Response
}

Users statatistics

GET https://pages.fm/api/public_api/v1/pages/[:page_id]/statistics/users

Thống kê nhân viên

Query Parameters

NameTypeDescription

page_access_token*

string

Chuỗi token của page (Khách hàng có thể tạo ở mục cài đặt công cụ)

date_range*

string

Khoảng thời gian thống kê (ví dụ: 27/07/2021 00:00:00 - 26/08/2021 23:59:59)

{
    "data": {
        "statistics": {
            "c5a50cce-fb0a-4eb3-892a-74ad182f7c03": [{
                "average_response_time": 3376234,
                "comment_count": 0,
                "hour": "2021-07-27T09:00:00",
                "inbox_count": 2,
                "phone_number_count": 0,
                "private_reply_count": 0,
                "unique_comment_count": 0,
                "unique_inbox_count": 1
            }, {
                "average_response_time": 74276,
                "comment_count": 0,
                "hour": "2021-07-28T10:00:00",
                "inbox_count": 6,
                "phone_number_count": 0,
                "private_reply_count": 0,
                "unique_comment_count": 0,
                "unique_inbox_count": 2
            }]
        },
        "users": {
            "c5a50cce-fb0a-4eb3-892a-74ad182f7c03": {
                "average_response_time": 588569,
                "comment_count": 0,
                "hour": "2021-08-26T13:00:00",
                "inbox_count": 637,
                "phone_number_count": 0,
                "private_reply_count": 0,
                "unique_comment_count": 0,
                "unique_inbox_count": 30,
                "user_fb_id": "570423649807405",
                "user_name": "Quyết Nguyễn"
            }
        }
    },
    "success": true
}

Chú thích:
    "statistics": Thống kê theo thời gian
    "users": Thống kê theo nhân viên
    "average_response_time": Thời gian phản hổi trung
    "comment_count": Tổng số bình luận thực 
    "inbox_count": Tổng số tin nhắn thực 
    "phone_number_count": Tổng số điện thoại
    "private_reply_count": "Hành động gửi tin nhắn từ bình luận",
    "unique_comment_count": Phản hồi cho mỗi bình luận của khách hàng (Thường bằng số bình luận của khách hàng)
    "unique_inbox_count": Phản hồi cho mỗi tin nhắn của khách hàng (Thường bằng số lượng tin nhắn của khách hàng)
    "hour": Thời gian thống kê
    "user_name": Tên nhân viên
    "user_fb_id": facebook id của nhân 

Users statatistics multiple pages

GET https://pages.fm/api/v1/statistics/user

Thống kê nhân viên chế độ gộp

Query Parameters

NameTypeDescription

access_token*

String

Chuỗi token pancake của người dùng. Bạn có thể truy cập link dưới đây sau đó click vào ADVANCE để lấy token này https://pages.fm/account

page_ids*

String

Danh sách ID trang cần thống kê ví dụ: page_id1,page_id2,...

date_range*

String

Khoảng thời gian cần thống kê ví dụ: 05/08/2022 00:00:00 - 06/08/2022 23:59:59

{
  "statistics": { #Thống kê theo thời gian
    "2138b20a-6745-4fe2-91b2-f75e6c43b7b0": [
      {
        "average_response_time": 10, #Thời gian phản hổi trung bình
        "comment_count": 0, #Số comment đã trả lời
        "hour": "2022-07-05T01:00:00",  #Thời gian
        "inbox_count": 1, #Số tin nhắn đã trả lời
        "order_count": 0, #Số đơn hàng đã chốt
        "phone_number_count": 0, #Số điện thoại mang về
        "private_reply_count": 0, #Số tin nhắn từ bình luận
        "unique_comment_count": 0, #Số phiên trả lời bình luận
        "unique_inbox_count": 1 #Số phiên trả lời tin nhắn 
      }
    ],
    "3fadfd70-1ead-4a16-a456-1fa007e38e5c": [
      {
        "average_response_time": 0,
        "comment_count": 0,
        "hour": "2022-07-05T12:00:00",
        "inbox_count": 0,
        "order_count": 0,
        "phone_number_count": 1,
        "private_reply_count": 0,
        "unique_comment_count": 0,
        "unique_inbox_count": 0
      }
    ],
    "6350389d-7bd6-4e3f-8a0b-a370d76f63fd": [
      {
        "average_response_time": 34389,
        "comment_count": 0,
        "hour": "2022-07-05T12:00:00",
        "inbox_count": 10,
        "order_count": 0,
        "phone_number_count": 0,
        "private_reply_count": 0,
        "unique_comment_count": 0,
        "unique_inbox_count": 1
      },
      {
        "average_response_time": 0,
        "comment_count": 0,
        "hour": "2022-07-07T09:00:00",
        "inbox_count": 0,
        "order_count": 0,
        "phone_number_count": 1,
        "private_reply_count": 0,
        "unique_comment_count": 0,
        "unique_inbox_count": 0
      }
    ]
  },
  "users": {  #Thống kê theo nhân viên
    "2138b20a-6745-4fe2-91b2-f75e6c43b7b0": {
      "average_response_time": 10,
      "comment_count": 0,
      "hour": "2022-07-05T01:00:00",
      "inbox_count": 1,
      "order_count": 0,
      "phone_number_count": 0,
      "private_reply_count": 0,
      "unique_comment_count": 0,
      "unique_inbox_count": 1,
      "user_fb_id": "1079158022137261",
      "user_name": "Khoa 12 12 tv1234567.1"
    },
    "3fadfd70-1ead-4a16-a456-1fa007e38e5c": {
      "average_response_time": 0,
      "comment_count": 0,
      "hour": "2022-07-05T12:00:00",
      "inbox_count": 0,
      "order_count": 0,
      "phone_number_count": 1,
      "private_reply_count": 0,
      "unique_comment_count": 0,
      "unique_inbox_count": 0,
      "user_fb_id": "2378637269074943",
      "user_name": "Duc Nguyen"
    },
    "6350389d-7bd6-4e3f-8a0b-a370d76f63fd": {
      "average_response_time": 34389,
      "comment_count": 0,
      "hour": "2022-07-07T09:00:00",
      "inbox_count": 10,
      "order_count": 0,
      "phone_number_count": 1,
      "private_reply_count": 0,
      "unique_comment_count": 0,
      "unique_inbox_count": 1,
      "user_fb_id": "1751542581753690",
      "user_name": "Bùi Văn Long"
    }
  }
}

New customer statistics

GET https://pages.fm/api/public_api/v1/pages/[:page_id]/statistics/customers

Thống kê khách hàng mới theo thời gian

Path Parameters

NameTypeDescription

group_by

string

Tuỳ chọn phương thức nhóm dữ liệu. Truyền vào một trong các string sau: - day (default): Trả về dữ liệu theo ngày - hour : Trả về dữ liệu theo giờ - page_id : Trả về dữ liệu theo các trang

page_access_token*

string

Chuỗi token của page(Khách hàng có thể tạo ở mục cài đặt công cụ)

date_range*

string

Khoảng thời gian cần thống kê ví dụ: 20/07/2020 - 20/08/2020

page_id*

string

ID trang của khách hàng

no group_by
{
    "data":[
        {"date":"2020-08-27","new_customer_count":0,"new_page_inbox_count":1,"new_phone_number_count":0,"phone_number_count":0},
        {"date":"2020-08-24","new_customer_count":0,"new_page_inbox_count":2,"new_phone_number_count":0,"phone_number_count":0},
        {"date":"2020-08-12","new_customer_count":4,"new_page_inbox_count":3,"new_phone_number_count":0,"phone_number_count":0}
    ],
    "success":true
}

group_by: page_id
{
    "data": {
        "103205717747769": [
            {"date":"2020-08-12","new_customer_count":0,"new_page_inbox_count":1,"new_phone_number_count":0,"phone_number_count":0}
        ],
        "110699180573884":[
            {"date":"2020-08-27","new_customer_count":0,"new_page_inbox_count":2,"new_phone_number_count":0,"phone_number_count":0}
        ]
    },
    "success":true
}

group_by: hour
{
    "data":[
        {"date":"2020-08-12T16:00:00","new_customer_count":0,"new_page_inbox_count":1,"new_phone_number_count":0,"phone_number_count":0},
        {"date":"2020-08-12T17:00:00","new_customer_count":0,"new_page_inbox_count":2,"new_phone_number_count":0,"phone_number_count":0},
        {"date":"2020-08-12T18:00:00","new_customer_count":4,"new_page_inbox_count":3,"new_phone_number_count":0,"phone_number_count":0}
    ],
    "success":true
}

Page customers

GET https://pages.fm/api/public_api/v1/pages/[:page_id]/page_customers

Thông tin khách hàng

Query Parameters

NameTypeDescription

page_id*

String

ID trang của khách hàng

page_access_token*

String

Chuỗi token của page(Khách hàng có thể tạo ở mục cài đặt công cụ)

since*

timestamp

Thời gian bắt đầu(dạng unix in seconds)

until*

timestamp

Thời gian bắt đầu(dạng unix in seconds)

page_number*

number

Trang hiện tại(nhỏ nhất 1)

page_size

number

Độ lớn của trang(tối đa 100)

{
    "total": 500,
    "customers": [{
        "birthday": null,
        "gender": null,
        "inserted_at": "2021-06-07T11:11:16",
        "name": "Tạ Tuấn Vũ",
        "phone_numbers": [],
        "psid": "3296946846995244",
        "notes": [{
          "created_at": 1665981253137,
          "created_by": {
            "fb_id": "108877101230501",
            "fb_name": "Dat Phung",
            "uid": "efcd17d6-b4ff-4f6d-bf09-583db63a7bba"
          },
          "edit_history": [],
          "id": "803c638a-2767-43d6-9892-2f06c43cb1df",
          "images": [],
          "links": [],
          "message": "note 1",
          "order_id": "983902035",
          "removed_at": null,
          "updated_at": null
        }]
    }, {
        "birthday": null,
        "gender": "male",
        "inserted_at": "2021-06-07T11:11:09",
        "lives_in": "Hà Nội",
        "name": "Quyết Nguyễn",
        "phone_numbers": [],
        "psid": "2810250135746666",
        "notes": []
    }, {
        "birthday": null,
        "gender": null,
        "inserted_at": "2021-03-27T16:55:33",
        "lives_in": "Hà Nội",
        "name": "Quyết Nguyễn",
        "phone_numbers": [],
        "psid": "1472648309584930",
        "notes": []
    }],
    "success": true
}

Call logs

GET https://pages.fm/api/public_api/v1/pages/[:page_id]/sip_call_logs

Danh sách cuộc gọi

Path Parameters

NameTypeDescription

id*

String

ID gói cước tổng đài

page_access_token*

String

Chuỗi token của page(Khách hàng có thể tạo ở mục cài đặt công cụ)

page_number*

Number

Trang hiện tại(nhỏ nhất 1)

page_size*

Number

Độ dài của trang(ln nhất 30)

since

timestamp

Thời gian bắt đầu(dạng unix in seconds)

until

timestamp

Thời gian kết thúc(dạng unix in seconds)

page_id*

Number

ID trang của

{
    "call_logs": [{
        "answered_time": null, #Thời gian  
        "client_hangup": false,
        "client_type": "pos",
        "created_time": "2022-03-31T04:03:34", #Thời gian thực  
        "direction": "outbound",
        "employee_name": "Hưởng Ngô(670751739744664)", # Nhân viên thực hiện 
        "hangup_time": "2022-03-31T04:03:41",
        "phone_number": "0899293662", #Số điện  
        "record_file": null, #File ghi 
        "type": "hangup" #Loại cuộc 
    }, {
        "answered_time": null,
        "client_hangup": false,
        "client_type": "pos",
        "created_time": "2022-03-29T16:43:55",
        "direction": "outbound",
        "employee_name": "Hưởng Ngô(670751739744664)",
        "hangup_time": "2022-03-29T16:44:05",
        "phone_number": "0985215395",
        "record_file": null,
        "type": "hangup"
    }],
    "success": true
}

List tags

GET https://pages.fm/api/public_api/v1/pages/[:page_id]/tags

Danh sách thẻ của trang

Query Parameters

NameTypeDescription

page_id*

String

ID trang của khách hàng

page_access_token*

String

Chuỗi token của page(Khách hàng có thể tạo ở mục cài đặt công cụ)

{
  "tags": [
    {
      "color": "#4b5577",
      "id": 0,
      "lighten_color": "#c9ccd6",
      "text": "Kiểm hàng"
    },
    {
      "color": "#822ba1",
      "id": 1,
      "lighten_color": "#d9bfe2",
      "text": "Câu hỏi"
    },
    {
      "color": "#0d5aff",
      "id": 2,
      "lighten_color": "#b6cdff",
      "text": "Mua hàng"
    },
    {
      "color": "#009344",
      "id": 3,
      "lighten_color": "#b2dec6",
      "text": "Đã gửi"
    },
    {
      "color": "#38a6f4",
      "id": 4,
      "lighten_color": "#c3e4fb",
      "text": "Hết hàng"
    },
    {
      "color": "#bd2727",
      "id": 5,
      "lighten_color": "#ebbebe",
      "text": "Trả hàng"
    }
  ]
}

Posts

GET https://pages.fm/api/public_api/v1/pages/[:page_id]/posts

Query Parameters

NameTypeDescription

page_id*

String

ID trang của khách hàng

since*

timestamp

Thời gian bắt đầu (dạng unix in seconds)

until*

timestamp

Thời gian kết thúc (dạng unix in seconds)

page_number*

Number

Trang hiện tại(nhỏ nhất 1)

page_size*

Number

Độ dài của trang(lớn nhất 30)

page_access_token

String

Chuỗi token của page(Khách hàng có thể tạo ở mục cài đặt công cụ)

{
  "success": true,
  "posts": [
    {
      "admin_creator": null,
      "attachments": null,
      "comment_count": 0,
      "delete_comment": false,
      "from": {
        "id": "5460527857372996",
        "name": "Djamel Belkessa"
      },
      "hide_comment": null,
      "id": "256469571178082_1719461745119729",
      "ignore_comment": false,
      "inserted_at": "2022-08-22T03:09:27",
      "is_removed": false,
      "like_count": 0,
      "link": null,
      "live_video_status": null,
      "message": "edit review là 1 nghệ thuật",
      "page_id": "256469571178082",
      "phone_number_count": 0,
      "privacy": null,
      "status_type": "rating",
      "story": null,
      "type": "rating"
    }
  ],
  "total": 200
}

User list

GET https://pages.fm/api/public_api/v1/pages/[:page_id]/users

Danh sách người dùng của trang

Query Parameters

NameTypeDescription

page_id*

String

ID trang của khách hàng

page_access_token

String

Chuỗi token của page(Khách hàng có thể tạo ở mục cài đặt công cụ)

{
  "success": true,
  "users": [
    {
      "email": null,
      "id": "3740ef68-cd6c-45f9-96c3-94d3f2665f87",
      "name": "Dinh Kaito"
    },
    {
      "email": "purification1997@gmail.com",
      "id": "ed6264a7-882b-42f6-8ace-ae617cd60b0d",
      "name": "Đức Nguyễn"
    },
    {
      "email": "ntq97thhust@gmail.com",
      "id": "f13655aa-a748-4ace-aacf-f2443581865c",
      "name": "Quyết Nguyễn"
    },
    {
      "email": "kaidodinh@gmail.com",
      "id": "1443760a-bb76-4666-9175-bd492801d506",
      "name": "Dinh Kaito"
    }
  ]
}

Send private reply

POST https://pages.fm/api/v1pages/[:page_id]/conversations/[:conversation_id]/messages

Dùng để gửi tin nhắn từ bình luận Gửi tin nhắn từ bình luận chỉ gửi được một lần duy nhất cho một comment. Theo quy định của Facebook chỉ gửi được tin nhắn cho bình luận được tạo không quá 7 ngày.

Query Parameters

NameTypeDescription

access_token*

string

Chuỗi token pancake của người dùng. Bạn có thể truy cập link dưới đây sau đó click vào ADVANCE để lấy token này https://pages.fm/account

Headers

NameTypeDescription

page_id*

string

ID trang của bạn

conversation_id*

string

ID hội thoại chứa bình luận

Request Body

NameTypeDescription

post_id*

string

ID bài viết chứa bình luận đó

message_id

string

ID bình luận mà bạn muốn gửi tin nhắn từ bình luận đó

action*

string

Để gửi tin nhắn từ bình luận cần đặt giá trị private_replies

message*

string

Nội dung trả lời

{
    "id": "m_5js02va40Z7Z5wUp2aPdbdmaxJ0QidmArUGPAjhej4U3LfA7WGMI62EL5qtJE_1FRXMtVlbDLd9dmmaIR5-ZAw",
    "success": true
}

Send inbox

POST https://pages.fm/api/v1/pages/[:page_id]/conversations/[:conversation_id]/messages

Gửi tin nhắn tới khách hàng

Query Parameters

NameTypeDescription

access_token*

string

Chuỗi token pancake của người dùng. Bạn có thể truy cập link dưới đây sau đó click vào ADVANCE để lấy token này https://pages.fm/account

Headers

NameTypeDescription

page_id*

string

ID trang của bạn

conversation_id*

string

ID hội thoại

Request Body

NameTypeDescription

name

string

Tên của file

mime_type

string

mime_type của file muốn gửi(image,...)

content_url

string

Đường dẫn của hình ảnh(file) muốn gửi (https://i.ibb.co/mzh7ck8/alaska-beo-acef3fcb1cc541a79048f4bbafed71c8-grande.png)

attachmentType

string

Kiểu dữ liệu của attachment muốn gửi (PHOTO, DOCUMENT)

action*

string

Để gửi tin nhắn cần đặt giá trị reply_inbox

message

string

Nội dung tin nhắn

thread_key

string

key của hội thoại muốn gửi tin nhắn

{
    "id":"m_kigIWuq85mIn7ijgUznKbdmaxJ0QidmArUGPAjhej4VUI3t48g39Ixhgpz3QTulmD42DFW386WgoS6DJ3EnbNw",
    "success":true
}

Last updated