Skip to main content
Version: 7.1.0

Implementing Push Notification

Here, we explain how to implement push notifications through the Firebase connector connected to the Interactor Engine.

You can get information about input variables in built-in-connectors page.

info

We support the Firebase connector for push notifications. Firebase

Steps

  1. Prepare Firebase Admin SDK
  2. Create the Platform Connector Variable with given Firebase admin SDK info
    • Query Parameters:
      • userId: connectorAccount
        • The connectorAccount is an account that contains the connector's own information.
    • Body Parameters:
      • name: connector_account
      • value: content of Firebase Admin SDK
    • Example CURL:
      • Replace value with the content of the your admin sdk json file
      curl --location 'http://localhost:1290/v1/platform/connector/firebase/variable?userId=connectorAccount' \
      --header 'Content-Type: application/json' \
      --header 'api_key: default' \
      --data-raw '{
      "name": "connector_account",
      "value": {
      "type": "connector_account",
      "project_id": "your_project_id",
      "private_key_id": "your_private_key_id",
      "private_key": "-----BEGIN PRIVATE KEY-----\nyour_private_key\n-----END PRIVATE KEY-----\n",
      "client_email": "your_client_email",
      "client_id": "your_client_id",
      "auth_uri": "https://accounts.google.com/o/oauth2/auth",
      "token_uri": "https://oauth2.googleapis.com/token",
      "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
      "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-ye1yh%40interactor-418406.iam.gconnectoraccount.com",
      "universe_domain": "googleapis.com"
      }
      }'
  3. Get a server access token
    • You need to get a server access token with user connectorAccount.
    • It only needs to be created once during the initial setup.
    • Example Curl:
      curl --location 'http://localhost:1290/v1/connector/firebase/oauth?userId=connectorAccount' \
      --header 'api_key: default'
  4. Get a device Id from the client and send it to the Interactor Engine
    • You should implement below in your client:
      1. initialize app
      2. initialize getMessaging
      3. get a permission from the user
      4. send a device token to the Interactor Engine
      • Example Curl:
        curl --location 'http://localhost:1290/v1/subscription?userId=your_user_id' \
        --header 'Content-Type: application/json' \
        --header 'api_key: default' \
        --data '{
        "platform": "interactor",
        "connector": "firebase",
        "trigger": "push.registered",
        "variables": {
        "token": "your_device_token"
        }
        }'
  5. Send a push notification
    • Once you're ready, you can send a push notification to the user using execute api
    • Example Curl:
      curl --location 'http://localhost:1290/v1/connector/firebase/action/push.send/execute?userId=your_user_id' \
      --header 'Content-Type: application/json' \
      --header 'api_key: default' \
      --data '{
      "notification": {
      "title": "push test",
      "body": "11231231"
      }
      }'