@ebenos/messenger-adapter
Advanced tools
Comparing version 4.0.0-alpha.7 to 4.0.0-alpha.8
@@ -29,2 +29,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const results = []; | ||
for (const action of actions) { | ||
@@ -40,27 +41,20 @@ const { delay = 0 } = action; | ||
} | ||
const results = []; | ||
try { | ||
if (action.body) { | ||
const rsp = yield node_fetch_1.default(`${fbApiUrl}/me/messages?${token}`, { | ||
body: JSON.stringify(action.body), | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
} | ||
}); | ||
const json = yield rsp.json(); | ||
if (json.error && json.error.message) { | ||
throw new Error(json.error.message); | ||
if (action.body) { | ||
const rsp = yield node_fetch_1.default(`${fbApiUrl}/me/messages?${token}`, { | ||
body: JSON.stringify(action.body), | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
} | ||
results.push(json); | ||
continue; | ||
}); | ||
const json = yield rsp.json(); | ||
if (json.error && json.error.message) { | ||
console.log(json.error.message); | ||
} | ||
throw new Error('No body or token!'); | ||
results.push(json); | ||
continue; | ||
} | ||
catch (err) { | ||
console.log(err); | ||
// TODO: Handle errors | ||
throw err; | ||
} | ||
console.log('No body or token!'); | ||
} | ||
return results; | ||
}); | ||
@@ -67,0 +61,0 @@ } |
{ | ||
"name": "@ebenos/messenger-adapter", | ||
"version": "4.0.0-alpha.7", | ||
"version": "4.0.0-alpha.8", | ||
"description": "Facebook SendAPI Library for the Ebony framework.", | ||
@@ -51,3 +51,3 @@ "main": "./build/index.js", | ||
], | ||
"gitHead": "71dedb975549e6a293d348bb55ad4f61ad9fa0b5" | ||
"gitHead": "0b0187cbc9d8d4747483948122db052196d34029" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54936
782