Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  MessagingService.startConversation does not trigger backend POST in headlessMode=true

    Posted 04-13-2025 18:47
    Edited by Syed Noman Hassan 04-14-2025 09:02

    I am developing a custom Messenger user interface using the Headless Mode SDK and have created an HTML page for its integration. The conversation is successfully routed to Genesys Cloud, and the agent receives the interaction. However, the conversation between the agent and the customer is not initiating as expected.

    I can see the configuration received in my console logs;

    Configuration Received 

    1. {id: '****', version: '9', headlessMode: {…}, languages: Array(1), defaultLanguage: 'en-us', …}
      1. apiEndpoint: "https://api.cac1.pure.cloud"
      2. defaultLanguage: "en-us"
      3. id: "***"
      4. status: "Active"
      5. version: "9"
      6. [[Prototype]]: Object
        1. __proto__: (...)

    The SDK ready function is working as expected.  ✅ MessagingService.ready

        Genesys("subscribe", "MessagingService.ready", () => {
          console.log("✅ MessagingService.ready");
          document.getElementById("startBtn").disabled = false;
        });

    Configure Conversation is also working  => ✅ configureConversation

        function configureConversation(retry) {
          Genesys("command", "MessagingService.configureConversation", {},
            (resp) => {
              console.log("✅ configureConversation:", resp);
              if (resp && resp.isSessionActive) {
                console.log("▶️ Resuming session:", resp.conversationId);
                isConversationActive = true;
              } else {
                startNewConversation();
              }
            },
            (err) => {
              console.error("❌ configureConversation error:", err);
              if (!retry) {
                console.log("🔁 Retrying configuration...");
                resetAndConfigure(true);
              }
            }
          );
        }

    startNewConversation is not trigger backend POST from  Genesys Cloud. 

    function startNewConversation() {
          console.log("🚀 Attempting to start a new conversation...");

          try {
            Genesys("command", "MessagingService.startConversation", {
              channel: { type: "web" }
            },
            (resp) => {
              console.log("✅ New conversation started:", resp);
              isConversationActive = true;
            },
            (err) => {
              console.error("❌ startConversation error:", err);
              alert("❌ Failed to start conversation. Check console.");
            });

    We don't have any restriction under the domain configuration of Org Setting.

    Any guidance or assistance in resolving this issue would be greatly appreciated.


    #DigitalChannels

    ------------------------------
    Syed Noman Hassan

    ------------------------------



  • 2.  RE: MessagingService.startConversation does not trigger backend POST in headlessMode=true

    Posted 04-14-2025 09:16

    Hello Syed,

    I have moved your thread to our Developer community to help get you an answer to your issue.



    ------------------------------
    Jason Kleitz
    Online Community Manager/Moderator
    ------------------------------



  • 3.  RE: MessagingService.startConversation does not trigger backend POST in headlessMode=true
    Best Answer

    Posted 04-15-2025 12:17

    Hi @Syed Noman Hassan,

    From your config posted here, I'm not able to see the content of `messenger.apps` object to see if auto starting the conversation is enabled. Either way, I will try answering both cases.

    In general, `MessagingService.startConversation` command cannot be used when you are using `MessagingService.configureConversation` command because both do the same thing except when autoStart is enabled. How it differs, is discussed in the documentation here. In your case, when did configureConversation, the connection is already established and session is active. So, running MessagingService.startConversation command will simply be rejected because session is already active.

    At this stage:

    1. When autoStart is not enabled in your configuration, you can start using `MessagingService.sendMessage` command to send messages - docs here. Note that, this is not a POST request but messages are sent with in the existing WebSocket connection that is made when doing configureConversation.
    2. When autoStart is enabled, you must use `MessagingService.joinConversation` command as discussed here and then start sending messages after it is has started.

    Let us know if this helps.

    Thanks,

    Ranjith Sai



    ------------------------------
    Ranjith Manikante Sai
    Senior Manager, Development
    ------------------------------



  • 4.  RE: MessagingService.startConversation does not trigger backend POST in headlessMode=true

    Posted 04-21-2025 09:39

    Thanks! 
    I've used MessagingService.joinConversation as autoStart enabled in my deployment. 

    Regards,

    Noman



    ------------------------------
    Syed Noman Hassan
    Sr Lead Applications Developer Analyst
    ------------------------------