Skip to content

/AWS1/IF_QQC=>SENDMESSAGE()

About SendMessage

Submits a message to the Amazon Q in Connect session.

Method Signature

METHODS /AWS1/IF_QQC~SENDMESSAGE
  IMPORTING
    !IV_ASSISTANTID TYPE /AWS1/QQCUUIDORARN OPTIONAL
    !IV_SESSIONID TYPE /AWS1/QQCUUIDORARN OPTIONAL
    !IV_TYPE TYPE /AWS1/QQCMESSAGETYPE OPTIONAL
    !IO_MESSAGE TYPE REF TO /AWS1/CL_QQCMESSAGEINPUT OPTIONAL
    !IV_AIAGENTID TYPE /AWS1/QQCUUIDORARNOREITHERWQ00 OPTIONAL
    !IO_CONVERSATIONCONTEXT TYPE REF TO /AWS1/CL_QQCCONVERSATIONCTX OPTIONAL
    !IO_CONFIGURATION TYPE REF TO /AWS1/CL_QQCMESSAGECONF OPTIONAL
    !IV_CLIENTTOKEN TYPE /AWS1/QQCCLIENTTOKEN OPTIONAL
    !IV_ORCHESTRATORUSECASE TYPE /AWS1/QQCNONEMPTYSTRING OPTIONAL
    !IT_METADATA TYPE /AWS1/CL_QQCMESSAGEMETADATA_W=>TT_MESSAGEMETADATA OPTIONAL
    !IV_ORIGINREQUESTID TYPE /AWS1/QQCNONEMPTYSTRING OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_qqcsendmessagersp
  RAISING
    /AWS1/CX_QQCACCESSDENIEDEX
    /AWS1/CX_QQCCONFLICTEXCEPTION
    /AWS1/CX_QQCDEPENDENCYFAILEDEX
    /AWS1/CX_QQCREQUESTTIMEOUTEX
    /AWS1/CX_QQCRESOURCENOTFOUNDEX
    /AWS1/CX_QQCSERVICEQUOTAEXCDEX
    /AWS1/CX_QQCTHROTTLINGEX
    /AWS1/CX_QQCVALIDATIONEX
    /AWS1/CX_QQCCLIENTEXC
    /AWS1/CX_QQCSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_assistantid TYPE /AWS1/QQCUUIDORARN /AWS1/QQCUUIDORARN

The identifier of the Amazon Q in Connect assistant.

iv_sessionid TYPE /AWS1/QQCUUIDORARN /AWS1/QQCUUIDORARN

The identifier of the Amazon Q in Connect session.

iv_type TYPE /AWS1/QQCMESSAGETYPE /AWS1/QQCMESSAGETYPE

The message type.

io_message TYPE REF TO /AWS1/CL_QQCMESSAGEINPUT /AWS1/CL_QQCMESSAGEINPUT

The message data to submit to the Amazon Q in Connect session.

Optional arguments:

iv_aiagentid TYPE /AWS1/QQCUUIDORARNOREITHERWQ00 /AWS1/QQCUUIDORARNOREITHERWQ00

The identifier of the AI Agent to use for processing the message.

io_conversationcontext TYPE REF TO /AWS1/CL_QQCCONVERSATIONCTX /AWS1/CL_QQCCONVERSATIONCTX

The conversation context before the Amazon Q in Connect session.

io_configuration TYPE REF TO /AWS1/CL_QQCMESSAGECONF /AWS1/CL_QQCMESSAGECONF

The configuration of the SendMessage request.

iv_clienttoken TYPE /AWS1/QQCCLIENTTOKEN /AWS1/QQCCLIENTTOKEN

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the AWS SDK populates this field.For more information about idempotency, see Making retries safe with idempotent APIs.

iv_orchestratorusecase TYPE /AWS1/QQCNONEMPTYSTRING /AWS1/QQCNONEMPTYSTRING

The orchestrator use case for message processing.

it_metadata TYPE /AWS1/CL_QQCMESSAGEMETADATA_W=>TT_MESSAGEMETADATA TT_MESSAGEMETADATA

Additional metadata for the message.

iv_originrequestid TYPE /AWS1/QQCNONEMPTYSTRING /AWS1/QQCNONEMPTYSTRING

Request identifier from the origin system, used for end-to-end tracing across spans.

RETURNING

oo_output TYPE REF TO /aws1/cl_qqcsendmessagersp /AWS1/CL_QQCSENDMESSAGERSP

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->sendmessage(
  io_configuration = new /aws1/cl_qqcmessageconf(
    iv_generatechunkedmessage = ABAP_TRUE
    iv_generatefillermessage = ABAP_TRUE
  )
  io_conversationcontext = new /aws1/cl_qqcconversationctx(
    it_selfsvcconversationhist00 = VALUE /aws1/cl_qqcselfsvcconversat00=>tt_selfsvcconversationhistor00(
      (
        new /aws1/cl_qqcselfsvcconversat00(
          iv_botresponse = |string|
          iv_inputtranscript = |string|
          iv_timestamp = '20150101000000.0000000'
          iv_turnnumber = 123
        )
      )
    )
  )
  io_message = new /aws1/cl_qqcmessageinput(
    io_value = new /aws1/cl_qqcmessagedata(
      io_text = new /aws1/cl_qqctextmessage(
        io_aiguardrailassessment = new /aws1/cl_qqcaiguardrailassmnt( ABAP_TRUE )
        it_citations = VALUE /aws1/cl_qqccitation=>tt_citations(
          (
            new /aws1/cl_qqccitation(
              io_citationspan = new /aws1/cl_qqccitationspan(
                iv_beginoffsetinclusive = 123
                iv_endoffsetexclusive = 123
              )
              iv_contentid = |string|
              iv_knowledgebaseid = |string|
              iv_referencetype = |string|
              iv_sourceurl = |string|
              iv_title = |string|
            )
          )
        )
        iv_value = |string|
      )
      io_tooluseresult = new /aws1/cl_qqctooluseresultdata(
        io_inputschema = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
        io_toolresult = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
        iv_toolname = |string|
        iv_tooluseid = |string|
      )
    )
  )
  it_metadata = VALUE /aws1/cl_qqcmessagemetadata_w=>tt_messagemetadata(
    (
      VALUE /aws1/cl_qqcmessagemetadata_w=>ts_messagemetadata_maprow(
        value = new /aws1/cl_qqcmessagemetadata_w( |string| )
        key = |string|
      )
    )
  )
  iv_aiagentid = |string|
  iv_assistantid = |string|
  iv_clienttoken = |string|
  iv_orchestratorusecase = |string|
  iv_originrequestid = |string|
  iv_sessionid = |string|
  iv_type = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_uuid = lo_result->get_requestmessageid( ).
  lo_messageconfiguration = lo_result->get_configuration( ).
  IF lo_messageconfiguration IS NOT INITIAL.
    lv_boolean = lo_messageconfiguration->get_generatefillermessage( ).
    lv_boolean = lo_messageconfiguration->get_generatechunkedmessage( ).
  ENDIF.
  lv_nexttoken = lo_result->get_nextmessagetoken( ).
ENDIF.