Dasha SDK 作业,队列
Dasha SDK Jobs, queue
当我使用 Dasha 的旧 SDK 时,从另一个带有“dashaApp.enqueueJobs()”的文件将呼叫号码发送到主 Dasha.js 文件,我得到了号码,但在新的 Dasha SDK 中如何我可以获得从 enqueueJobs 发送的信息吗?
https://docs.dasha.ai/en-us/default/sdk/node-js/classes/conversationqueue
当你想添加条目时
application.queue.push("key", {
after: new Date(),
before: new Date(Date.now() + 60 * 60 * 1000)
});
在主处理程序中
application.queue.on("ready", async (key, conversation) => {
//key -- something for identification of job on your side, for example phone number
conversation.input = getInput(key);
const result = await conversation.execute();
});
或者你可以使用无队列执行https://docs.dasha.ai/en-us/default/sdk/node-js/classes/application#createconversation
const dasha = require("@dasha.ai/sdk");
const app = await dasha.deploy("path/to/app");
....
const conv = app.createConversation({
foo: 123,
});
const result = await conv.execute();
当我使用 Dasha 的旧 SDK 时,从另一个带有“dashaApp.enqueueJobs()”的文件将呼叫号码发送到主 Dasha.js 文件,我得到了号码,但在新的 Dasha SDK 中如何我可以获得从 enqueueJobs 发送的信息吗?
https://docs.dasha.ai/en-us/default/sdk/node-js/classes/conversationqueue
当你想添加条目时
application.queue.push("key", {
after: new Date(),
before: new Date(Date.now() + 60 * 60 * 1000)
});
在主处理程序中
application.queue.on("ready", async (key, conversation) => {
//key -- something for identification of job on your side, for example phone number
conversation.input = getInput(key);
const result = await conversation.execute();
});
或者你可以使用无队列执行https://docs.dasha.ai/en-us/default/sdk/node-js/classes/application#createconversation
const dasha = require("@dasha.ai/sdk");
const app = await dasha.deploy("path/to/app");
....
const conv = app.createConversation({
foo: 123,
});
const result = await conv.execute();