@tiledesk/tiledesk-whatsapp-connector 0.1.29 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +10 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -900,14 +900,22 @@ router.post("/newtest", async (req, res) => {
|
|
|
900
900
|
let short_uid = uuidv4().substring(0, 8)
|
|
901
901
|
let key = "bottest:" + short_uid;
|
|
902
902
|
|
|
903
|
+
if (!redis_client) {
|
|
904
|
+
return res.status(500).send({ message: "Test it out on Whatsapp not available. Redis not ready."})
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
//console.log("redis_client: ", redis_client)
|
|
908
|
+
|
|
903
909
|
await redis_client.set(key, JSON.stringify(info));
|
|
904
910
|
//const value = await redis_client.get(key)
|
|
905
911
|
//console.log("get --> value: ", value)
|
|
906
912
|
redis_client.get(key, (err, value) => {
|
|
907
913
|
if (err) {
|
|
908
914
|
console.log("get err: ", err)
|
|
915
|
+
return res.status(500).send({success: "false", message: "No info found on redis"});
|
|
909
916
|
} else {
|
|
910
917
|
console.log("get value: ", value)
|
|
918
|
+
return res.status(200).send({short_uid: short_uid});
|
|
911
919
|
}
|
|
912
920
|
})
|
|
913
921
|
/*
|
|
@@ -916,7 +924,7 @@ router.post("/newtest", async (req, res) => {
|
|
|
916
924
|
path: '.nodell',
|
|
917
925
|
});
|
|
918
926
|
*/
|
|
919
|
-
res.status(200).send({short_uid: short_uid});
|
|
927
|
+
//res.status(200).send({short_uid: short_uid});
|
|
920
928
|
})
|
|
921
929
|
|
|
922
930
|
router.post("/testitout/:project_id", async (req, res) => {
|
|
@@ -1038,12 +1046,6 @@ async function startApp(settings, callback) {
|
|
|
1038
1046
|
log = settings.log;
|
|
1039
1047
|
}
|
|
1040
1048
|
|
|
1041
|
-
redis_client = redis.createClient({
|
|
1042
|
-
host: REDIS_HOST,
|
|
1043
|
-
port: REDIS_PORT,
|
|
1044
|
-
password: REDIS_PASSWORD
|
|
1045
|
-
});
|
|
1046
|
-
|
|
1047
1049
|
db.connect(settings.MONGODB_URL, () => {
|
|
1048
1050
|
console.log("(whatsapp) KVBaseMongo successfully connected.");
|
|
1049
1051
|
|
|
@@ -1057,7 +1059,7 @@ function connectRedis() {
|
|
|
1057
1059
|
redis_client = redis.createClient({
|
|
1058
1060
|
host: REDIS_HOST,
|
|
1059
1061
|
port: REDIS_PORT,
|
|
1060
|
-
password: REDIS_PASSWORD
|
|
1062
|
+
password: REDIS_PASSWORD
|
|
1061
1063
|
});
|
|
1062
1064
|
|
|
1063
1065
|
redis_client.on('error', err => {
|