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

Feature: Webhooks #16

Open
akazorg opened this issue Nov 2, 2018 · 2 comments
Open

Feature: Webhooks #16

akazorg opened this issue Nov 2, 2018 · 2 comments
Assignees
Labels
feature New feature or request

Comments

@akazorg
Copy link
Member

akazorg commented Nov 2, 2018

We will have several WebHooks available with Mercurius.

List of WebHooks (WIP):

  • MessageSent » Message ($id, $sender, $message, $date)
  • UserGoesActive » User
  • UserGoesInactive » User
  • UserStatusChanged » User
  • ...

For saving WebHooks information, maybe we can use config/mercurius?

Example for config:

/*
    |--------------------------------------------------------------------------
    | WebHooks
    |--------------------------------------------------------------------------
    |
    | You may specify the WebHooks information, the URL address receiving the
    | HTTP POST callbacks, the Secret Token and the list of WebHooks to use.
    |
    */

    'webhooks' => [

        'url' => 'https://myappdomain.com',

        'secret_token' => env('MERCURIUS_WEBHOOKS_TOKEN', false),

        'events' => [
            'MessageSent'       => false,
            'UserGoesActive'    => false,
            'UserGoesInactive'  => false,
            'UserStatusChanged' => false,
        ],
    ],

Maybe, having a command to generate the MERCURIUS_WEBHOOKS_TOKEN to ease this process?

Please send your feedback. TY!

Ping: @marktopper

@akazorg akazorg added the feature New feature or request label Nov 2, 2018
@akazorg akazorg mentioned this issue Nov 2, 2018
14 tasks
@Braunson
Copy link

Braunson commented Nov 2, 2018

These could also be Broadcast events too..

@akazorg
Copy link
Member Author

akazorg commented Nov 3, 2018

Hey @Braunson, you can expect Broadcast Events, this will be released soon with #12 Broadcast User Status.

As for the WebHooks, @marktopper have another idea for the config, which is more flexible supporting custom settings per endpoint:

/*
|--------------------------------------------------------------------------
| WebHooks
|--------------------------------------------------------------------------
|
| You may specify the WebHooks information, the URL address receiving the
| HTTP POST callbacks, the Secret Token and the list of WebHooks to use.
|
*/

'webhooks' => [
    [
        'endpoint' => 'https://domain.com/script.php',

        'token' => env('MERCURIUS_TOKEN'),

        'events': [
            Launcher\Mercius\Events\MessageSent::class,
            Launcher\Mercius\Events\UserGoesActive::class,
        ]
    ],
    [
        'endpoint' => 'https://domain2.com/script.php',

        'token' => env('MERCURIUS_TOKEN'),

        'events': [
            Launcher\Mercius\Events\MessageSent::class,
        ]
    ]
],

Thanks for your feedback, fell free to join us on Slack.

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

No branches or pull requests

3 participants