How do I pass a response from a Webform custom handler back to Drupal to display on the confirmation page I have created a custom module for a custom Webform handler. The custom handler submits to an external SOAP api. There are various response options that are received back from the SOAP api that currently I am printing to screen (for testing purposes). But when using this module in production, I obviously want these responses to be displayed at the top of the confirmation page. 

Is there some way to populate a token (possibly the Webform Handler Response token?), which I can then use to print the information on my confirmation page? 

F
Your two options are… 

OPTION 1: Add the SOAP API's response value  as a hidden element's value using something like 

$webform_submission-&gt;setElementData('response_value', $response-&gt;value);
$webform_submission-&gt;resave();


OPTION 1: Store the response in $_SESSION and use 

\Drupal\webform\Plugin\WebformHandlerInterface::confirmForm
\Drupal\webform\Plugin\WebformHandlerInterface::preprocessConfirmation


to alter the confirmation message or page.