Giter VIP home page Giter VIP logo

mybb-webhookactions's Introduction

Webhook Actions

Triggers configurable actions supplemented with webhook data.

Requirements:

  • PHP >= 7.1

Configuration

Webhook Receivers and Actions can be configured in the inc/plugins/webhookActions/receivers.json.php file returning a JSON string. If the .php file is not present, the plugin will attempt to load JSON content from inc/plugins/webhookActions/receivers.json. When choosing to use this method, you should make sure this file is never accessible publicly.

The JSON contains the names of webhook Receivers, their input types (content_type), keys (key), and Action details (actions) that should be triggered when a webhook is received:

{
  "RECEIVER-NAME": {
    "content_type": "form",
    "key": "ACCESS-KEY",
    "actions": [
      {
        "name": "ACTION-NAME",
        "options": {},
      }
    ]
  }
}

Defined receivers can be accessed through the following webhook URL:

misc.php?action=webhook_actions&receiver=RECEIVER-NAME&key=ACCESS-KEY

Action files are PHP classes located in inc/plugins/webhookActions/Action/ that extend \webhookActions\Action, and receive configured options with webhook data. Depending on Action implementation, some options support sprintf() formatting with webhook data:

["String: %s, integer: %d", "WEBHOOK-DATA1", "WEBHOOK-DATA2", ...]

Supported content_type options:

  • form: HTTP POST key-value pairs

Example

Example configuration to create a forum thread using webhook data:

{
  "announcement_published": {
    "content_type": "form",
    "key": "example-key",
    "actions": [
      {
        "name": "PostThread",
        "options": {
          "userId": 1,
          "forumId": 2,
          "subject": ["Discuss: %s", "post_title"],
          "message": ["Please discuss [url=%s]%s[/url] here.", "post_url", "post_title"]
        }
      }
    ]
  }
}

URL: misc.php?action=webhook_actions&receiver=announcement_published&key=example-key

mybb-webhookactions's People

Contributors

dvz avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

sama34

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.