API Reference

Pancake API documentation

List pages

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

Pancake Page List

Query Parameters

Name
Type
Description

access_token*

String

Pancake user's access token. You can click the link below and click on ADVANCE to get it:

Generate page access_token

POST https://pages.fm/api/v1/pages/[:page_id]/generate_page_access_token

Generate/refresh the page's access token

Query Parameters

Name
Type
Description

page_id*

String

Customer's Page ID

access_token*

String

Pancake user's access token. You can click the link below and click on ADVANCE to get it:

Conversations

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

Conversation list

Query Parameters

Name
Type
Description

page_access_token*

string

Page's token (Can be generated in the TOOLS section in Pancake)

until*

timestamp

End time (Type: unix in seconds).

Time less or equal to one month

since*

timestamp

Start time (Type: unix in seconds).

page_id*

string

Customer's Page ID

page_number*

number

Current page (minimal 1)

order_by

String

Conversation Order (Default inserted_at) : inserted_at: Creation time

updated_at: updated time

tags

String

ID of the Tags which needs to be filtered

Example: 1,2,3,4

(Use the Page List API to get it)

{
  "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
}

Note:
    "conversations": Conversation list
        Conversation detail:
            "page_id": Page ID
            "customer_id": Customer ID
            "assignee_histories": Assignment history
            "type": Conversation type(INBOX, COMMENT, RATING)
            "inserted_at": Creation time
            "tags": Tag list
            "recent_phone_numbers": Phone number
            "customers": Customer's information
            "has_phone": Conversation have phone number?
            "tag_histories": Tag history
            "post_id": Post ID
            "last_sent_by": Last chat sender
            "current_assign_users": Assignment at the moment
            "ad_ids": ad_id list
    "total": Total conversation

Conversation tag

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

Add/remove conversation tag

Path Parameters

Name
Type
Description

page_id*

String

Page ID

page_access_token*

String

Page's token (Can be generated in the TOOLS section in Pancake)

conversation_id*

String

Conversation ID, you can get this from the Conversation List API

Request Body

Name
Type
Description

action*

String

Action (add: add tag, remove: remove tag)

tag_id*

String

Tag ID from the Tag list API

{
  "data": [  // Tag list after update
    0,
    1,
    2,
    4,
    5
  ],
  "success": true, 
  "timestamp": 1652845231603964 // Action time
}

Conversation assignment

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

Assign an employee to the conversation

Query Parameters

Name
Type
Description

page_id*

String

Page ID

conversation_id*

String

page_access_token*

String

Page's token (Can be generated in the TOOLS section in Pancake)

Request Body

Name
Type
Description

assignee_ids*

Array

Employee's ID List to be assigned to the conversation (please see at the User List API)

