Skip to content

Generic webhook notification #295

@zdwolfe

Description

@zdwolfe

Is your feature request related to a problem? Please describe.
As the administrator of an application in the local travel space, I want camply to send a webhook (HTTP/POST) to a configuration-specified URL with configuration-specified headers and a JSON representation of the campsite so my application can programmatically handle the notification.

Describe the solution you'd like
When WEBHOOK_URL, WEBHOOK_HEADERS, and --notifications webhook are specified, the notification should be POST'ed to the WEBHOOK_URL with the WEBHOOK_HEADERS. The request body should be JSON with machine-readable fields (example, dates should be epoch timestamps or other common time format).

Something like:

{
  "campsite": {
    "campsite_id": "1234",
    "booking_date": 1694499820,
    "booking_url": "http://blahblah",
    "...": "etc"
  }
}

and

WEBHOOK_URL="http://foobar" \
  WEBHOOK_HEADERS=$(echo '{"Content-Type": "application/json", "x-api-key": "super-secret"}' | base64) \
  camply campsites --rec-area 12345

Describe alternatives you've considered

The open Discord PR is close, as is Slack, but the fields are human friendly or formatted, not generically machine-readable.

Additional context
If this sounds reasonable to you, I am willing to contribute a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions