fca-jerry
v1.1.0
Published
Complete FCA-style messaging engine with multiple endpoints, adapters, and webhook support
Maintainers
Readme
fca-jerry
Complete FCA-style messaging engine with multiple endpoints, adapters, and webhook support.
Features
- ✅ Multiple authentication methods (Cookie, Token, Custom)
- ✅ Multiple endpoint types (Facebook Graph API, Custom servers, Local testing)
- ✅ Automatic adapter detection
- ✅ Retry mechanism with exponential backoff
- ✅ File attachment support
- ✅ Typing indicators
- ✅ Mark as read
- ✅ User profile fetching
- ✅ Batch operations
- ✅ Connection testing
- ✅ Comprehensive error handling
Installation
npm install fca-jerryinstalation & testing
1. Create project folder
mkdir fca-jerry cd fca-jerry
2. Copy all the files above
3. Install dependencies
npm install
4. Test the package
npm test
5. Run example server
npm run server
6. Run examples
npm start
#License MIT
6. Test File (test.js)
const { createEngine, utils } = require('./src/index');
console.log("🧪 Running fca-jerry tests...\n");
// Test utilities
console.log("1. Utility Tests:");
console.log("Generate ID:", utils.generateMessageId());
console.log("Valid thread ID:", utils.isValidThreadId("123456789"));
console.log("Invalid thread ID:", utils.isValidThreadId("123"));
// Test adapter detection
console.log("\n2. Adapter Detection:");
const testCookie = "c_user=123456789; xs=abc123def456";
console.log("Cookie validation:", utils.isValidThreadId("123456789"));
// Test engine creation
console.log("\n3. Engine Creation:");
try {
const engine = createEngine({
endpoint: "https://httpbin.org/post",
adapterType: "CUSTOM",
customAuth: "test-key"
});
console.log("✅ Engine created successfully");
console.log("Auth type:", engine.authType);
console.log("Config:", engine.getConfig());
} catch (error) {
console.error("❌ Engine creation failed:", error.message);
}
console.log("\n✅ All tests completed!");
