Onesignal Elixir v0.1.5 OnesignalElixir.Builder View Source

Link to this section Summary

Functions

Notification.new()

|> Builder.add_app_url("https://xcelerator.ninja")

Notification.new()

|> Builder.add_content(:en, "Welcome to One Signal")
|> Builder.add_content(:es, "Bienvenido a One Signal")

Notification.new()

|> Builder.add_data(%{entity: "user", id: 23})

Notification.new()

|> Builder.add_filters(filters)

Notification.new()

|> Builder.add_heading(:en, "Hello")
|> Builder.add_heading(:es, "Hola")

Notification.new()

|> Builder.add_subtitle(:en, "Welcome")
|> Builder.add_subtitle(:es, "Bienvenido")

Notification.new()

|> Builder.add_url("https://xcelerator.ninja")

Notification.new()

|> Builder.big_picture("https://xcelerator.ninja/static/media/main-logo.ff98436a.png")

Notification.new()

|> Builder.buttons([{"Share","ic_menu_share"},{"Send","ic_menu_send"}])

Notification.new()

|> Builder.exclude_segment("Active Users")

Notification.new()

|> Builder.exclude_segments(["Active Users", "Paid Users"])

Notification.new()

|> Builder.include_segment("Active Users")

Notification.new()

|> Builder.include_segments(["Active Users", "Paid Users"])

Notification.new()

|> Builder.set_grouping("campaign_123")

10 being highest priority

Notification.new()
|> Builder.set_priority(10)

“2015-09-24 14:00:00 GMT-0700”

Max value to set is 2419200 seconds (28 days).
Notification.new()
|> Builder.set_send_after("2015-09-24 14:00:00 GMT-0700")

The default is 259,200 seconds (3 days).

Max value to set is 2419200 seconds (28 days).
Notification.new()
|> Builder.set_ttl(86400)

Link to this section Functions

Link to this function add_app_url(notification, app_url) View Source
Notification.new()
|> Builder.add_app_url("https://xcelerator.ninja")

%{app_url: "https://xcelerator.ninja"}
Link to this function add_content(notification, language, content) View Source
Notification.new()
|> Builder.add_content(:en, "Welcome to One Signal")
|> Builder.add_content(:es, "Bienvenido a One Signal")

%{contents: %{en: "Welcome to One Signal", es: "Bienvenido a One Signal"}}
Link to this function add_data(notification, data_map) View Source
Notification.new()
|> Builder.add_data(%{entity: "user", id: 23})

%{data: %{entity: "user", id: 23}}
Link to this function add_filters(notification, filters) View Source
Notification.new()
|> Builder.add_filters(filters)

%{filters: [
            %{field: "last_session", hours_ago: "1.2", relation: ">"},
            %{operator: "AND"},
            %{field: "app_version", relation: "=", value: "2"},
            %{operator: "OR"},
            %{field: "first_session", hours_ago: "1.2", relation: "<"},
            %{operator: "AND"},
            %{field: "tag", key: "key2", relation: "=", value: "value2"}
            ]}
Link to this function add_heading(notification, language, heading) View Source
Notification.new()
|> Builder.add_heading(:en, "Hello")
|> Builder.add_heading(:es, "Hola")

%{headings: %{en: "Hello", es: "Hola"}}
Link to this function add_subtitle(notification, language, subtitle) View Source
Notification.new()
|> Builder.add_subtitle(:en, "Welcome")
|> Builder.add_subtitle(:es, "Bienvenido")

%{subtitles: %{en: "Welcome", es: "Bienvenido"}}
Link to this function add_url(notification, url) View Source
Notification.new()
|> Builder.add_url("https://xcelerator.ninja")

%{url: "https://xcelerator.ninja"}
Link to this function big_picture(notification, big_picture) View Source
Notification.new()
|> Builder.big_picture("https://xcelerator.ninja/static/media/main-logo.ff98436a.png")

%{big_picture: "https://xcelerator.ninja/static/media/main-logo.ff98436a.png"}
Link to this function buttons(notification, buttons_data) View Source
Notification.new()
|> Builder.buttons([{"Share","ic_menu_share"},{"Send","ic_menu_send"}])

%{buttons:  [
                %{icon: "ic_menu_share", id: "id0", text: "Share"},
                %{icon: "ic_menu_send", id: "id1", text: "Send"}
            ]}
Link to this function exclude_segment(notification, segment_name) View Source
Notification.new()
|> Builder.exclude_segment("Active Users")

%{excluded_segments: ["Active Users"]}
Link to this function exclude_segments(notification, segments) View Source
Notification.new()
|> Builder.exclude_segments(["Active Users", "Paid Users"])

%{excluded_segments: ["Active Users", "Paid Users"]}
Link to this function include_segment(notification, segment_name) View Source
Notification.new()
|> Builder.include_segment("Active Users")

%{included_segments: ["Active Users"]}
Link to this function include_segments(notification, segments) View Source
Notification.new()
|> Builder.include_segments(["Active Users", "Paid Users"])

%{included_segments: ["Active Users"]}
Link to this function set_grouping(notification, group) View Source
Notification.new()
|> Builder.set_grouping("campaign_123")

%{android_group: "campaign_123"}
Link to this function set_priority(notification, priority) View Source
10 being highest priority
Notification.new()
|> Builder.set_priority(10)

%{priority: 10}
Link to this function set_send_after(notification, send_after) View Source
"2015-09-24 14:00:00 GMT-0700"
Max value to set is 2419200 seconds (28 days).
Notification.new()
|> Builder.set_send_after("2015-09-24 14:00:00 GMT-0700")

%{send_after: "2015-09-24 14:00:00 GMT-0700"}
Link to this function set_ttl(notification, ttl) View Source
The default is 259,200 seconds (3 days).
Max value to set is 2419200 seconds (28 days).
Notification.new()
|> Builder.set_ttl(86400)

%{ttl: 86400}