Skip to content

/AWS1/IF_QQC=>RENDERMESSAGETEMPLATE()

About RenderMessageTemplate

Renders the Amazon Q in Connect message template based on the attribute values provided and generates the message content. For any variable present in the message template, if the attribute value is neither provided in the attribute request parameter nor the default attribute of the message template, the rendered message content will keep the variable placeholder as it is and return the attribute keys that are missing.

Method Signature

METHODS /AWS1/IF_QQC~RENDERMESSAGETEMPLATE
  IMPORTING
    !IV_KNOWLEDGEBASEID TYPE /AWS1/QQCUUIDORARN OPTIONAL
    !IV_MESSAGETEMPLATEID TYPE /AWS1/QQCUUIDORARNOREITHERWQ00 OPTIONAL
    !IO_ATTRIBUTES TYPE REF TO /AWS1/CL_QQCMESSAGETMPLATTRS OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_qqcrendermsgtmplrsp
  RAISING
    /AWS1/CX_QQCACCESSDENIEDEX
    /AWS1/CX_QQCRESOURCENOTFOUNDEX
    /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_knowledgebaseid TYPE /AWS1/QQCUUIDORARN /AWS1/QQCUUIDORARN

The identifier of the knowledge base. Can be either the ID or the ARN. URLs cannot contain the ARN.

iv_messagetemplateid TYPE /AWS1/QQCUUIDORARNOREITHERWQ00 /AWS1/QQCUUIDORARNOREITHERWQ00

The identifier of the message template. Can be either the ID or the ARN.

io_attributes TYPE REF TO /AWS1/CL_QQCMESSAGETMPLATTRS /AWS1/CL_QQCMESSAGETMPLATTRS

An object that specifies the values to use for variables in the message template. This object contains different categories of key-value pairs. Each key defines a variable or placeholder in the message template. The corresponding value defines the value for that variable.

RETURNING

