Marketing Campaigns & Social Media Connecting NetSocial Accounts

Connect your platform to NetSocial to seamlessly manage social media channels, automate posting, and synchronize client data. This guide covers how to provision new NetSocial accounts, sync existing ones, configure timezones, and manage posting channels.


A client must have a valid NetSocial ID (nsid) configured to post content or access NetSocial features. An nsid of "0" or blank means the integration is inactive.

Provisioning a New NetSocial Account

If a client does not already have a NetSocial account, you can provision one directly from the system. This creates a new company profile in NetSocial and automatically links it to the client.

  1. 1

    Ensure required information is present

    The client record must have a valid Company Name (or regular Name) and a Website URL. The website is used to establish the domain in NetSocial.

  2. 2

    Provision the company

    Trigger the provisioning process. The system will send the client's name, website, and automatically calculated timezone to NetSocial.

  3. 3

    Verify the connection

    Upon success, NetSocial returns a unique client ID. The system automatically saves this as the client's nsid, activating their NetSocial capabilities.


Provisioning will fail if the client already has an nsid configured, or if the client name is missing.

Syncing Existing NetSocial IDs

For clients who already exist in the Haley Marketing Group (HMG) ecosystem, you can synchronize their IDs rather than creating a new account.

The sync process looks up the client in the HMG API using their website domain.

sequenceDiagram
    participant User
    participant System
    participant HMG_API as HMG API
    
    User->>System: Trigger ID Sync
    System->>System: Extract domain from client website
    System->>HMG_API: Request client by domain
    HMG_API-->>System: Return nsid, aid, and pwfId
    System->>System: Update client records
    System-->>User: Sync successful


The HMG_API_KEY environment variable must be configured for the sync to work. If a client's website is missing, the sync will be aborted.

Managing Channels and Accounts

Once connected, clients can configure specific social media accounts and channels for their marketing campaigns.

Default Channels

When posting content, the system will attempt to use the client's configured default channels and accounts.

  • If a default channel is explicitly set, the system uses it.

  • If no default is set, the system automatically falls back to the first available channel returned by NetSocial.

Available Accounts

You can retrieve a list of all available NetSocial accounts for a client (e.g., to populate a dropdown menu in your UI). The system fetches these directly from the NetSocial API, returning the account ID, label, service type, and posting permissions.

Automatic Timezone Configuration

When provisioning a NetSocial account, the system automatically determines the correct timezone based on the client's location.

The system looks for the US State abbreviation in the following order:

  1. The client's direct state attribute.

  2. The contact_info JSON data (checking for state or province).

  3. The primary contact's address.

Once the state is identified, it maps to a timezone using the following rules:

TimezoneUS States
America/Los_AngelesCA, WA, OR, NV
America/DenverAZ, CO, UT, NM
America/ChicagoTX, OK, KS, NE, SD, ND, MN, IA, MO, AR, LA, MS, AL, TN, KY, IN, IL, WI, MI, OH
America/New_YorkFL, GA, SC, NC, VA, WV, MD, DE, PA, NJ, NY, CT, RI, MA, VT, NH, ME


If the state cannot be determined, or if it doesn't match any of the states listed above, the system defaults to America/New_York.

Troubleshooting

Why is a post failing with 'Client missing AID or nsid'?

This error occurs when the client's nsid is blank or set to "0". Verify that the client has been properly provisioned or synced. You can test the connection to confirm their status.

How do I force a fresh sync of NetSocial IDs?

When syncing IDs, the system typically caches the results. If a client is missing a newly added field (like pwfId), you can pass a force: true parameter to bypass the cache and fetch fresh data from the HMG API.

How can I test the NetSocial connection?

The system includes a built-in connection test that pings the NetSocial API using the client's configured nsid. If the test fails, ensure the API key is valid and the nsid matches an active NetSocial company.