fix(psa): move CW clientId to server config, remove from user input
ClientId is a product-level GUID registered at developer.connectwise.com, not per-MSP. Moved to settings.CW_CLIENT_ID env var. MSPs now only provide site URL, company ID, public key, and private key. Also added newline handling note to post_note() — CW Developer Guide states \n is unsupported in JSON bodies. Needs sandbox testing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -199,6 +199,10 @@ class ConnectWiseProvider(PSAProvider):
|
||||
|
||||
note_flags = flags.get(note_type, flags[NoteType.INTERNAL_ANALYSIS])
|
||||
|
||||
# NOTE: CW Developer Guide states \n is "Not Supported" in JSON bodies
|
||||
# and may be collapsed to a single space. CW does support markdown in ticket
|
||||
# notes (see PSA-Markdown.md). This needs sandbox testing — if newlines are
|
||||
# lost, consider using double-space line breaks or HTML <br> tags instead.
|
||||
body: dict = {
|
||||
"text": text,
|
||||
**note_flags,
|
||||
|
||||
@@ -8,6 +8,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.models.psa_connection import PsaConnection
|
||||
from app.services.psa.base import PSAProvider
|
||||
from app.core.config import settings
|
||||
from app.services.psa.encryption import decrypt_credentials
|
||||
from app.services.psa.exceptions import PSAConnectionError
|
||||
|
||||
@@ -40,7 +41,7 @@ async def get_provider_for_account(
|
||||
company_id=connection.company_id,
|
||||
public_key=creds["public_key"],
|
||||
private_key=creds["private_key"],
|
||||
client_id=creds["client_id"],
|
||||
client_id=settings.CW_CLIENT_ID or "",
|
||||
)
|
||||
return ConnectWiseProvider(client)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user