oo_output TYPE REF TO /aws1/cl_qqcrendermsgtmplrsp /AWS1/CL_QQCRENDERMSGTMPLRSP

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

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->rendermessagetemplate(
  io_attributes = new /aws1/cl_qqcmessagetmplattrs(
    io_agentattributes = new /aws1/cl_qqcagentattributes(
      iv_firstname = |string|
      iv_lastname = |string|
    )
    io_customerprofileattributes = new /aws1/cl_qqccusprofileattrs(
      it_custom = VALUE /aws1/cl_qqccustomattributes_w=>tt_customattributes(
        (
          VALUE /aws1/cl_qqccustomattributes_w=>ts_customattributes_maprow(
            value = new /aws1/cl_qqccustomattributes_w( |string| )
            key = |string|
          )
        )
      )
      iv_accountnumber = |string|
      iv_additionalinformation = |string|
      iv_address1 = |string|
      iv_address2 = |string|
      iv_address3 = |string|
      iv_address4 = |string|
      iv_billingaddress1 = |string|
      iv_billingaddress2 = |string|
      iv_billingaddress3 = |string|
      iv_billingaddress4 = |string|
      iv_billingcity = |string|
      iv_billingcountry = |string|
      iv_billingcounty = |string|
      iv_billingpostalcode = |string|
      iv_billingprovince = |string|
      iv_billingstate = |string|
      iv_birthdate = |string|
      iv_businessemailaddress = |string|
      iv_businessname = |string|
      iv_businessphonenumber = |string|
      iv_city = |string|
      iv_country = |string|
      iv_county = |string|
      iv_emailaddress = |string|
      iv_firstname = |string|
      iv_gender = |string|
      iv_homephonenumber = |string|
      iv_lastname = |string|
      iv_mailingaddress1 = |string|
      iv_mailingaddress2 = |string|
      iv_mailingaddress3 = |string|
      iv_mailingaddress4 = |string|
      iv_mailingcity = |string|
      iv_mailingcountry = |string|
      iv_mailingcounty = |string|
      iv_mailingpostalcode = |string|
      iv_mailingprovince = |string|
      iv_mailingstate = |string|
      iv_middlename = |string|
      iv_mobilephonenumber = |string|
      iv_partytype = |string|
      iv_phonenumber = |string|
      iv_postalcode = |string|
      iv_profilearn = |string|
      iv_profileid = |string|
      iv_province = |string|
      iv_shippingaddress1 = |string|
      iv_shippingaddress2 = |string|
      iv_shippingaddress3 = |string|
      iv_shippingaddress4 = |string|
      iv_shippingcity = |string|
      iv_shippingcountry = |string|
      iv_shippingcounty = |string|
      iv_shippingpostalcode = |string|
      iv_shippingprovince = |string|
      iv_shippingstate = |string|
      iv_state = |string|
    )
    io_systemattributes = new /aws1/cl_qqcsystemattributes(
      io_customerendpoint = new /aws1/cl_qqcsystemendptattrs( |string| )
      io_systemendpoint = new /aws1/cl_qqcsystemendptattrs( |string| )
      iv_name = |string|
    )
    it_customattributes = VALUE /aws1/cl_qqccustomattributes_w=>tt_customattributes(
      (
        VALUE /aws1/cl_qqccustomattributes_w=>ts_customattributes_maprow(
          value = new /aws1/cl_qqccustomattributes_w( |string| )
          key = |string|
        )
      )
    )
  )
  iv_knowledgebaseid = |string|
  iv_messagetemplateid = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lo_messagetemplatecontentp = lo_result->get_content( ).
  IF lo_messagetemplatecontentp IS NOT INITIAL.
    lo_emailmessagetemplatecon = lo_messagetemplatecontentp->get_email( ).
    IF lo_emailmessagetemplatecon IS NOT INITIAL.
      lv_nonemptyunlimitedstring = lo_emailmessagetemplatecon->get_subject( ).
      lo_emailmessagetemplatecon_1 = lo_emailmessagetemplatecon->get_body( ).
      IF lo_emailmessagetemplatecon_1 IS NOT INITIAL.
        lo_messagetemplatebodycont = lo_emailmessagetemplatecon_1->get_plaintext( ).
        IF lo_messagetemplatebodycont IS NOT INITIAL.
          lv_nonemptyunlimitedstring = lo_messagetemplatebodycont->get_content( ).
        ENDIF.
        lo_messagetemplatebodycont = lo_emailmessagetemplatecon_1->get_html( ).
        IF lo_messagetemplatebodycont IS NOT INITIAL.
          lv_nonemptyunlimitedstring = lo_messagetemplatebodycont->get_content( ).
        ENDIF.
      ENDIF.
      LOOP AT lo_emailmessagetemplatecon->get_headers( ) into lo_row.
        lo_row_1 = lo_row.
        IF lo_row_1 IS NOT INITIAL.
          lv_emailheaderkey = lo_row_1->get_name( ).
          lv_emailheadervalue = lo_row_1->get_value( ).
        ENDIF.
      ENDLOOP.
    ENDIF.
    lo_smsmessagetemplateconte = lo_messagetemplatecontentp->get_sms( ).
    IF lo_smsmessagetemplateconte IS NOT INITIAL.
      lo_smsmessagetemplateconte_1 = lo_smsmessagetemplateconte->get_body( ).
      IF lo_smsmessagetemplateconte_1 IS NOT INITIAL.
        lo_messagetemplatebodycont = lo_smsmessagetemplateconte_1->get_plaintext( ).
        IF lo_messagetemplatebodycont IS NOT INITIAL.
          lv_nonemptyunlimitedstring = lo_messagetemplatebodycont->get_content( ).
        ENDIF.
      ENDIF.
    ENDIF.
  ENDIF.
  LOOP AT lo_result->get_attrsnotinterpolated( ) into lo_row_2.
    lo_row_3 = lo_row_2.
    IF lo_row_3 IS NOT INITIAL.
      lv_messagetemplateattribut = lo_row_3->get_value( ).
    ENDIF.
  ENDLOOP.
  LOOP AT lo_result->get_attachments( ) into lo_row_4.
    lo_row_5 = lo_row_4.
    IF lo_row_5 IS NOT INITIAL.
      lv_contentdisposition = lo_row_5->get_contentdisposition( ).
      lv_attachmentfilename = lo_row_5->get_name( ).
      lv_timestamp = lo_row_5->get_uploadedtime( ).
      lv_url = lo_row_5->get_url( ).
      lv_timestamp = lo_row_5->get_urlexpiry( ).
      lv_uuid = lo_row_5->get_attachmentid( ).
    ENDIF.
  ENDLOOP.
ENDIF.