{
  "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

Mark the conversation as Read/Unread

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

Name
Type
Description

page_id*

string

page ID

conversation_id*

string

Conversation ID

page_access_token*

string

Page's token (Can be generated in the TOOLS section in Pancake)

Response

{"success": true}

Get Messages

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

Message list

Query Parameters

Name
Type
Description

current_count

number

Used to index the position to get the message.

When this is missing while calling the CPI, the system will return the latest 20 messages.

If you continue to attach current_count as 25, the system will return 25 older messages from the 20th position.

page_access_token*

string

Page token (Can be generated in Setting -> Tool)

customer_id*

string

Customer's ID (From get conversation API below)

conversation_id*

string

Conversation ID to get the message(From get conversation API below)

page_id*

string

Page ID to get the data

{
  "messages": [
    {
      "attachments": [], // Message's media
      "conversation_id": "256469571178082_3100878013328342", // Conversation ID
      "from": { // customer's information
        "email": "3100878013328342@facebook.com",
        "id": "3100878013328342",
        "name": "Quyết Nguyễn"
      },
      "has_phone": false, // Contain phone number or not
      "id": "m_Ec_f7RJrKyJlRKXVdEYW5gWswhac17zNH0kIRGkMGhuBkqMkamKpUyJSpemXfRB0kULuVY8WA-ATEthHwher9g", // Message ID
      "inserted_at": "2023-12-26T08:44:29.000000", // Message creation time
      "is_hidden": false, // is hidden - only for comment
      "is_livestream_order": null, 
      "is_parent": false, // is the parent comment - only for comment
      "is_parent_hidden": false, // the parent comment has been hidden - only for comment
      "is_removed": false, // has been deleted or not
      "like_count": null, // Total like - only for comment
      "message": "asda", // Message content
      "page_id": "256469571178082", // Page ID
      "phone_info": [], // Phone number information in the message
      "type": "INBOX", // message type [INBOX, COMMEMNT, RATING]
    }
  ],
  "success": true
}

Ads statistics

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

Advertisement Statistics (You need to login with an account with neccessary permission to see Facebook's ad statistics and choose the page you want before calling this API)

Query Parameters

Name
Type
Description

page_id*

String

Page ID

page_access_token*

String

Page token (Can be generated in Setting -> Tool)

since*

timestamp

Start time (Type: unix in seconds)

until*

timestamp

End time (Type: 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

Engagement statistics

Query Parameters

Name
Type
Description

by_hour

boolean

Statistics by hour

date_range*

string

Statistics time span (Example: 27/07/2021 00:00:00 - 26/08/2021 23:59:59)

page_access_token*

string

Page's token (Can be generated in the TOOLS section in Pancake)

user_ids

String

Employee's ID user list, seperated by ,

{
    "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
}

Note:

    categories: date list
    series: Statistic data
    series.data: Statistic by day based on the categories
    series.name: Statistic type
        "inbox": Inbox
        "comment": Comment
        "total": Total inbox + comment
        "new_customer_replied": New customer interaction
        "customer_engagement_new_inbox": Customer Conversation
        
        

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

Name
Type
Description

page_id*

String

Page ID

page_access_token*

String

Page's token (Can be generated in the TOOLS section in Pancake)

since*

timestamp

Start time (Type: unix in seconds).

until*

timestamp

End time (Type: unix in seconds).

{
    "data": [{
        "customer_comment_count": 0, Comment by customer 
        "customer_inbox_count": 0,  Inbox by customer 
        "hour": "2021-04-01T12:00:00", Time
        "inbox_interactive_count": 0, Old customer re-engaged
        "new_customer_count": 0, New Customer
        "new_inbox_count": 0, New inbox Conversations
        "page_comment_count": 0, Comment by page
        "page_inbox_count": 2, Inbox by page
        "phone_number_count": 0, Phone number per day
        "today_uniq_website_referral": 0, Phone number from website (logged in)
        "today_website_guest_referral": 0, Phone number from website (not logged in)
        "uniq_phone_number_count": 0 New Phone number
    }, {
        "customer_comment_count": 0,
        "customer_inbox_count": 2,
        "hour": "2021-04-01T14:00:00",
        "inbox_interactive_count": 0,
        "new_customer_count": 0,
        "new_inbox_count": 0,
        "page_comment_count": 0,
        "page_inbox_count": 3,
        "phone_number_count": 0,
        "today_uniq_website_referral": 0,
        "today_website_guest_referral": 0,
        "uniq_phone_number_count": 0
    }],
    "success": true
}

Tag statistics

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

Pancake Tag Statistics

Query Parameters

Name
Type
Description

page_id*

String

page ID

page_access_token*

String

Page's token (Can be generated in the TOOLS section in Pancake)

since*

timestamp

Start time (Type: unix in seconds).

until*

timestamp

End time (Type: unix in seconds).

{
    "data": {
        "categories": ["05/04", "06/04", "07/04", "14/04", "15/04", "28/04"], Time
        "series": {
            "tag_194": [0, 0, 0, 0, 0, 0], Tag ID/Total times tagged/untagged
            "tag_235": [0, 0, 0, 0, 0, 0],
            "tag_239": [0, 0, 0, 0, 0, 0],
            "tag_236": [0, 0, 0, 0, 0, 0],
            "tag_226": [0, 0, 0, 0, 0, 0],
            "tag_197": [0, 0, 0, 1, 0, 0],
            "tag_244": [0, 0, 0, 0, 0, 0],
            "tag_229": [0, 0, 0, 0, 0, 0],
            "tag_183": [0, 0, 0, 0, 0, 1],
            "tag_224": [0, 0, 0, 0, 0, 0],
            "tag_240": [0, 0, 0, 0, 0, 0],
            "tag_188": [2, 0, 0, 0, 0, 0],
            "tag_216": [0, 0, 0, 0, 0, 0],
            "tag_228": [0, 0, 0, 0, 0, 0],
            "tag_230": [0, 0, 0, 0, 0, 0],
            "tag_220": [0, 0, 0, 0, 0, 0],
            "tag_222": [0, 0, 0, 0, 0, 0],
            "tag_202": [0, 0, 0, 1, 0, 0],
            "tag_237": [0, 0, 0, 0, 0, 0],
            "tag_241": [0, 0, 0, 0, 0, 0],
            "tag_249": [0, 0, 0, 0, 0, 0],
            "tag_219": [0, 0, 0, 0, 0, 0],
            "tag_186": [0, 0, 0, 0, -1, 0],
            "tag_227": [0, 0, 0, 0, 0, 0],
            "tag_246": [0, 0, 0, 0, 0, 0],
            "tag_195": [0, 0, 0, 0, 0, 1],
            "tag_231": [0, 0, 0, 0, 0, 0],
            "tag_221": [0, 0, 0, 0, 0, 0],
            "tag_251": [0, 0, 0, 0, 0, 0],
            "tag_245": [0, 0, 0, 0, 0, 0],
            "tag_250": [0, 0, 0, 0, 0, 0],
            "tag_193": [0, 0, 0, 0, 0, 0],
            "tag_190": [0, 0, 0, 0, 0, 0],
            "tag_223": [0, 0, 0, 0, 0, 0],
            "tag_225": [0, 0, 0, 0, 0, 0],
            "tag_218": [0, 0, 0, 0, 0, 0],
            "tag_248": [0, 0, 0, 0, 0, 0],
            "tag_187": [0, 0, 0, 0, 0, 0],
            "tag_189": [1, 0, 0, 0, 0, 0],
            "tag_199": [0, 0, 0, 0, 0, 0],
            "tag_196": [1, 1, 4, 0, 2, 0],
            "tag_233": [0, 0, 0, 0, 0, 0],
            "tag_234": [0, 0, 0, 0, 0, 0],
            "tag_232": [0, 0, 0, 0, 0, 0],
            "tag_238": [0, 0, 0, 0, 0, 0],
            "tag_243": [0, 0, 0, 0, 0, 0]
        }
    },
    "data_today": {
        "categories": [],
        "series": {
            "tag_235": [],
            "tag_239": [],
            "tag_236": [],
            "tag_226": [],
            "tag_244": [],
            "tag_229": [],
            "tag_224": [],
            "tag_240": [],
            "tag_216": [],
            "tag_228": [],
            "tag_230": [],
            "tag_220": [],
            "tag_222": [],
            "tag_237": [],
            "tag_241": [],
            "tag_249": [],
            "tag_219": [],
            "tag_227": [],
            "tag_246": [],
            "tag_231": [],
            "tag_221": [],
            "tag_251": [],
            "tag_245": [],
            "tag_250": [],
            "tag_223": [],
            "tag_225": [],
            "tag_218": [],
            "tag_248": [],
            "tag_233": [],
            "tag_234": [],
            "tag_232": [],
            "tag_238": [],
            "tag_243": []
        }
    },
    "success": true,
    "tags": [{                                     Tag List
        "color": "#e39a6a",
        "id": "tag_216",
        "lighten_color": "rgba(227,154,106,0.4)",
        "text": "this a a testse"
    }, {
        "color": "#3882c1",
        "id": "tag_218",
        "lighten_color": "rgba(56,130,193,0.4)",
        "text": "Chờ kiểm tra"
    }, {
        "color": "#055d53",
        "id": "tag_219",
        "lighten_color": "rgba(5,93,83,0.4)",
        "text": "AdCake"
    }, {
        "color": "#796167",
        "id": "tag_220",
        "lighten_color": "rgba(121,97,103,0.4)",
        "text": "Instagram"
    }, {
        "color": "#29eb00",
        "id": "tag_221",
        "lighten_color": "rgba(41,235,0,0.4)",
        "text": "WebCake"
    }, {
        "color": "#77149e",
        "id": "tag_222",
        "lighten_color": "rgba(119,20,158,0.4)",
        "text": "Shopee"
    }, {
        "color": "#b1660d",
        "id": "tag_223",
        "lighten_color": "rgba(177,102,13,0.4)",
        "text": "App Mobile"
    }, {
        "color": "#090d17",
        "id": "tag_224",
        "lighten_color": "rgba(9,13,23,0.4)",
        "text": "POS"
    }, {
        "color": "#880909",
        "id": "tag_225",
        "lighten_color": "rgba(136,9,9,0.4)",
        "text": "Tổng đài"
    }, {
        "color": "#ff3033",
        "id": "tag_226",
        "lighten_color": "rgba(255,48,51,0.4)",
        "text": "extension"
    }, {
        "color": "#3f7b4f",
        "id": "tag_227",
        "lighten_color": "rgba(63,123,79,0.4)",
        "text": "Sales"
    }, {
        "color": "#0d5aff",
        "id": "tag_228",
        "lighten_color": "0",
        "text": "GHTK"
    }, {
        "color": "#d89cc9",
        "description": "Lỗi ghi chú",
        "id": "tag_229",
        "lighten_color": "rgba(216,156,201,0.4)",
        "text": "Lỗi ghi chú"
    }, {
        "color": "#ff6d6d",
        "description": "Thẻ này dành cho Đông dz",
        "id": "tag_230",
        "lighten_color": "rgba(255,109,109,0.4)",
        "text": "Đông Đông"
    }, {
        "color": "#0e2f44",
        "id": "tag_231",
        "lighten_color": "rgba(14,47,68,0.4)",
        "text": "lỗi ảnh"
    }, {
        "color": "#4b5577",
        "id": "tag_232",
        "lighten_color": "rgba(75,85,119,0.4)",
        "text": "Xoay vòng"
    }, {
        "color": "#9bcede",
        "id": "tag_233",
        "lighten_color": "rgba(155,206,222,0.4)",
        "text": "Lỗi tìm kiếm"
    }, {
        "color": "#ffdf13",
        "id": "tag_234",
        "lighten_color": "rgba(255,223,19,0.4)",
        "text": "Lỗi ava"
    }, {
        "color": "#8e708b",
        "id": "tag_235",
        "lighten_color": "rgba(142,112,139,0.4)",
        "text": "Tính năng mới"
    }, {
        "color": "#e51dff",
        "id": "tag_236",
        "lighten_color": "rgba(229,29,255,0.4)",
        "text": "Lỗi chờ"
    }, {
        "color": "#30fff3",
        "id": "tag_237",
        "lighten_color": "rgba(48,255,243,0.4)",
        "text": "Báo lại khách"
    }, {
        "color": "#b1b00d",
        "description": "Tag này dành cho những câu hỏi hóc búa liên quan đến Botcake. Mọi người gắn thẻ anh Hải CT (Hải béo) nha",
        "id": "tag_238",
        "lighten_color": "rgba(177,176,13,0.4)",
        "text": "Hải CT"
    }, {
        "color": "#44240e",
        "id": "tag_239",
        "lighten_color": "rgba(68,36,14,0.4)",
        "text": "thiếu quyền"
    }, {
        "color": "#1550c6",
        "id": "tag_240",
        "lighten_color": "rgba(21,80,198,0.4)",
        "text": "Đã giải quyết"
    }, {
        "color": "#ff6d6d",
        "id": "tag_241",
        "lighten_color": "rgba(255,109,109,0.4)",
        "text": "Thẻ 26"
    }, {
        "color": "#38a6f4",
        "id": "tag_243",
        "lighten_color": "rgba(56,166,244,0.4)",
        "text": "Tín Ngô"
    }, {
        "color": "#822ba1",
        "id": "tag_244",
        "lighten_color": "rgba(130,43,161,0.4)",
        "text": "Thái Lan"
    }, {
        "color": "#4b595e",
        "id": "tag_245",
        "lighten_color": "rgba(75,89,94,0.4)",
        "text": " this is a test"
    }, {
        "color": "#4b595e",
        "id": "tag_246",
        "lighten_color": "rgba(75,89,94,0.4)",
        "text": "Thẻ 31"
    }, {
        "color": "#1550c6",
        "id": "tag_248",
        "lighten_color": "rgba(21,80,198,0.4)",
        "text": "Thẻ 32"
    }, {
        "color": "#178989",
        "id": "tag_249",
        "lighten_color": "rgba(23,137,137,0.4)",
        "text": "test1"
    }, {
        "color": "#009344",
        "id": "tag_250",
        "lighten_color": "rgba(0,147,68,0.4)",
        "text": "test2"
    }, {
        "color": "#4b5577",
        "id": "tag_251",
        "lighten_color": "rgba(75,85,119,0.4)",
        "text": "test3"
    }]
}

Users statatistics

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

User statistics

Query Parameters

Name
Type
Description

page_access_token*

string

Page's token (Can be generated in the TOOLS section in Pancake)

date_range*

string

Time span (Example: 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
}

Note:
    "statistics": Statistics by time
    "users": Statistics by Employee
    "average_response_time": average respond time
    "comment_count": Total comment count
    "inbox_count": Total inbox count
    "phone_number_count": Total phone number count
    "private_reply_count": Inbox from comment count,
    "unique_comment_count": Respond to customer's comment count (Usually equal to the customer's comment)
    "unique_inbox_count": Respond to customer's inbox count (Usually equal to the customer's inbox)
    "hour": Statistics time
    "user_name": Employee's name
    "user_fb_id": employee's facebook ID

Users statatistics multiple pages

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

User statistics in Multiple mode

Query Parameters

Name
Type
Description

access_token*

String

Pancake user's access token. You can click the link below and click on ADVANCE to get it: https://pages.fm/account

page_ids*

String

Page ID list: page_id1,page_id2,...

date_range*

String

Time span: 05/08/2022 00:00:00 - 06/08/2022 23:59:59

{
  "statistics": { #Statistics by time
    "2138b20a-6745-4fe2-91b2-f75e6c43b7b0": [
      {
        "average_response_time": 10, #average respond time
        "comment_count": 0, #Total responded comment count
        "hour": "2022-07-05T01:00:00",  #Time
        "inbox_count": 1, #Total responded inbox count
        "order_count": 0, #Total created order
        "phone_number_count": 0, #Total phone number count
        "private_reply_count": 0, #Inbox from comment count
        "unique_comment_count": 0, #Total comment thread count
        "unique_inbox_count": 1 #Total inbox thread count
      }
    ],
    "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": {  #Statistics by users
    "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

New customer statistics by time

Path Parameters

Name
Type
Description

group_by

string

Group the data by...

fill in one of the following string: - day: (default) group by date - hour: group by date - page_id: group by page

page_access_token*

string

Page's token (Can be generated in the TOOLS section in Pancake)

date_range*

string

Time span: 20/07/2020 - 20/08/2020

page_id*

string

Customer's page ID

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

Customer's Information

Query Parameters

Name
Type
Description

page_id*

String

Page ID

page_access_token*

String

Page's token (Can be generated in the TOOLS section in Pancake)

since*

timestamp

Start time (type: unix in seconds)

until*

timestamp

End time (type: unix in seconds)

page_number*

number

Current page (min: 1)

page_size

number

Page size (max 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

Call list

Path Parameters

Name
Type
Description

id*

String

ID call center subscription

page_access_token*

String

Page's token (Can be generated in the TOOLS section in Pancake)

page_number*

Number

Current page (minimal 1)

page_size*

Number

Page length (at least 30)

since

timestamp

Start time (Type: unix in seconds).

until

timestamp

End time (Type: unix in seconds).

page_id*

Number

Page ID

{
    "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

Name
Type
Description

page_id*

String

Page ID

page_access_token*

String

Page's token (Can be generated in the TOOLS section in Pancake)

{
  "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

Name
Type
Description

page_id*

String

Page ID

since*

timestamp

Start time (Type: unix in seconds).

until*

timestamp

End time (Type: unix in seconds).

page_number*

Number

Current page (minimal 1)

page_size*

Number

Page length (at least 30)

page_access_token

String

Page's token (Can be generated in the TOOLS section in Pancake)

User list

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

Get the page's user list

Query Parameters

Name
Type
Description

page_id*

String

Page ID

page_access_token

String

Page's token (Can be generated in the TOOLS section in Pancake)

{
  "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

Used to send an Inbox from a comment. This feature is applicable ONCE only for a comment. Facebook only allows to send an inbox from a comment which was created NO MORE than 7 days ago.

Query Parameters

Name
Type
Description

access_token*

string

Pancake user's access token. You can click the link below and click on ADVANCE to get it:

Headers

Name
Type
Description

page_id*

string

Page ID

conversation_id*

string

Conversation ID which holds the comment

Request Body

Name
Type
Description

post_id*

string

Post ID of the comment

message_id

string

Comment ID

action*

string

To send the inbox you need to put private_replies

message*

string

Respond content

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

Send inbox

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

Send the message to the client

Query Parameters

Name
Type
Description

access_token*

string

Pancake user's access token. You can click the link below and click on ADVANCE to get it:

Headers

Name
Type
Description

page_id*

string

Page ID

conversation_id*

string

Conversation ID

Request Body

Name
Type
Description

name

string

File name

mime_type

string

mime_type of the file(image,...)

content_url

string

File URL (https://i.ibb.co/mzh7ck8/alaska-beo-acef3fcb1cc541a79048f4bbafed71c8-grande.png)

attachmentType

string

Attachment type (PHOTO, DOCUMENT)

action*

string

Set to send the message reply_inbox

message

string

Content

thread_key

string

Thread key

Reply comment

Respond to the customer's comment

Content need to contain at least an image or content

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

Query Parameters

Name
Type
Description

access_token*

string

Pancake user's access token. You can click the link below and click on ADVANCE to get it:

Headers

Name
Type
Description

page_id*

string

Page ID

conversation_id*

string

Conversation ID

Request Body

Name
Type
Description

action*

string

Set reply_comment

message_id

string

Comment ID

message

string

Content

content_url

string

File URL (https://i.ibb.co/mzh7ck8/alaska-beo-acef3fcb1cc541a79048f4bbafed71c8-grande.png)

image_data

string

Data of the file. Needed if content_url is presence. Example: {height: 100, width: 100}

Last updated

Logo