Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

246
Views
How to set External_User_Id in OneSignal using web(js)?

I noticed that OneSignal is creating a unique player_id and adding a column in its database when my web app is loaded for the first time by any user.

I'm trying to add a custom external_user_id into the same one signal DB field using below code (as per OneSignal docs):

<script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" ></script>
<script>
let externalUserId = "123456789"; 

OneSignal.push(function() {
  OneSignal.setExternalUserId(externalUserId);
});
</script>

But somehow, the external_user_id field is still set to empty.

So I added the below code to it.

<script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" ></script>
<script>
let externalUserId = "123456789"; 

window.OneSignal = window.OneSignal || [];
OneSignal.push(function() {
    OneSignal.init({
        appId: "xoxoxoxoxoxoxoxoxo",
    });
});

OneSignal.push(function() {
  console.log("triggering");
  OneSignal.setExternalUserId(externalUserId);
  console.log("triggering");
});

It has no errors, yet external_user_id is still not updated.

This is the OneSignal code I have added to my Android Studio

package com.appgrep.xoxoxo;

import android.app.Application;

public class OneSignal extends Application {

    private static final String ONESIGNAL_APP_ID = "xoxoxoxoxoxoxoxoxo";

    @Override
    public void onCreate() {
        super.onCreate();

        // OneSignal Initialization
        com.onesignal.OneSignal.initWithContext(this);
        com.onesignal.OneSignal.setAppId(ONESIGNAL_APP_ID);
    }
}

I just am trying to add External_User_Id in OneSignal using Web (JS) Any help is greatly appreciated.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I think it's not possible through web buddy.

What you are trying to do is to update a field in onesignl using website. Which i don't think one signal let's you do.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!