Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webhook command fixes #181

Closed
wants to merge 1 commit into from
Closed

Webhook command fixes #181

wants to merge 1 commit into from

Conversation

kennethlimcp
Copy link
Contributor

This fix will allow the following commands:

  • spark webhook create slack.json
  • spark webhook GET <your_event_name> http://<website.you.are.trying.to.contact> <core_id>
  • spark webhook POST <your_event_name> http://<website.you.are.trying.to.contact> <core_id>

There might be more changes due to server parsing the webhook but this will fulfill all the commands mentioned in Documentation.

spark webhook create

Shows helps text:

NAME:
spark webhook create

DOES: 
    Creates a postback to the given url when your event is sent

xxxx

spark webhook create test.json

Result:

Using settings from the file test.json
Sending webhook request  { uri: 'https://api.spark.io/v1/webhooks',
  method: 'POST',
  json: true,
  form: 
   { event: 'temp',
     url: 'https://testing.url',
     coreID: '1209382138138',
     requestType: 'GET',
     headers: {},
     query: { temp: '10' },
     mydevices: true,
     access_token: '450ddb8ea93dd56d7aa6b246' } }
Successfully created webhook!

spark webhook GET eventName url core_id

eg. webhook GET i_want_get http:///get.me 1209303912093039

Sending webhook request  { uri: 'https://api.spark.io/v1/webhooks',
  method: 'POST',
  json: true,
  form: 
   { event: 'i_want_get',
     url: 'http:///get.me',
     deviceid: '1209303912093039',
     requestType: 'GET',
     access_token: '450ddb8ea93da3d7aa6b246' } }
Successfully created webhook!

spark webhook POST eventName url core_id

eg. webhook POST post_me http:///post.me 330284030940394039

Sending webhook request  { uri: 'https://api.spark.io/v1/webhooks',
  method: 'POST',
  json: true,
  form: 
   { event: 'post_me',
     url: 'http:///post.me',
     deviceid: '330284030940394039',
     requestType: 'POST',
     access_token: '450ddb8ea93da3fcda6b246' } }
Successfully created webhook!

@kennethlimcp
Copy link
Contributor Author

moved here: particle-iot/particle-cli#24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant