Hello! I have a question regarding the integratio...
# support
h
Hello! I have a question regarding the integration of OneSignal using the Node.JS SDK integration. Looking at the documentation, it mentions that in the "identify" event of Rudder, I need to pass an "externalId" with the "playerId" inside. However, the structure expected by the SDK event is quite different from the structure in the documentation. I'm trying to send the "identifier" as well, but it's reporting an error saying that my identifier is incorrect, even though it's a MongoDB ID. OneSignal Documentation URL: https://www.rudderstack.com/docs/destinations/streaming-destinations/onesignal/ My code:
Copy code
javascript

rudder.identify({ userId: userTokens.userId, anonymousId: userTokens.unknownId, traits: { firstName: customer.name, email: customer.email, phone: customer.phoneNumber, city: customer.address ? customer.address.city.name : null, state: customer.address ? customer.address.state.name : null, country: 'Brazil', }, integrations: { oneSignal: { deviceType: 5, identifier: '657763981ac71deacd17b092', }, }, });
m
Hey There! 👋 Your message has been received by the RudderStack team. Our standard customer support hours are 9-6 PM EST, but we will forward this request to your Technical Account Manager, and they will get back to you shortly. Please use the thread for any additional comments.
Hi Caua, - What version of the NodeJS SDK are you using? - Can you share a sample payload (from the source)?
I understand that the oneSignal page shows a sample for JS SDK while you are actually using the NodeJS SDK.
h
Hi @shy-kite-21035, using NodeJS SDK version 2.40.2. The payload is: { "_metadata": { "nodeVersion": "18.16.1" }, "anonymousId": "c4e8c0ccd7df1a4c01bcb790cb303cde371062d238986455df623a78e8445f54", "channel": "server", "context": { "library": { "name": "analytics-node", "version": "2.0.6" }, "traits": { "city": "Santos", "country": "Brazil", "email": "caua.coelho@graodegente.com.br", "firstName": "Cauã Fernandes", "phone": "13991309009", "state": "São Paulo" } }, "integrations": { "oneSignal": { "deviceType": 5, "identifier": "7d264efe-75e2-4ad5-af97-6bac7e424bc7" } }, "messageId": "2c618397-5f95-46a6-9a33-f6087d22f8a6", "originalTimestamp": "2024-01-04T224031.653Z", "receivedAt": "2024-01-04T224032.635Z", "request_ip": "177.63.199.120", "rudderId": "861da20f-4fc5-47e8-81e4-485f0ffb153f", "sentAt": "2024-01-04T224031.654Z", "timestamp": "2024-01-04T224032.634Z", "traits": { "city": "Santos", "country": "Brazil", "email": "caua.coelho@graodegente.com.br", "firstName": "Cauã Fernandes", "phone": "13991309009", "state": "São Paulo" }, "type": "identify", "userId": "657763981ac71deacd17b092" }
Copy code
I've tried every way to create a new subscription in one signal but it all returns the following message:

{
  "error": "Correct identifier is required for creating a device (identify call)"
}
m
Hi Coehlo, Can you try using this format in the Node JS SDK?
s
Copy code
client.identify({
  userId: "1hKOmRA4GRlm",
  traits: {
    name: "Alex Keener",
    email: "alex@example.com",
    plan: "Free",
    friends: 21,
  }, 
  context: {
    externalId: [
        {
            type: "playerId",
            id: "Df344sdFgdDsS4"
        }
    ],
    integrations: { 
      oneSignal: { 
        deviceType: 5, 
        identifier: '657763981ac71deacd17b092' 
      } 
    }, 
  }
})