batch_elixir v0.2.2 BatchElixir View Source
Documentation for BatchElixir. Rest client for interating with the Batch API.
You have to define in your application this configuration:
config :batch_elixir,
rest_api_key: "rest api key", # Required, if not provided the application fail to start
devices: [web: "sdk key", ios: "sdk key", ...], # List of devices that the notification can use. The key name are up to you
default_deeplink: "myapp://",
producer_name: BatchElixir.Server.Producer, # Default, name of the producer is BatchElixir.Server.Producer
consumer_options: [], # Default to empty, extra options like mix/max demand for Genstage
producer_options: [], # extra options for GenStage as producer. Typically [buffer_size: 10_000]
batch_url: "https://api.batch.com/1.1/", # Base url of batch api
retry_interval_in_milliseconds: 1_000, # Interval between each failed requests
max_attempts: 3, # Maximum attempts of failed requests
number_of_consumers: 1, # Number of consumers to pop. By default is 1
stats_driver: BatchElixir.Stats.Memory # BatchElixir.Stats.Memory For In memory stats or BatchElixir.Stats.Statix to send to datadog via Statix
Link to this section Summary
Functions
Send a notifcation to one or more users using the producers/consumers
Link to this section Functions
Link to this function
send_notication(device, group_id, custom_ids, title, message, deeplink \\ nil, custom_payload \\ nil, labels \\ [], gcm_collapse_key_enabled \\ nil) View Source
Send a notifcation to one or more users using the producers/consumers
custom_payload
can be either a string, structure or a map.
If it's not provide or the value is nil, then no custom_payload will be include to the request.
If the API key for the device
does not exists return {:error, reason}
,
otherwise returns :ok
.