Skip to main content

In-App Generic Action / Chat

InApp Generic Action / Chat enables brokers to integrate custom actions and support chat functionality directly within cTrader. This module provides a flexible framework for implementing broker-specific features and customer support while maintaining the seamless user experience.

Overview

The InApp Generic Action / Chat module enables:

  • Custom broker actions within cTrader interface
  • Integrated support chat functionality
  • Flexible action framework for broker-specific features
  • Real-time communication capabilities
  • Extensible architecture for custom integrations

Prerequisites

Before implementing InApp Generic Action / Chat, ensure completion of:

Architecture

Integration Flow

  1. User Initiation: User triggers custom action or chat in cTrader
  2. Token Generation: cTrader backend generates OT token for user context
  3. Screen Launch: Broker action/chat screen opens with token authentication
  4. Action Processing: User completes custom action or chat interaction
  5. Result Communication: Action result or chat status communicated back to cTrader

Authentication Methods

  • Full SSO: Long-term tokens with broker-owned identity
  • One-time token handoff: One-time tokens with cTrader identity provider

Implementation Flow

Generic Action Flow

Stage 1: User Initiation

  1. User triggers custom action

    • Triggers:
      • Custom button in cTrader interface
      • Menu item in broker section
      • InApp control/ribbon click
      • Automated workflow trigger
    • Context: User ID, account info, action type, parameters
  2. cTrader backend generates OT token

    • Endpoint: /ctid2/inAppOneTimeToken/data (One-time token handoff)
    • Context: User ID, account info, action type, custom parameters
    • Token: Short-lived token for broker authentication

Stage 2: Broker Screen Launch

  1. cTrader opens broker action screen

    • URL: https://brokerCrmUrl.com/inapp/action
    • Parameters: token, actionType, actionParams, lang, source, theme
    • Method: Opens in embedded browser/modal within cTrader
  2. Broker screen validates and loads

    • Token Validation: Verify OT token validity and user context
    • Action Routing: Route to appropriate action handler
    • User Context: Load user-specific data and preferences
    • Action Initialization: Initialize specific action workflow

Stage 3: Action Processing

  1. User completes custom action

    • Action Types:
      • Form submissions and requests
      • Account management operations
      • Educational content access
      • Promotional offer redemption
      • Survey or feedback collection
  2. Broker processes action

    • Business Logic: Execute broker-specific business logic
    • Data Processing: Process user input and data
    • System Integration: Integrate with broker backend systems
    • Result Generation: Generate action results

Stage 4: Completion and Communication

  1. Action completion

    • Result Status: Success, failure, or partial completion
    • Data Updates: Update relevant broker systems
    • User Notification: Provide confirmation to user
  2. Result communication to cTrader

    • Callback: Notify cTrader of action result
    • State Updates: Update relevant cTrader state if needed
    • User Notification: Show result to user in cTrader

Support Chat Flow

Stage 1: Chat Initiation

  1. User initiates support chat

    • Triggers:
      • Click support/chat button in cTrader
      • Automatic trigger based on user behavior
      • Proactive chat invitation from broker
    • Context: User ID, account info, chat context, reason
  2. cTrader backend generates OT token

    • Endpoint: /ctid2/inAppOneTimeToken/data (One-time token handoff)
    • Context: User ID, account info, action type "chat"
    • Token: Short-lived token for broker authentication

Stage 2: Chat Screen Launch

  1. cTrader opens broker chat screen

    • URL: https://brokerCrmUrl.com/inapp/chat
    • Parameters: token, chatReason, department, lang, source, theme
    • Method: Opens in embedded browser/modal within cTrader
  2. Broker chat system initializes

    • Token Validation: Verify OT token and user context
    • User Identification: Identify user in chat system
    • Chat History: Load relevant chat history if available
    • Agent Assignment: Assign to appropriate support agent

Stage 3: Chat Interaction

  1. User engages in chat conversation

    • Real-time Messaging: Exchange messages with support agents
    • File Sharing: Share documents or screenshots if needed
    • Co-browsing: Potential co-browsing for complex issues
    • Resolution: Work toward issue resolution
  2. Broker manages chat session

    • Agent Interface: Support agent handles conversation
    • Knowledge Base: Access knowledge base for quick answers
    • Escalation: Escalate to specialized support if needed
    • Quality Assurance: Monitor chat quality and satisfaction

Stage 4: Chat Completion

  1. Chat session conclusion

    • Resolution Status: Issue resolved, escalated, or follow-up required
    • Satisfaction Survey: Optional satisfaction survey
    • Transcript: Save chat transcript for reference
  2. Chat status communication

    • Callback: Notify cTrader of chat conclusion
    • Follow-up Actions: Schedule follow-up actions if needed
    • User Notification: Confirm chat completion to user

API specifications

This module does not define additional broker → cTrader endpoints. Token resolution depends on the identity module in use:

  • One-time token handoff: See Block B — the broker calls GET /ctid2/inAppOneTimeToken/data to resolve the OT token received via URL.
  • SSO User creation and authorisation: No broker → cTrader call is required; the OT token is validated via the broker CRM's /oauth2/onetime/authorize endpoint (called by cTrader, not the broker).

Required Screens

Generic Action Screen

  • URL: /inapp/action
  • Parameters: token, actionType, actionParams
  • Functionality:
    • Dynamic action loading based on actionType
    • Form rendering and validation
    • File upload capabilities
    • Progress tracking
    • Result display

Support Chat Screen

  • URL: /inapp/chat
  • Parameters: token, chatReason, department
  • Functionality:
    • Real-time messaging interface
    • Chat history display
    • File attachment support
    • Agent information display
    • Satisfaction survey

Educational Content Screen

  • URL: /inapp/education
  • Parameters: token, contentType, contentId
  • Functionality:
    • Educational content display
    • Video player integration
    • Progress tracking
    • Quiz/assessment functionality
    • Certificate generation

URL Examples

Generic Action URLs

<!-- Basic action URL -->
https://brokerCrmUrl.com/inapp/action?token=abc123&actionType=survey&lang=en

<!-- With parameters -->
https://brokerCrmUrl.com/inapp/action?token=abc123&actionType=promo&promoId=summer2023&lang=en

<!-- Educational content -->
https://brokerCrmUrl.com/inapp/education?token=abc123&contentType=video&contentId=forex101&lang=en

Chat URLs

<!-- Basic chat URL -->
https://brokerCrmUrl.com/inapp/chat?token=abc123&lang=en

<!-- With chat reason -->
https://brokerCrmUrl.com/inapp/chat?token=abc123&chatReason=deposit_issue&department=support&lang=en

<!-- Proactive chat -->
https://brokerCrmUrl.com/inapp/chat?token=abc123&chatReason=proactive&agentId=john_doe&lang=en