Genesys Cloud - Main

 View Only

Sign Up

  Thread closed by the administrator, not accepting new replies.
  • 1.  Workflow needs a delay in a digital bot flow

    Posted 12-30-2024 04:01
    No replies, thread closed.

    I am curious if there is a way to add a wait to a digital bot flow in some fashion.  I have a design I am working on which is failing because I am executing a workflow, but the workflow hasn't completed by the time I need to get the execution back within a digital bot flow.

    I've found an ugly workaround in the form of inserting an ask for yes/no to create a manual delay by waiting for user input, but doing this is going outside of my intended design.

    This would be very easy to solve if digital bot flows supported a wait action, but they do not as far as I can tell.

    I am curious if there is an alternate approach to creating a delay to allow a process to complete before proceeding.


    #API/Integrations
    #ConversationalAI(Bots,AgentAssist,etc.)
    #DigitalChannels

    ------------------------------
    Matt Riedl
    Senior Consultant, Deployment
    ------------------------------


  • 2.  RE: Workflow needs a delay in a digital bot flow
    Best Answer

    Posted 12-30-2024 19:00
    No replies, thread closed.

    Not currently.  Here is an idea:  Add ability to delay response in digital | Genesys Cloud Ideas Portal

    Now, what I have done is to create a small Node.JS code that allows input of the number of seconds and it waits to return back to the data action for that number of seconds.  We actually put this into a Customer Code Data Action so it is all hosted in Genesys.  



    ------------------------------
    Robert Wakefield-Carl
    ttec Digital
    Sr. Director - Innovation Architects
    Robert.WC@ttecdigital.com
    https://www.ttecDigital.com
    https://RobertWC.Blogspot.com
    ------------------------------



  • 3.  RE: Workflow needs a delay in a digital bot flow

    Posted 12-31-2024 02:03
    No replies, thread closed.

    Robert, can you please explain in more details, it sounds very useful :).



    ------------------------------
    Vidmantas Zygus
    Systems expert
    ------------------------------



  • 4.  RE: Workflow needs a delay in a digital bot flow

    Posted 12-31-2024 11:22
    No replies, thread closed.

    Not much to explain.  You need a REST web service that accepts the number of seconds and then waits that amount of time before replying to the data action.  Could be written in any language, but we chose Node.JS so it could be hosted in Customer Code.  Lamda works well as well.  



    ------------------------------
    Robert Wakefield-Carl
    ttec Digital
    Sr. Director - Innovation Architects
    Robert.WC@ttecdigital.com
    https://www.ttecDigital.com
    https://RobertWC.Blogspot.com
    ------------------------------



  • 5.  RE: Workflow needs a delay in a digital bot flow

    Posted 12-31-2024 12:06
    No replies, thread closed.

    I am also curious about the specifics of this.  I've never put together a customer code data action, and if you had a reference to documentation and/or sample code, I'd love to see the specifics.



    ------------------------------
    Matt Riedl
    Senior Consultant, Deployment
    ------------------------------



  • 6.  RE: Workflow needs a delay in a digital bot flow

    Posted 12-31-2024 12:27
    No replies, thread closed.

    CoPilot can help with that. 

    Sure thing! Here's a simple Node.js app that accepts an integer and replies after waiting for that number of seconds:
     
    ```javascript
    const express = require('express');
    const app = express();
    const port = 3000;
     
    app.use(express.json());
     
    app.post('/wait', (req, res) => {
        const seconds = req.body.seconds;
     
        if (!Number.isInteger(seconds) || seconds < 0) {
            return res.status(400).send('Please provide a valid positive integer.');
        }
     
        setTimeout(() => {
            res.send(`Waited for ${seconds} seconds.`);
        }, seconds * 1000);
    });
     
    app.listen(port, () => {
        console.log(`Server is running on port ${port}`);
    });
    ```
     
    To run this app, follow these steps:
     
    1. **Install Node.js**: Make sure you have Node.js installed on your machine. You can download it from [nodejs.org](https://nodejs.org/).
    2. **Create a new project**: Create a new directory for your project and navigate to it in your terminal.
    3. **Initialize the project**: Run `npm init -y` to create a `package.json` file.
    4. **Install Express**: Run `npm install express` to install the Express framework.
    5. **Create the app file**: Create a file named `app.js` and paste the code above into it.
    6. **Run the app**: Start the server by running `node app.js` in your terminal.
     
    Now, you can send a POST request to `http://localhost:3000/wait` with a JSON body containing the number of seconds you want to wait, like this:
     
    ```json
    {
        "seconds": 5
    }
    ```
     
    The server will reply after waiting for the specified number of seconds. 


    ------------------------------
    Robert Wakefield-Carl
    ttec Digital
    Sr. Director - Innovation Architects
    Robert.WC@ttecdigital.com
    https://www.ttecDigital.com
    https://RobertWC.Blogspot.com
    ------------------------------