API equivalent of the Done button?

Good morning, :smiley:

So I'm having some trouble figuring this one out: I have a wrap-up form that appears when a call ends, and when the form submits it calls anInstanceOfYourConversationsApiObject.patchConversationsCallParticipant(passing in the conversation ID and a participant ID); At first, it just went with the caller's participant ID. Then I tried looping through the list of participants and calling that API endpoint with all participants that had wrapupRequired set to true. Then I have a notification that sends my app an update so I can hide the form. However... it seems no matter what participant ID I throw at it, this API endpoint is more like clicking on a wrap-up code (in the primary Genesys GUI). So when I submit it, I get the equivalent of "the user clicked on a wrap-up code but didn't hit Done" (one of our trainers caught this in Performance > Workspace). Is there a step-by-step tutorial someplace explaining how to complete/confirm/verify/finalize wrap-up? So far all I've managed to dig up is:

  • This article explaining that wrap-up is not as simple as it seems, as it revolves around participants rather than conversations (which, from my not-a-telephony-expert standpoint, makes absolutely no sense :laughing: ).
  • This article which gives a slightly better explanation, how wrap-up is "immutable" (in the Rust sense of the word, meaning unchangeable once finalized, unrelated to call mute/unmute) and (thankfully) mentioning an ongoing effort to move away from the strange participant thing and more to what we humans would expect, communications/conversations). That is awesome. I never would have gotten any of this from the actual API reference, but I'm so glad it's there. I will make sure to be on the look out for little articles like this in the future, where I can hopefully glean more meaningful information about how stuff works.
  • The (old?) SDK docs showing parameters and return values and all that important stuff. Seems to be consistent with API Explorer, which I know you guys are keeping more up-to-date or whatever. Unfortunately, it wasn't much help, but I expect that is just because the docs are still a work in progress.
  • I also asked an AI about this - it didn't seem to know either. :laughing:

So... I'm clearly doing something incorrectly, but after all my searching I haven't figured out what to do about it. I've always been lousy at scavenger hunts, but I'd be willing to bet the answer is hiding in plain sight someplace. :laughing: Any ideas?

So I went into the Network tab and think I found the missing puzzle piece: when I press "Done" to complete the wrap-up, it sends a second request to the PATCH function I linked to yesterday. Only for the third parameter (named "body" and described as just "Update request"), instead of a wrap-up code and notes, it sends this:

{"state": "DISCONNECTED"}

I haven't tried it in my code yet, but I'm curious about where I can find some additional docs on this. It makes sense why it would send this data... but the docs leave so many questions unanswered. What structure is this API end point expecting for "body"? It's an object, yes, the docs say that much (it is on most requests), but like okay, can I send the "state" at the same time as the wrap-up code? Or does it have to be done as two separate requests? Similarly, for participant ID... which participant? In my code I currently have it looping through the list and sending it to all participants with wrapupRequired set to true, but that in and of itself did not finalize the wrap-up. I think I must be looking in all the wrong places or something. Is there someplace besides API Explorer (which seems to just replicate what's in the SDK docs) where more info can be found?

In my ongoing research on this subject, I think I may have stumbled across the answer. Apparently, there is a POST endpoint (not PATCH) that "applies wrap-up for this conversation communication". Unfortunately, its docs are as minimalist as I've seen in other places... first off, I'm super familiar with conversation IDs... and a communication ID is...? I'm guessing it's another GUID - GUIDs are awesome (I"ve recently started using them in our unrelated apps too :laughing:) and participant IDs are GUIDs as well, so I suppose I can safely assume that... but where does it come from? How do I do the conversion from a conversation ID to a communication ID? Also, just like the (deprecated?) PATCH version, which participant goes in the participant ID field? It doesn't say. Here's a screenshot so you can see what I'm looking at:

As usual, I kind of feel like there must be some page I'm just not seeing. But at this point it's the only lead I've got, so I will continue to attack this problem using the hack'n'guess approach. :laughing:

EDIT: Did some more research, and got some more info that might be helpful in arriving at a more complete explanation: here are the docs on that other documentation sussystem, though they don't really tell me anything I wasn't already seeing in API Explorer... but, it's another lead in this research-compendium-as-a-forum-post. :laughing:

And I asked AI again, and it generated the guess I plan to experiment with next. Apparently, communication IDs are IDs for segments of calls. This doesn't really make a whole lot of sense, as "segments" are individual sentences and time on hold and stuff, so those are probably not the communication IDs I'm looking for.... but it's worth a shot.

Okay, so after struggling through this thing for a couple days, I finally got it wrapping up correctly. There was a mistake on my end (a missing "!" goofing things up) but the solution is still pretty different from what we currently have in production (the whole wrapupRequired thing I didn't know about the first time around), so I figured this is worth sharing in case anyone else runs into this question going forward. My code is something like this (but with more logging):

/**
 * Wraps up a call
 * @param {string} id A Genesys conversation ID (36-char GUID)
 * @param {string} code The wrap-up code (same format)
 * @param {string} notes Any notes the user added
 * @todo Decide on a return value (I think the API endpoint is another void)
 */
async function WrapUpCall(id, code, notes) {
	try {
		// Get a list of participants for the conversation.
		// Note that "conversations" is a Genesys ConversationsApi instance
		var c = await conversations.getConversation(id),
			p = c.participants;
		
		// Loop through the participants, sending wrap-up info to all who require it
		for (var i=0; i<p.length; i++) {
			
			// Skip the ones that don't need wrap-up
			if (!p[i].wrapupRequired) continue;
			
			// If it gets here, then wrap-up IS required, so send it
			await conversations.patchConversationsCallParticipant(id,
				p[i].id, { wrapup: { code: code, notes: notes } });
		}
	} catch(error) {
		// Error handler - in my code this is more logging
		console.log("Error wrapping up: ", error);
	}
}

I've checked in the primary Genesys GUI (under Performance > Workspace > My Interactions) and confirmed that it's saving the correct wrap-up code now, and also any notes I've added. Some of the other angles I tried on this turned out to be wild goose chases:

  • That POST method I mentioned in my previous entry has no SDK wrapper, and even Genesys itself doesn't use it. I'm guessing it's deprecated or something, though it's still in the docs (cuz deprecated != obsolete, lol). That or it's the next thing that's not really done yet. Won't say I've never released code with bits that are not done yet. :laughing:
  • That other idea about "state: DISCONNECTED" doesn't look like it's necessary... although Genesys' GUI does do it, there's nothing in the docs saying that we should. More importantly, this accomplishes what I wanted: to finalize wrap-up so users can move on to the next call. So I'm calling this solved, and hoping it helps save somebody else a few days' guesswork. :smiley:

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.