INTEGRATIONS · GENESYS CLOUD CHAT · TOOL

Bot Chat Tester

Run a HiveCFM survey as a chat, the way a Genesys customer would see it. Each message is one POST /api/v1/management/bot-connector/turn; the right-hand log shows the exact JSON on the wire. Responses land in the survey like real ones, with Source = genesys_bot_connector.

Connection

Caller

Survey

● botState —intent —
No chat yet. Enter an API key and press Start new chat. The first reply is the first survey question, with its buttons. In Auto-select the survey is chosen by the API from the channel, language and interaction type first.
Wire log newest first
Each request and response appears here exactly as sent and received.
⚠️

Every chat creates a real response in the target survey. Use a test survey, or filter by agentId = TEST-A12345 when reading results.

Two ways to pick the survey

Manual ID — you type the id and it goes straight into parameters.surveyId, as before. One thing did change: interactionType and contactId are now sent on turn in both modes, because Genesys sends its session slots whichever way the survey was chosen. So a manual-mode chat now also writes interactionType into Response.data. Clear the Interaction type field if you want the exact pre-change payload.

Auto-select — the real routing path. Before the chat starts, the page calls POST /api/v1/management/survey/select-relevant-survey with the selection attributes, and HiveCFM answers with the survey it chose. Only then does turn 1 go out, carrying that surveyId. The selection endpoint is never bypassed: no answer, no chat. Resolve survey only runs just the selection call, so you can see the decision without creating a response.

Interaction Type is a free-text field: type anything, including a value no survey binds, because reproducing a wrong value from a Genesys flow is a real test. The suggestions under the field are the values the environment’s own catalog holds — survey_selection_attributes.allowed_values, which the migrator fills from the legacy disposition-code catalog (CFMDispCode.DispCode). For STC-BH Consumer that is Agent, Bot, WhatsApp-testing. The hint tells you whether what you typed is in that catalog, since an unbound value is the usual reason selection answers 404. The list is read from the snapshot, never invented here; for an environment with no snapshot there are no suggestions and the hint says so.

Whatever you pick is sent twice, for two different jobs:

WhereWhat it does
parameters.interactionType on select-relevant-surveya selection attribute — it chooses the survey
parameters.interactionType on turna hidden field — it lands in Response.data

Leaving the field blank sends neither, which is the deliberate third case: a request carrying no catalog attribute can only be answered by a survey that has no conditions at all.

The contact resolves itself

Type any identifier and leave Create or update the contact first ticked. Before selection runs, the page calls PUT /api/v2/management/contacts/upsert with { environmentId, identifiers: ["userId"], attributes: { userId, …} }, shows the Contact.id that came back, and sends the identifier onward. So a test no longer starts with a database query for a userId that happens to exist — in STC-BH Consumer only 3 of 68,927 migrated contacts carry a userId attribute at all, which is why hunting for one was painful. New test contact fills in a throwaway bot-tester-….

Contact attributes fills the rest of the profile in the same call: firstName, lastName, email, phoneNumber. A blank box is not sent, because an empty value for a non-identifier key is a deliberate clear in the API — leaving a field empty would otherwise wipe a value the contact already has. The keys are the product’s own ContactAttributeKey.key spellings (phoneNumber, not phone): the upsert writes whatever key it is handed, so a misspelling silently creates a second attribute key instead of filling the one the Contacts table and segments read. The note and the panel list the attribute keys the API echoed back, so you can see exactly what was stored.

identifiers stays ["userId"] whatever you fill in. Adding email to it would widen the set of contacts the upsert considers a duplicate, and a merge hard-deletes everything it absorbs. If you leave both name fields empty, the API writes firstName = Customer_<userId> itself.

⚠️

The upsert merges and hard-deletes duplicate contacts that share an identifier (up to 25), and it is the product’s own write path — it syncs to the Hub and to Novu and writes an audit row. On a migrated environment, prefer a throwaway identifier over a real customer’s. Untick the box to send what you typed without writing anything; the identifier must then already exist, or selection answers 404.

It sends the userId value, not the Contact.id the upsert returns. Both resolve for selection — lookupContactByIdentifier tries the userId attribute first and the primary key second — but the response writer links a response with getContactByUserId, which reads the userId attribute only. Send a primary key and selection succeeds while Response.contactId stays null. That asymmetry is a core-API defect, not a tester limitation.

Linking to a ready-made case

The setup fields can be prefilled from the query string, so a test case can be handed over as a link: ?env=…&contact=…&mode=auto&interactionType=Bot&survey=…&lang=ar-SA&upsert=0. interactionType= (empty) omits the attribute, and upsert=0 unticks the contact upsert. Anything you leave out falls back to this tab’s last value, then to the page default. The API key is never read from or written to the URL — it stays in sessionStorage and you always type it once per tab.

Auto-select answers 404 Survey not found unless all four hold for at least one survey in the environment. A 404 here is nearly always configuration, not a bug:

  1. status is inProgress — getSelectableSurveys filters on it, so draft and paused surveys are never candidates. (Legacy Archived migrates to paused, so most migrated surveys are out.)
  2. surveySelection.enabled is true with a condition on interactionType. The migrator writes these conditions enabled: false on purpose — migrated surveys do not change routing until someone turns them on.
  3. a catalog row for interactionType exists in the environment (survey_selection_attributes). Catalog coverage drops any survey silent on an attribute the caller sent.
  4. a contactId, unless the survey sets allowAnonymous. Without an identified contact the anonymous gate removes the survey from the ranking.

What it sends

MomentRequest
Start new chat / Resolve survey only, when a contact identifier is set and the upsert box is tickedPUT /api/v2/management/contacts/upsert — environmentId, identifiers: ["userId"], attributes.userId. Answer: data.id, data.attributes
Start new chat, Auto-select onlyPOST survey/select-relevant-survey — sessionId, languageCode, parameters.environmentId, plus interactionType and contactId when set. Answer: surveyId, surveyType, match.matchedCount / priority / isFallback / matchedSurveys
Start new chatnew botSessionId + genesysConversationId; inputMessage { type: "Text", text: "start" }; parameters.surveyId, parameters.environmentId, conversationId, agentId, interactionType, contactId, channel: "webchat"
Click a buttonsame session; inputMessage { type: "Structured", content: [{ contentType: "ButtonResponse", buttonResponse: { text, payload } }] } — the shape Genesys uses for quick replies
Type and sendsame session; inputMessage { type: "Text", text }
Check APIGET /api/v1/management/bot-connector/bots

The page calls its own origin. On dev-hub.hivecfm.io, four CloudFront behaviors forward to dev.hivecfm.io — /api/v1/management/bot-connector/*, /api/v1/management/survey/*, /api/v1/management/surveys/* and /api/v2/management/contacts/* — each with caching disabled and every viewer header except Host passed through, so x-api-key arrives intact. The HiveCFM API sends no CORS headers, so a direct cross-origin call from the browser would be blocked. The API key is kept in this browser tab only (sessionStorage) and is sent as the x-api-key header.

A path that is not forwarded answers with an HTML body — CloudFront’s own 403 page, or the hub’s static 404. The API itself always answers JSON, so the tester treats any HTML body as a forwarding problem and says so, instead of reporting it as an API error. If you add a tool that calls a fifth management path, it needs its own behavior.

Reading the result

  • botState MoreData: waiting for the customer. Complete: finished (survey_complete) or opted out (survey_opted_out). Failed: survey_error, see the message in the log.
  • 401 in the log: key missing, unknown, or without write on that environment. write is enough for the selection call too — hasPermission maps GET to read, and write satisfies read.
  • In Auto-select, the panel and the survey … chip above the thread name the survey that was chosen, and the note carries matched N from match.matchedCount — how many surveys the attributes matched before priority broke the tie.
  • Typing stop, quit, cancel, unsubscribe, opt out, optout or no thanks ends the chat.
  • With Validate responses on in the survey, an answer that matches no button returns the invalid-response message and repeats the question.

Other ways to test

ToolWhenHow
Postman collectionscripted checks, CI (newman)set apiKey; run 1. Start survey, then 2. Send answer with the answer variable
Local testerany machine, any HiveCFM hostnode bot-chat-tester.js → http://localhost:8080; env TARGET, API_KEY, ENV_ID, SURVEY_ID, PORT, HOST. A server API_KEY is used only on loopback unless ALLOW_SHARED_KEY=1; proxy calls are accepted only from the tester page.
Genesys Web Messengerthe real end-to-end pathneeds a Bot Connector integration on dev, an Inbound Message flow and a Messenger deployment — see Genesys Bot Connector

The tester and Postman exercise HiveCFM’s side of the contract. Only a Genesys Messenger chat proves the Architect flow and the integration settings.


HiveCFM Developer Hub — internal team guide