# Onboarding

Provides real-time updates regarding new user registrations from your application.

{% hint style="info" %}
**Authentication required.** Please refer to the [WebSocket Authentication page here for more details.](https://docs.sfox.com/websocket-api/authentication)
{% endhint %}

### Subscription Instructions

| Feed Name                      |
| ------------------------------ |
| **`private.enterprise.users`** |

### Payload Details

<table><thead><tr><th width="201.33333333333331">Key</th><th width="539">Description</th></tr></thead><tbody><tr><td><strong><code>account_type</code></strong></td><td>Individual or Corporation</td></tr><tr><td><strong><code>account_role</code></strong></td><td>Advisor or Client</td></tr><tr><td><strong><code>user_id</code></strong></td><td>Unique ID shared between sFOX and your enterprise</td></tr><tr><td><strong><code>email</code></strong></td><td>Email address of the user</td></tr><tr><td><strong><code>first_name</code></strong></td><td>First name of the user</td></tr><tr><td><strong><code>last_name</code></strong></td><td>Last name of the user</td></tr><tr><td><strong><code>phone_number</code></strong></td><td>Phone number of the user</td></tr><tr><td><strong><code>status</code></strong></td><td>Verification status of the user’s sFOX account</td></tr><tr><td><strong><code>requirements</code></strong></td><td>Status of verification requirements of the user's sFOX account</td></tr><tr><td><strong><code>user_token</code></strong></td><td><p>A User Auth Token for this <code>partner_user_id</code> .</p><p>The authentication token that your application will use to access this specific user’s account</p></td></tr></tbody></table>

### Example Code

{% tabs %}
{% tab title="NodeJS" %}

```javascript
const WebSocket = require('ws')

const ws = new WebSocket('wss://ws.sfox.com/ws')

ws.on('open', function() {
  const authMessage = {
   type: 'authenticate',
   apiKey: `process.env.ENTERPRISE_API_KEY`,
   enterprise: 'true'
  }
  
  ws.send(JSON.stringify(authMessage))
})

// After successful authentication, subscribe to users feed
const subscribeMsg = {
  type: 'subscribe',
  feeds: ['private.enterprise.users']
}

ws.send(JSON.stringify(subscribeMsg))
```

{% endtab %}

{% tab title="Python" %}
{% code overflow="wrap" %}

```python
import asyncio
import json
import websockets
import os

async def main(uri):
    async with websockets.connect(uri) as ws:
        await ws.send(json.dumps({
            "type": "authenticate",
            "apiKey": f"{os.environ['ENTERPRISE_API_KEY']}",
            "enterprise": "true"
        }))

        # After successful authentication message, subscribe to the users feed
        await ws.send(json.dumps({
            "type": "subscribe",
            "feeds": ["private.enterprise.users"]
        }))
        async for msg in ws:
            print(msg)


asyncio.run(main("wss://ws.sfox.com/ws"))
```

{% endcode %}
{% endtab %}

{% tab title="Response: New" %}

```json
{
  "sequence": 5,
  "recipient": "private.enterprise.users",
  "timestamp": 1717005327995988841,
  "payload": {
    "user_id": "client_09e487c9-9b75-4ef5-be06-b3e5661f68e5",
    "first_name": "Brando",
    "last_name": "Marks",
    "email": "bruno@mailinator.com",
    "phone_number": "+12223334444",
    "account_role": "Client",
    "account_type": "individual",
    "status": "PENDING",
    "user_token": {
      "token": "2000611ea497d8ae4832c52166e0a26162cbb74716ab2662c50f8b47cdad3979",
      "expires": "2024-05-30T17:55:27.981Z",
      "partner_user_id": "client_09e487c9-9b75-4ef5-be06-b3e5661f68e5"
    },
    "requirements": {
      "sms": true,
      "email": true
    }
  }
}
```

{% endtab %}

{% tab title="Response: Verified" %}

```json
{
  "sequence": 5,
  "recipient": "private.enterprise.users",
  "timestamp": 1717005327995988841,
  "payload": {
    "user_id": "client_09e487c9-9b75-4ef5-be06-b3e5661f68e5",
    "first_name": "Brando",
    "last_name": "Marks",
    "email": "bruno@mailinator.com",
    "phone_number": "+12223334444",
    "account_role": "Client",
    "account_type": "individual",
    "status": "VERIFIED",
    "user_token": {
      "token": "2000611ea497d8ae4832c52166e0a26162cbb74716ab2662c50f8b47cdad3979",
      "expires": "2024-05-30T17:55:27.981Z",
      "partner_user_id": "client_09e487c9-9b75-4ef5-be06-b3e5661f68e5"
    },
    "requirements": {
      "sms": false,
      "email": false
    }
  }
}
```

{% endtab %}
{% endtabs %}
