You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
⚠️ IMPORTANT: HUMAN_AGENT tag extends window to 7 days but requires:
1. App Review approval for HUMAN_AGENT permission
2. Only for human agent conversations (not bots)
3. Must be real human interaction
Service Reference
IFacebookMessaging (Messaging Service)
publicinterfaceIFacebookMessaging{// ✅ Standard messaging (within 24-hour window)TaskSendAsync(stringmessage,stringrecipientId);TaskSendAsync(IFacebookMessagemessage,stringrecipientId);TaskSendImageAsync(stringimageUrl,stringrecipientId);TaskSendVideoAsync(stringvideoUrl,stringrecipientId);// ⚠️ FOR MESSAGING OUTSIDE 24-HOUR WINDOW// Requires specific message tagsTaskSendWithTagAsync(IFacebookMessagemessage,stringrecipientId,MessageTagTypetag);TaskSendWithTagAsync(stringmessage,stringrecipientId,MessageTagTypetag);// ⚠️ HUMAN_AGENT TAG (7-day window)// Requires HUMAN_AGENT permission from App ReviewTask<FacebookSendResult>SendWithHumanAgentFallbackAsync(IFacebookMessagemessage,stringrecipientId);}
MessageTagType Enum
publicenumMessageTagType{/// <summary>/// Send reminders for confirmed events/// </summary>ConfirmedEventUpdate,/// <summary>/// Send order updates (shipping, delivery)/// </summary>PostPurchaseUpdate,/// <summary>/// Send account-related updates/// </summary>AccountUpdate,/// <summary>/// ⚠️ Extends window to 7 days/// ⚠️ Requires HUMAN_AGENT permission from App Review/// </summary>HumanAgent}
Page-Scoped User ID (PSID)
Understanding PSID
⚠️ PSID is unique per Page, NOT per App!
Concept
Description
PSID
Page-Scoped User ID
Scope
Unique per Facebook Page
Same user, different pages
Different PSIDs
Same user, same page
Same PSID
Example
User "John" interacts with two pages:
- Page A: PSID = "123456789"
- Page B: PSID = "987654321"
These are DIFFERENT IDs for the SAME person!
Implications
// Store PSID with Page ID for correct identificationpublicclassContact{publicstringPsid{get;set;}// User's PSIDpublicstringPageId{get;set;}// Page this PSID belongs topublicstringDisplayName{get;set;}}
Error Handling
Common Error Codes
Code
Meaning
Solution
10
Permission denied
Check App Review status
100
Invalid parameter
Check request format
190
Access token expired
Refresh page access token
200
Permission issue
User may have blocked page
551
24-hour window expired
Use Message Tags
2018001
HUMAN_AGENT not approved
Apply for permission
Handling 24-Hour Window Expiration
try{awaitfacebookClient.Messaging.SendAsync(message,psid);}catch(FacebookApiExceptionex)when(ex.ErrorCode==551){// 24-hour window expired, try with Message Taglogger.LogWarning("24-hour window expired for {Psid}, using HUMAN_AGENT tag",psid);varresult=awaitfacebookClient.Messaging.SendWithHumanAgentFallbackAsync(message,psid);if(!result.Success&&result.HumanAgentTagPermissionDenied){// HUMAN_AGENT permission not approvedlogger.LogError("HUMAN_AGENT tag requires App Review approval");}}