--- title: "system.secsgem.sendResponse" description: "Sends a JSON-formatted SECS response message to a message sent by a tool." --- # system.secsgem.sendResponse > Sends a JSON-formatted SECS response message to a message sent by a tool. This function is used in **Python Scripting**. ## Description Sends a JSON-formatted SECS response message to a message sent by a tool. An equipment connection must be configured for the tool in the Gateway, and this must be used within a Message Handler to create a [Custom Message Response Handler](ignition-modules\secs-gem\sec-gem-messages.md#custom-secs-message-response-handlers). ## Client Permission Restrictions This scripting function has no [Client Permission](../../../ignition-modules/vision/vision-project-properties/vision-project-properties.md#vision-permissions-properties) restrictions. ## Syntax `system.secsgem.sendResponse(transactionID, systemBytes, streamFunction, body, equipment)` ### Parameters Type | Parameter | Description ------- | ------- | ------ Integer| `transactionID` | The TxID of the response. The TxID from the received request in the payload of the message handler must be specified here. Integer| `systemBytes` | The SystemBytes of the response. The SystemBytes from the received request in the payload of the message handler must be specified here. String| `streamFunction` | The stream and function of the SECS message to send. Example: "S1F14" Any| `body` | This contains the body of a SECS response. The argument can be a Python Object or JSON string representing the body of a SECS message. If this argument is a string then it will be converted to a Python Object using the [system.util.jsonDecode](../system-util/system-util-jsonDecode.md) function. String| `equipment` | Name of the equipment connection to use. ### Returns Nothing ### Scope Gateway, Perspective Session ## Code Examples ```python title="Code Snippet - Sending a S1F1 Message" # This will create a logger that will print to the console that a custom response is happening for S6F12. # It will then send the response with system.secsgem.sendResponse(). equipment= payload['Equipment'] txId = payload['TxID'] systemBytes = payload['SystemBytes'] message = payload['Message'] msg = "Equipment=" + equipment msg += ", TxID=" + str(txId) msg += ", SystemBytes=" + str(systemBytes) msg += ", Message=" + message logger = system.util.getLogger("SECSGEM.Gateway.S6F12Handler") logger.info("S6F12Handler: Sending back response to S6F11 message:" + msg) body = '{"format":"B", "value": 0, "doc":"ACKC6, Acknowledge Code", "codeDesc": "Accepted"}' system.secsgem.sendResponse(txId, systemBytes, "S6F12", body, equipment) logger.info("S6F12Handler: S612 response sent") ```