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

Discord webhook support per user #59

Open
sts-ryan-holton opened this issue Aug 7, 2022 · 0 comments
Open

Discord webhook support per user #59

sts-ryan-holton opened this issue Aug 7, 2022 · 0 comments

Comments

@sts-ryan-holton
Copy link

I've seen a few webhook questions on here before, but I'm sure the assumption here is a one app, one system approach. What I have is a notifications systems, whereby every customer on my platform needs to integrate Discord, so, the webhook will be different per user, and they'll set it on their profile.

How can I send a notification then to their webhook's url channel?

This is my current routing on my User model to obtain their webhook:

/**
 * Route notifications for the Discord channel.
 */
public function routeNotificationForDiscord($notification)
{
    try {
        $availableIntegration = AvailableIntegration::where('slug', 'discord')
                                                    ->first();

        $userIntegration = UserIntegration::where('user_id', $this->id)
                                          ->where('available_integration_id', $availableIntegration->id)
                                          ->first();

        if (!$userIntegration) {
            return null;
        }

        return $userIntegration->schema->discord_webhook;
    } catch (\Exception $e) { }

    return null;
}
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

No branches or pull requests

1 participant