Can't create a WEBHOOK

I can’t create a webhook. I’ve installed the node.js cli, opened, started and entered: npm install -g particle-cli, then particle login… I then entered a webhook create command using the example from the Particle documentation and the response I’m receiving is:

C:\Users\Don>particle webhook create slack.json
slack.json is not found.

C:\Users\Don>particle webhook list
Found 0 hooks registered

When you are in folder Don, send the command "dir"
Can you see your file slack.json in the list?

Here are messages and results
npm install -g particle-cli
. … (all other initialization messages here)
.

  • node-pre-gyp@0.6.18 node_modules\particle-cli\node_modules\serialport\node_modules\node-pre-gyp
    C:\Users\Don\AppData\Roaming\npm
    └─┬ particle-cli@1.9.2
    └─┬ inquirer@0.11.3
    └── string-width@1.0.1

C:\Users\Don>particle login
Error loading command C:\Users\Don\AppData\Roaming\npm\node_modules\particle-cli\commands\SerialCommand.js Error: Cannot find module ‘node-pre-gyp’
? Please enter your email address don.xxxxxx@gmail.com
? Please enter your password ********

Successfully completed login!

C:\Users\Don.spark>particle webhook create slack.json
Error loading command C:\Users\Don\AppData\Roaming\npm\node_modules\particle-cli\commands\SerialCommand.js Error: Cannot find module 'node-pre-gyp’
slack.json is not found.

C:\Users\Don>dir (deleted names of standard directories)

Directory of C:\Users\Don

01/12/2016 10:01 PM .
01/12/2016 10:01 PM …
11/29/2015 10:56 AM 138 .gitconfig
06/17/2015 01:36 PM .jssc
01/19/2016 09:09 PM 617 .node_repl_history
11/18/2015 10:40 AM .oracle_jre_usage
11/12/2015 07:20 PM .particle
12/21/2015 08:56 PM .particledev
12/21/2015 08:56 PM .spark
03/22/2015 08:10 AM .ssh
3 File(s) 1,175 bytes
24 Dir(s) 445,634,547,712 bytes free

@DGG-KY, you need to either explicitly specify the path of the .json file in the particle command or switch to the directory where it can be found and call particle from there.

particle create webhook c:\users\don\xxxx\slack.json
  where xxxx is the directory where slack.json is located, possibly documents

OR

cd c:\users\don\xxxx
particle create webhook slack.json

Thanks for reply

Did a system search for SLACK and nothing was found. What would have provided this file or where can I obtain it.

@DGG-KY, I think you need to read or re-read the webhooks section of the documentation. The file is created by you! I suspect you are trying to follow the example in the tutorial but there is no such file!

peekay, I’ve read webhooks section numerous times before screaming help! In my previous response you can see the line where I attempt to create the file,
C:\Users\Don.spark>particle webhook create slack.json

but I get an error:
Error loading command C:\Users\Don\AppData\Roaming\npm\node_modules\particle-cli\commands\SerialCommand.js Error: Cannot find module 'node-pre-gyp’
slack.json is not found.

I’ve executed an example.js file to print out “Hello World” (per node.js cli) to see if I am communicating with the server or even if the cli is recognizing my commands. The last line of the example.js file prints but not the message ‘Hello World’. I don’t know what I’m missing.

I don’t quite know how much experience you’ve got with things like this, but

  • particle is the command (program) you run, and in this case it takes three parameters
  1. webhook to use the features of that program summarized under it. A a distinct feature

  2. create to do exactly this (create a webhook) and the third parameter

  3. slack.json is the name of the file which should be used to create said webhook.

So in order to create this particular webhook you need a file called slack.json. If you haven’t you won’t be able to create this webhook.

@DGG-KY,

You need to manually create the json file by hand in a text editor. The json file is the configuration data for the webhook you are trying to create. The command “particle webhook create xxx.json” does NOT create the json file, it creates the webhook using the json file as input data.

Make sense?

Tim

@DGG-KY, the slack.json is a text file that YOU create. You then use the particle webhook create command to create a webhook FROM that file. Though the slack.json file is referred to in the docs, there is no such file. I suggest you try the weather or librato webhook examples though again, you will need to create the .json file from which you create a webhook. For example, in my RGBPongClock topic, I created a .json file with the following text:

{
"event": "myWebhookName",
"url": "http://api.openweathermap.org/data/2.5/forecast/daily",
"requestType": "POST",
"headers": null,
"query": {
	"q": "{{mycity}}",
	"mode": "json",
	"units": "{{units}}",
	"cnt": 7,
	"appid": "{{apikey}}"
	},
"responseTemplate": "{{#list}}{{temp.day}}{{#weather}}~{{id}}~{{/weather}}{{/list}}",
"json": null,
"auth": null,
"noDefaults": true,
"devideid": null,
"mydevices": true
}

I then use the partcle webhook create file.json command (using the actual filename of the json file) to create the webhook. Hope that makes sense!

1 Like

First in response to ScruffR: I have ZERO experience and I am trying to learn by reading and executing examples using two Particle Photons. Thank you for help.

Second in response to cyberlord: I totally did not understand it was necessary to create first the slack.json file and a webhook file from the particle documentation. Thank you for clearing that up.

Third in response to peekay123: I must have jumped ahead and completely missed instructions on how to create a .json file. There are so many twists and turns, I’m trying to learn and it is extremely confusing. Between all of you, perhaps I have enough information to continue researching how to do this. Thanks to all

1 Like

@DGG-KY, the Elites and the Particle Team recognize that the webhook documentation needs some lovin’. More examples and working code is in order.

Don’t hesitate to ask questions if you know what you want to achieve. :wink: