Workflow Action - Custom webhook
Patient Copilot’s Custom Webhook workflow action lets you send real‑time data to external services using GET, POST, PUT, and DELETE requests. Configure auth, headers, query parameters, and JSON/form payloads to connect CRMs, apps, and custom APIs—without code. This article explains setup, best practices, and working examples to help you ship reliable integrations fast. * * * ## What is Custom Webhook? Custom Webhook is an outbound workflow action that makes an HTTP request to a URL you choose. When a workflow run reaches this step, Patient Copilot assembles your headers, parameters, and payload (including mapped dynamic values) and sends the request to the external system. * * * ## Key Benefits of Custom Webhook Understanding where Custom Webhook shines helps you pick the right automation tool and structure requests correctly for your provider. - Flexible methods: Use GET, POST, PUT, DELETE to match any API operation. - Authentication options: Bearer token, API key, Basic Auth, OAuth2, or No auth with custom headers. - Precise data mapping: Dynamic values (e.g., {{contact.email}}) populate headers, params, or body so every call includes the right record details. - Reusable patterns: Build once, reuse across workflows with consistent headers, content types, and payload shapes. - Faster troubleshooting: Optional response capture and workflow execution logs streamline testing and issue resolution. * * * ## Authentication Options External APIs often require credentials. Choose the option your provider supports and place secrets in headers—not URLs—for better security. - Bearer Token Use header Authorization: Bearer Authorization: Bearer {{location.api_token}} - API Key Most services expect a custom header (e.g., X-API-Key: X-API-Key: {{location.external_api_key}} - Query example (only if required):?api_key={{location.external_api_key}} - Basic Auth Provide Username and Password in the action’s Authorization fields. Patient Copilot sends the proper Authorization: Basic… header. - OAuth2 If your provider uses OAuth2, first configure the token in Global Workflow Settings → OAuth2 / Manage Tokens, then select it in the action. OAuth2 is recommended for providers that rotate or refresh tokens automatically. - No Auth + Custom Header If your provider asks for a bespoke header (e.g., X-Signature: Authorization: Bearer {{location.api_token}} Content-Type: application/json X-API-Key: {{location.external_api_key}} X-App-Version: 2024-11-01 - Query parameters (examples): lead_id={{contact.id}} email={{contact.email}} source=workflow - Avoid putting secrets in query strings unless your provider requires it. * * * ## Payload & Field Mapping Dynamic values let you personalize each request with contact, opportunity, or other workflow data—shaped to match the external API. - Flat JSON payload (POST / create): { "id": "{{contact.id}}", "first_name": "{{contact.first_name}}", "last_name": "{{contact.last_name}}", "email": "{{contact.email}}", "phone": "{{contact.phone}}" } - Nested JSON: ```
{ “contact”: { “id”: “{{contact.id}}”, “name”: “{{contact.name}}”, “phones”: [“{{contact.phone}}”], “tags”: [“{{contact.tag}}”, “new-lead”] } }