Module: MagicBell::Client::Notifications

Included in:
MagicBell::Client
Defined in:
lib/magicbell/client/notifications.rb

Instance Method Summary collapse

Instance Method Details

#create_notification(to, title, content, action_url) ⇒ Object

Creates a notification for a given project

Parameters:

  • to (String)

    Email of a user for this notification

  • title (String)

    Title of the notification

  • content (String)

    Content of the notification

  • action_url (String)

    Url to redirect to from widget



10
11
12
13
14
15
16
17
# File 'lib/magicbell/client/notifications.rb', line 10

def create_notification(to, title, content, action_url)
  params = {to: to, title: title, content: content, action_url: action_url}

  connection.post("/notifications.json") do |req|
    req.headers = {"X-MAGICBELL-API-SECRET" => MagicBell.api_secret}
    req.body = {notification: params}
  end
end