Getting an error while using fbwebhook connector

Hello,

I am trying to connect my fb messenger bot through botium cli. I used this documentation for setup. Provided my webhook url in the botium.json file and I ran “run” command.

I was getting below error
Error: Loading Botium Plugin failed.
Loading Botium plugin from fbwebhook failed - Cannot find module ‘fbwebhook’
Require stack:

I tried installing botium-core explicitly using “npm i botium-core”, still error persisted.
Then I ran command “npm i botium-connector-fbwebhook”

and I again fired “run” command.

But now I am getting below error,
BotiumError: ReadScript - an error occurred at ‘node_modules/kind-of/CHANGELOG.md’ file: “-” not expected here (Line 11): expecting parent “##” for “-”

I can update the file manually, but after doing that it will throw error for other files as well.

I am not sure what did I do wrong, could someone please help me?

By default, Botium CLI is traversing the current working directory recursivly for finding test case files.
You should use the –convos command line switch to point Botium CLI to your test case directory.

@Florian Thanks.
I tried adding --convos to the command, but still there is the same issue.

Directory structure is as below:
Root
|
botium.json, test_convo file

you have to place the convo files in a directory and point the --convos parameter to this dreictory

Hi @Florian ,

Updated the directory structure to below
Root
|
botium.json
test(directory)
|
test_convo file
2

Same error persists. Below is my botium.json file

{

“botium”: {

"Capabilities": {

  "PROJECTNAME": "<project_name>",

  "CONTAINERMODE": "fbwebhook",

  "FBWEBHOOK_WEBHOOKURL": "<my_url>"

}

}
}

Also, I tried to run sample example provided in the repo. I am getting same error

**Error: Loading Botium Plugin failed.**
**Loading Botium plugin from fbwebhook failed - Cannot find module 'fbwebhook'**

Try to install it all at once into the local directory

npm install botium-cli botium-core botium-connector-fbwebhook

@Florian,

I tried installing them locally all at the same time.
“node_modules” folder created inside my local directory. I could see all of these 3 modules in that directory.

4
Then I ran “botium-cli run --convos <path_to_dir>\spec\convo”
Note: I pulled the sample code to check whether it is working or not.

I am still getting the same error.

  Error: Loading Botium Plugin failed.
Loading Botium plugin from fbwebhook failed - Cannot find module 'fbwebhook'
Require stack:
- C:\Users\Sagar\AppData\Roaming\npm\node_modules\botium-cli\node_modules\botium-core\src\containers\plugins\index.js
- C:\Users\Sagar\AppData\Roaming\npm\node_modules\botium-cli\node_modules\botium-core\index.js![3|435x500](upload://fcIaDOIeUqe6KXc29htcLHMn2Er.png) ![4|428x405](upload://aY0uDTAfVL9nQ5qz488Eec4Xh2D.png)

try to run npx botium-cli run …
I think without this npx it will still use botium-cli from global npm cache

No Luck @Florian.

BotiumError: ReadScript - an error occurred at 'node_modules/accepts/HISTORY.md' file: "*" not expected here (Line 4): expecting parent "##" for "*"
at botiumErrorFromErr (C:\Jeavio\nivi_tests\node_modules\botium-core\src\scripting\BotiumError.js:85:12)

of course you have to add the --convos switch as well as you already did before

yes @Florian, But still I am back to the original error

   npx botium-cli run --convos <>path\tests\spec\convo


  Botium Test-Suite
    1) "before all" hook for "Echo"


  0 passing (141ms)
  1 failing

  1) Botium Test-Suite
       "before all" hook for "Echo":
     Error: Loading Botium Plugin failed.
Loading Botium plugin from fbwebhook failed - Cannot find module 'fbwebhook'
Require stack:
- <root_dir>\node_modules\botium-core\src\containers\plugins\index.js
- <root_dir>\node_modules\botium-core\index.js
- <root_dir>\node_modules\botium-cli\src\run\index.js
- <root_dir>\node_modules\botium-cli\bin\botium-cli.js
Loading Botium plugin botium-connector-fbwebhook failed, try "npm install botium-connector-fbwebhook" - Cannot call a class as a function

Is it possible that there is a “botium-core” directory under node_modules/botium-cli/node_modules as well ? If yes, then please remove it.

@Florian ,
There is no such directory under “node_modules/botium-cli/node_modules”.

Can you please help me with this issue. It is pending since last 4days. :frowning:

What do you think I am doing here :slight_smile:

But I can reproduce it now, this is an issue with the Botium FBWebhook connector.

ha ha ha… Yes you are helping out @Florian. :smiley: :smiley:

Great that it got reproduced.

Pls update botium-cli to the latest build 1.0.13 - remove package-lock.json, remove node_modules, remove lines from packager.json, run npm install botium-cli botium-connector-fbwebhook

@Florian ,
This is working. :clap: I could hit my endpoint and could see the logs in my backend.
Thanks a lot for your help. Very much appreciated. :smile:

Had one more question, I want to update or add a few params in this request. How shall I add/update those?
I tried updating index.js of node_modules/botium-connector-fbwebhook. But it didn’t get changed.

{
    "object": "page",
    "entry": [
        {
            "messaging": [
                {
                    "message": {
                        "text": "Reserve a car pls",
                        "mid": "mid.8763486100"
                    },
                    "sender": {
                        "id": 66666666
                    },
                    "recipient": {
                        "id": 77777777
                    },
                    "timestamp": 1625558021904
                }
            ],
            "ts": 1625558021904,
            "id": "123456"
        }
    ]
}

There is currently not much room for customizations in this connector.
In node_modules/botium-connector-fbwebhook remove the dist folder first before changing the index.js - but if have reasonable changes to the connector, a Github pull request would be the better choice to make it part of the official release branch

That worked @Florian. Thanks a lot, as of now this will help me to get started. I will raise a PR if is there any improvisation I make which could be useful for wider audience.

:bouquet: to all the developers and community.