Skip to content

/AWS1/IF_PPM=>CREATEWHATSAPPFLOW()

About CreateWhatsAppFlow

Creates a new WhatsApp Flow. Flows enable businesses to create rich, interactive forms and experiences that users can complete without leaving WhatsApp. The Flow is created in DRAFT status. If publish is set to true and a valid flowJson is provided, the Flow is published immediately.

Method Signature

METHODS /AWS1/IF_PPM~CREATEWHATSAPPFLOW
  IMPORTING
    !IV_ID TYPE /AWS1/PPMLNKWHATSAPPBUSINESS00 OPTIONAL
    !IV_FLOWNAME TYPE /AWS1/PPMMETAFLOWNAME OPTIONAL
    !IT_CATEGORIES TYPE /AWS1/CL_PPMMETAFLOWCATLIST_W=>TT_METAFLOWCATEGORYLIST OPTIONAL
    !IV_FLOWJSON TYPE /AWS1/PPMMETAFLOWJSONBLOB OPTIONAL
    !IV_PUBLISH TYPE /AWS1/PPMBOOLEAN OPTIONAL
    !IV_CLONEFLOWID TYPE /AWS1/PPMMETAFLOWID OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_ppmcrewhatsappflowout
  RAISING
    /AWS1/CX_PPMACCESSDENIEDEX
    /AWS1/CX_PPMVALIDATIONEX
    /AWS1/CX_PPMACCDENIEDBYMETAEX
    /AWS1/CX_PPMDEPENDENCYEX
    /AWS1/CX_PPMINTERNALSERVICEEX
    /AWS1/CX_PPMINVALIDPARAMSEX
    /AWS1/CX_PPMRESOURCENOTFOUNDEX
    /AWS1/CX_PPMTHROTTLEDREQUESTEX
    /AWS1/CX_PPMCLIENTEXC
    /AWS1/CX_PPMSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_id TYPE /AWS1/PPMLNKWHATSAPPBUSINESS00 /AWS1/PPMLNKWHATSAPPBUSINESS00

The ID of the WhatsApp Business Account to associate with this Flow.

iv_flowname TYPE /AWS1/PPMMETAFLOWNAME /AWS1/PPMMETAFLOWNAME

The name of the Flow. Must be unique within the WhatsApp Business Account.

it_categories TYPE /AWS1/CL_PPMMETAFLOWCATLIST_W=>TT_METAFLOWCATEGORYLIST TT_METAFLOWCATEGORYLIST

The categories that classify the business purpose of the Flow. At least one category is required.

Optional arguments:

iv_flowjson TYPE /AWS1/PPMMETAFLOWJSONBLOB /AWS1/PPMMETAFLOWJSONBLOB

The Flow JSON definition that describes the screens, components, and logic of the Flow. Maximum size is 10 MB.

iv_publish TYPE /AWS1/PPMBOOLEAN /AWS1/PPMBOOLEAN

Set to true to publish the Flow immediately after creation. Requires a valid flowJson that passes Meta's validation.

iv_cloneflowid TYPE /AWS1/PPMMETAFLOWID /AWS1/PPMMETAFLOWID

The ID of an existing Flow within the same WhatsApp Business Account to clone.

RETURNING

oo_output TYPE REF TO /aws1/cl_ppmcrewhatsappflowout /AWS1/CL_PPMCREWHATSAPPFLOWOUT

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->createwhatsappflow(
  it_categories = VALUE /aws1/cl_ppmmetaflowcatlist_w=>tt_metaflowcategorylist(
    ( new /aws1/cl_ppmmetaflowcatlist_w( |string| ) )
  )
  iv_cloneflowid = |string|
  iv_flowjson = '5347567362473873563239796247513D'
  iv_flowname = |string|
  iv_id = |string|
  iv_publish = ABAP_TRUE
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_metaflowid = lo_result->get_flowid( ).
  LOOP AT lo_result->get_validationerrors( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_metaflowvalidationerror = lo_row_1->get_value( ).
    ENDIF.
  ENDLOOP.
ENDIF.