Section I – SCXML > Web API > Action Elements Bottom of Page
| Genesys 8.0 SCXML Technical Reference
< Parameters Events >

## Action Elements

#### <response>

This action is used to send a response to a request-based event from an external application (for details see the Send Request to SCXML Session section). It is recommended that you use this action element within the `<transition>` element associated with event processing for the given request. If not, you may encounter network-related timeouts and potential performance issues.

##### Attribute Details

Name | Required | Type | Default Value | Valid Values | Description
--- | --- | --- | --- | --- | ---
requestid | true | value expression | none |  | This value expression returns the corresponding request ID which this response is for. Note: this must be the sendid property from the associated request event (that is, _event.sendid). See SCXML Legal Data Values and Value Expressions for details.
type | false | value expression | positive | positive negative | This value expression returns the type of response this is. Values defined are: positive — This indicates that the response is positive. negative — This indicates that the response is negative. See SCXML Legal Data Values and Value Expressions for details.
resultcode | false | value expression | none | any expression that results in a valid string | This value expression returns a string which will represent the result code associated with the response. See SCXML Legal Data Values and Value Expressions for details.

The following is an example of the response processing in the `<transition>` element:

    <state id="processing_requests_in_transition">
    	<transition event="DoFunctionX" cond="_event.data.paramtype == 'application/json' &amp;&amp; _event.data.param !=''">
    		<script>
    			<! — do specific function x logic ->
    		</script>
    		<ws:response requestid="_event.sendid">
    			<param name="op1" expr="ovar1"/>
    			<param name="op2" expr="ovar2"/>
    		</ws:response>
    	</transition>
    	<transition event="DoFunctionX" cond="_event.data.paramtype != 'application/json' || _event.data.param ==''">
    		<ws:response requestid="_event.sendid" type="negative" resultcode="invalidparameter"/>
    	</transition>
    </state>

The following is an example of the response processing in a sub-state model:

    <state id="processing_requests_in_substate_model">
    	<datamodel>
    		<data id="reqid"/>
    		<data id="functionXparms"/>
    	</datamodel>
    	<transition event="DoFunctionX" cond="_event.data.paramtype == 'application/json' &amp;&amp; _event.data.param !=''" target="functionX'>
    		<script>
    			_data.reqid = _event.sendid;
    			_data.functionXparms = _event.data.param;
    		</script>
    	</transition>
    	<transition event="DoFunctionX" cond="_event.data.paramtype != 'application/json' || _event.data.param ==''">
    		<ws:response requestid="_event.sendid" type="negative" resultcode="invalidparameter"/>
    	</transition>
    	<! — This is the substate model to execute the processing associated with function X ->
    	<state id="functionX" initial="fXStep1">
    		<state id="fXStep1">
    		</state>
    		...
    		<final>
    			<onentry>
    				<ws:response requestid="_event.sendid">
    					<param name="op1" expr="ovar1"/>
    					<param name="op2" expr="ovar2"/>
    				</ws:response>
    			</onentry>
    		</final>
    	</state>
    </state>

##### Children

- `<param>` Occurs 0 to N — This contains data to be passed in the HTTP response. See the Mapping of the SCXML and Functional Module Elements to the HTTP Messages section for details.

##### Events

None

Section I – SCXML > Web API > Action Elements Top of Page
| Genesys 8.0 SCXML Technical Reference
< Parameters Events >