Difficulty in getting callbacks triggered for basic conversation with Botkit 4 and SlackAdapter

Struggling to get conversation callbacks firing correctly. Has anyone successfully implemented botkit 4 with Slack and can share a working sample? I've set up the necessary adapters and middleware, but my callbacks just won't trigger.

I followed the code from the botkit documentation and triggered it after a /slash command. The question is displayed, but no callbacks are executed regardless of the response. While I do see events reaching my server, the callbacks remain inactive.

Below is the code snippet I'm currently testing with:

    let convo = new BotkitConversation('cheese', controller)

    await bot.startPrivateConversation(message.user)

    // create a path for when a user says YES
    convo.addMessage('You said yes! How wonderful.', 'yes_thread')

    // create a path for when a user says NO
    convo.addMessage('You said no, that is too bad.', 'no_thread')

    // create a path where neither option was matched
    // this message has an action field, which directs botkit to go back to the `default` thread after sending this message.
    convo.addMessage('Sorry I did not understand.', 'bad_response')

    // Create a yes/no question in the default thread...
    convo.addQuestion(
        'Do you like cheese?',
        [
            {
                pattern: 'yes',
                handler: async (response, convo, bot) => {
                    await convo.gotoThread('yes_thread')
                }
            },
            {
                pattern: 'no',
                handler: async (response, convo, bot) => {
                    await convo.gotoThread('no_thread')
                }
            },
            {
                default: true,
                handler: async (response, convo, bot) => {
                    await convo.gotoThread('bad_response')
                }
            }
        ],
        'likes_cheese',
        'default'
    )

    controller.addDialog(convo)

    await bot.beginDialog(`cheese`)

Any assistance would be greatly appreciated!

Answer №1

It appears that there was an issue with my custom storage provider causing interference. Although I have not fully resolved it yet, disabling the storage provider allowed me to successfully receive conversation call backs.

For example:

const controller: Botkit = new Botkit({
    adapter: getSlackAdapter()

    // Note: Disabling this section resolves the issue with conversation call backs not firing. We can revisit this later to determine if it is necessary.
    //storage: services.storageService
})

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

iframe-based cross-site file upload

I created an image uploading API and implemented a jQuery plugin that utilizes an iframe for the upload process. However, due to the API's domain being different, I am unable to retrieve the return data from the iframe. Is there a solution to accessin ...

Stripping away AM | PM from date variables

Is there a way to accurately calculate the difference between two datetime values in minutes without including AM|PM? When attempting to trim out the AM | PM from my code, I encounter errors (specifically NaN minutes). How can I safely remove this element ...

Instructions on how to extract information from a JSON response in SharePoint in order to display a list of

This is my first time working with JSON, so please be kind and patient with me :) I am currently working on a website, which can be found at http://msdn.microsoft.com/en-us/library/jj164022(v=office.15).aspx Here is a sample of the JavaScript code I am u ...

Changing the value of a variable after iterating through an array in JavaScript

I'm just getting started with programming and teaching myself. I'm struggling to grasp how to update a variable by iterating through an array. Here's an array containing the best pies, each with its own price: [blueberry, strawberry, pumpk ...

ReactJS does not update the conditional CSS class when hovering with mouseOnEnter or mouseOnOver

I am currently attempting to showcase data in a table where each row features an info icon that is only visible upon hovering. Additionally, I want a pop-up to appear when the info icon is clicked (there is an onclick function assigned to this button). He ...

Issue: Unable to locate file 'socket.io-client/dist/socket.io.min.js'

Attempting to set up the Spika backend (node application), I ran into an issue while trying to start the server in standalone mode with the command: $ node src/server/main.js The error that popped up was: Error: Cannot find module 'socket.io-clien ...

"Encountering issues with the construction of a Heroku application generated using the angular

After successfully building my app with sudo grunt build and serving it using sudo grunt serve:dist, I encountered an issue when trying to deploy to Heroku using yo angular-fullstack:heroku from the project root for the first time. The deployment process ...

Is it possible to remove the "disabled" attribute using JS, but the button remains disabled?

There are two buttons on my page: the first one is currently disabled, and the second one is supposed to enable the first button. That's the plan. Button 1: $(document).ready(function() { $('#click').click(function() { document.getE ...

Having difficulty authenticating Slack requests

I'm currently working on a project to develop a Slack bot using the events API for an experiment at my job. I am facing challenges in verifying the request and can't seem to pinpoint where I'm making a mistake. The bot is being built using ...

What is the reason that preventDefault fails but return false succeeds in stopping the default behavior

I'm having trouble with my preventDefault code not working as expected. While using return false seems to work fine, I've heard that it's not the best practice. Any ideas why this might be happening? if ($('.signup').length == 0) ...

Initiate an AJAX call and in the event that a particular object is found in the JSON response, proceed to send a subsequent request targeting

My objective is to make an AJAX request to a URL and expect a JSON response consisting of two objects: group_id and next_page. If the next_page object is set, I want to send another AJAX request using the value of next_page as the URL. If there is no next_ ...

The script is stuck displaying the existing records, failing to update with any new ones

Kindly refrain from offering jQuery advice. This script is created to display additional database records when you scroll down to the bottom inside a div named results-container. The issue I'm encountering is that the same data keeps appearing. I&ap ...

Angular has developed a content script that automatically fills in user passwords on forms

I have developed a content script extension that automatically fills in user and password fields on webpages. It works perfectly fine on regular forms like the one below - <input name="userId" class="form-field" id="userId" placeholder="Username" autoc ...

Tips for forwarding Express arguments to asynchronous functions in Node.js

Currently, I am encountering an issue while working with express middleware. My main concern lies in checking for the existence of a file within my express middleware functions. //Organizing express middeleware... app.use(f1); app.use(f2); ... functi ...

The integration of AngularJS with Bootstrap 3 accordion seems to encounter issues when included through ng-view

Here's the issue: When using the accordion in a view loaded with the ng-view directive, the accordion title clicks stop working correctly. Check out this demo for an example However, when the accordion is used directly on the page without ng-view, i ...

Preventing nodemon from automatically changing the port whenever an Express app is restarted

As a newcomer to node.js, I recently started using nodemon for the first time while working on Windows. In my package.json file, I have the following setup: "scripts": { "start": "nodemon ./bin/www" } To run my express app, I use npm start from the com ...

The web server is serving an HTML file instead of the expected JSON response

Is there a way to extract the JSON data from ? I have tried using AJAX but it only retrieves the entire HTML page instead. $.ajax({ url: 'http://www.bartdekimpe.be/anoire/index.php/admin/getGamesUserJson/34', success: function(data) { ...

"Establishing a connection between my Vue component and Node server: A step-by-step guide

Greetings everyone, I am currently in the process of developing a Single Page Application (SPA) chat application. I am utilizing Vuejs for the front end and Laravel 5.4 for my backend API. In order to create a real-time communication experience, I have set ...

Struggling to generate a fresh invoice in my project using React.js

I am fairly new to working with React and could really benefit from some assistance in understanding how to implement a new invoice feature within my current project. The Challenge: At present, I can easily create a new invoice as showcased in the images ...

Employing distinct techniques for a union-typed variable in TypeScript

I'm currently in the process of converting a JavaScript library to TypeScript. One issue I've encountered is with a variable that can be either a boolean or an array. This variable cannot be separated into two different variables because it&apos ...