onesignal

Create or update a new OneSignal application

You can use this action to automatically create or update a OneSignal application. You can also upload a .p12 with password, a GCM key, or both.

onesignal
Supported platforms ios, android
Author @timothybarraclough, @smartshowltd

2 Examples

onesignal(
  auth_token: "Your OneSignal Auth Token",
  app_name: "Name for OneSignal App",
  android_token: "Your Android GCM key (optional)",
  android_gcm_sender_id: "Your Android GCM Sender ID (optional)",
  apns_p12: "Path to Apple .p12 file (optional)",
  apns_p12_password: "Password for .p12 file (optional)",
  apns_env: "production/sandbox (defaults to production)",
  organization_id: "Onesignal organization id (optional)"
)
onesignal(
  app_id: "Your OneSignal App ID",
  auth_token: "Your OneSignal Auth Token",
  app_name: "New Name for OneSignal App",
  android_token: "Your Android GCM key (optional)",
  android_gcm_sender_id: "Your Android GCM Sender ID (optional)",
  apns_p12: "Path to Apple .p12 file (optional)",
  apns_p12_password: "Password for .p12 file (optional)",
  apns_env: "production/sandbox (defaults to production)",
  organization_id: "Onesignal organization id (optional)"
)

Parameters

Key Description Default
app_id OneSignal App ID. Setting this updates an existing app
auth_token OneSignal Authorization Key
app_name OneSignal App Name. This is required when creating an app (in other words, when :app_id is not set, and optional when updating an app
android_token ANDROID GCM KEY
android_gcm_sender_id GCM SENDER ID
apns_p12 APNS P12 File (in .p12 format)
apns_p12_password APNS P12 password
apns_env APNS environment production
organization_id OneSignal Organization ID

* = default value is dependent on the user's system


Lane Variables

Actions can communicate with each other using a shared hash lane_context, that can be accessed in other actions, plugins or your lanes: lane_context[SharedValues:XYZ]. The onesignal action generates the following Lane Variables:

SharedValue Description
SharedValues::ONE_SIGNAL_APP_ID The app ID of the newly created or updated app
SharedValues::ONE_SIGNAL_APP_AUTH_KEY The auth token for the newly created or updated app

To get more information check the Lanes documentation.


Documentation

To show the documentation in your terminal, run

fastlane action onesignal

CLI

It is recommended to add the above action into your Fastfile, however sometimes you might want to run one-offs. To do so, you can run the following command from your terminal

fastlane run onesignal

To pass parameters, make use of the : symbol, for example

fastlane run onesignal parameter1:"value1" parameter2:"value2"

It's important to note that the CLI supports primitive types like integers, floats, booleans, and strings. Arrays can be passed as a comma delimited string (e.g. param:"1,2,3"). Hashes are not currently supported.

It is recommended to add all fastlane actions you use to your Fastfile.


Source code

This action, just like the rest of fastlane, is fully open source, view the source code on GitHub


Back to actions