Há mais exemplos de AWS SDK disponíveis no repositório AWS Doc SDK Examples
As traduções são geradas por tradução automática. Em caso de conflito entre o conteúdo da tradução e da versão original em inglês, a versão em inglês prevalecerá.
Exemplos de API de voz e SMS do Amazon Pinpoint usando SDK para SAP ABAP
Os exemplos de código a seguir mostram como realizar ações e implementar cenários comuns usando o AWS SDK para SAP ABAP com Amazon Pinpoint SMS and Voice API.
Ações são trechos de código de programas maiores e devem ser executadas em contexto. Embora as ações mostrem como chamar perfis de serviço individuais, você pode ver as ações no contexto em seus cenários relacionados.
Cada exemplo inclui um link para o código-fonte completo, em que você pode encontrar instruções sobre como configurar e executar o código.
Tópicos
Ações
O código de exemplo a seguir mostra como usar CreateConfigurationSet.
- SDK para SAP ABAP
-
nota
Tem mais sobre GitHub. Encontre o exemplo completo e saiba como configurar e executar no AWS Code Examples Repository
. TRY. " Create a new configuration set lo_pps->createconfigurationset( iv_configurationsetname = iv_configuration_set_name " e.g., 'my-config-set' ). MESSAGE 'Configuration set created successfully.' TYPE 'I'. CATCH /aws1/cx_ppsalreadyexistsex INTO DATA(lo_already_exists_ex). MESSAGE lo_already_exists_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_already_exists_ex. CATCH /aws1/cx_ppsbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_ppsinternalsvcerrorex INTO DATA(lo_internal_error_ex). MESSAGE lo_internal_error_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_internal_error_ex. CATCH /aws1/cx_ppslimitexceededex INTO DATA(lo_limit_exceeded_ex). MESSAGE lo_limit_exceeded_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_limit_exceeded_ex. CATCH /aws1/cx_ppstoomanyrequestsex INTO DATA(lo_too_many_requests_ex). MESSAGE lo_too_many_requests_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many_requests_ex. ENDTRY.-
Para obter detalhes da API, consulte a CreateConfigurationSetreferência da API AWS SDK for SAP ABAP.
-
O código de exemplo a seguir mostra como usar CreateConfigurationSetEventDestination.
- SDK para SAP ABAP
-
nota
Tem mais sobre GitHub. Encontre o exemplo completo e saiba como configurar e executar no AWS Code Examples Repository
. TRY. " Create event destination for the configuration set lo_pps->createconfseteventdst( iv_configurationsetname = iv_configuration_set_name " e.g., 'my-config-set' iv_eventdestinationname = iv_event_destination_name " e.g., 'my-event-dest' io_eventdestination = io_event_destination ). MESSAGE 'Event destination created successfully.' TYPE 'I'. CATCH /aws1/cx_ppsalreadyexistsex INTO DATA(lo_already_exists_ex). MESSAGE lo_already_exists_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_already_exists_ex. CATCH /aws1/cx_ppsnotfoundexception INTO DATA(lo_not_found_ex). MESSAGE lo_not_found_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_not_found_ex. CATCH /aws1/cx_ppsbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_ppsinternalsvcerrorex INTO DATA(lo_internal_error_ex). MESSAGE lo_internal_error_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_internal_error_ex. CATCH /aws1/cx_ppslimitexceededex INTO DATA(lo_limit_exceeded_ex). MESSAGE lo_limit_exceeded_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_limit_exceeded_ex. CATCH /aws1/cx_ppstoomanyrequestsex INTO DATA(lo_too_many_requests_ex). MESSAGE lo_too_many_requests_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many_requests_ex. ENDTRY.-
Para obter detalhes da API, consulte a CreateConfigurationSetEventDestinationreferência da API AWS SDK for SAP ABAP.
-
O código de exemplo a seguir mostra como usar DeleteConfigurationSet.
- SDK para SAP ABAP
-
nota
Tem mais sobre GitHub. Encontre o exemplo completo e saiba como configurar e executar no AWS Code Examples Repository
. TRY. " Delete the configuration set lo_pps->deleteconfigurationset( iv_configurationsetname = iv_configuration_set_name " e.g., 'my-config-set' ). MESSAGE 'Configuration set deleted successfully.' TYPE 'I'. CATCH /aws1/cx_ppsnotfoundexception INTO DATA(lo_not_found_ex). MESSAGE lo_not_found_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_not_found_ex. CATCH /aws1/cx_ppsbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_ppsinternalsvcerrorex INTO DATA(lo_internal_error_ex). MESSAGE lo_internal_error_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_internal_error_ex. CATCH /aws1/cx_ppstoomanyrequestsex INTO DATA(lo_too_many_requests_ex). MESSAGE lo_too_many_requests_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many_requests_ex. ENDTRY.-
Para obter detalhes da API, consulte a DeleteConfigurationSetreferência da API AWS SDK for SAP ABAP.
-
O código de exemplo a seguir mostra como usar DeleteConfigurationSetEventDestination.
- SDK para SAP ABAP
-
nota
Tem mais sobre GitHub. Encontre o exemplo completo e saiba como configurar e executar no AWS Code Examples Repository
. TRY. " Delete the event destination lo_pps->deleteconfseteventdst( iv_configurationsetname = iv_configuration_set_name " e.g., 'my-config-set' iv_eventdestinationname = iv_event_destination_name " e.g., 'my-event-dest' ). MESSAGE 'Event destination deleted successfully.' TYPE 'I'. CATCH /aws1/cx_ppsnotfoundexception INTO DATA(lo_not_found_ex). MESSAGE lo_not_found_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_not_found_ex. CATCH /aws1/cx_ppsbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_ppsinternalsvcerrorex INTO DATA(lo_internal_error_ex). MESSAGE lo_internal_error_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_internal_error_ex. CATCH /aws1/cx_ppstoomanyrequestsex INTO DATA(lo_too_many_requests_ex). MESSAGE lo_too_many_requests_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many_requests_ex. ENDTRY.-
Para obter detalhes da API, consulte a DeleteConfigurationSetEventDestinationreferência da API AWS SDK for SAP ABAP.
-
O código de exemplo a seguir mostra como usar GetConfigurationSetEventDestinations.
- SDK para SAP ABAP
-
nota
Tem mais sobre GitHub. Encontre o exemplo completo e saiba como configurar e executar no AWS Code Examples Repository
. TRY. " Get event destinations for the configuration set oo_result = lo_pps->getconfseteventdestinations( iv_configurationsetname = iv_configuration_set_name " e.g., 'my-config-set' ). " Process the event destinations LOOP AT oo_result->get_eventdestinations( ) INTO DATA(lo_event_dest). DATA(lv_dest_name) = lo_event_dest->get_name( ). DATA(lv_enabled) = lo_event_dest->get_enabled( ). MESSAGE |Event destination: { lv_dest_name }, Enabled: { lv_enabled }| TYPE 'I'. " Check for CloudWatch Logs destination DATA(lo_cloudwatch_dest) = lo_event_dest->get_cloudwatchlogsdst( ). IF lo_cloudwatch_dest IS NOT INITIAL. DATA(lv_log_group_arn) = lo_cloudwatch_dest->get_loggrouparn( ). MESSAGE | CloudWatch Logs destination: { lv_log_group_arn }| TYPE 'I'. ENDIF. " Check for Kinesis Firehose destination DATA(lo_firehose_dest) = lo_event_dest->get_kinesisfirehosedst( ). IF lo_firehose_dest IS NOT INITIAL. DATA(lv_delivery_stream) = lo_firehose_dest->get_deliverystreamarn( ). MESSAGE | Kinesis Firehose destination: { lv_delivery_stream }| TYPE 'I'. ENDIF. " Check for SNS destination DATA(lo_sns_dest) = lo_event_dest->get_snsdestination( ). IF lo_sns_dest IS NOT INITIAL. DATA(lv_topic_arn) = lo_sns_dest->get_topicarn( ). MESSAGE | SNS destination: { lv_topic_arn }| TYPE 'I'. ENDIF. ENDLOOP. CATCH /aws1/cx_ppsnotfoundexception INTO DATA(lo_not_found_ex). MESSAGE lo_not_found_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_not_found_ex. CATCH /aws1/cx_ppsbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_ppsinternalsvcerrorex INTO DATA(lo_internal_error_ex). MESSAGE lo_internal_error_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_internal_error_ex. CATCH /aws1/cx_ppstoomanyrequestsex INTO DATA(lo_too_many_requests_ex). MESSAGE lo_too_many_requests_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many_requests_ex. ENDTRY.-
Para obter detalhes da API, consulte a GetConfigurationSetEventDestinationsreferência da API AWS SDK for SAP ABAP.
-
O código de exemplo a seguir mostra como usar ListConfigurationSets.
- SDK para SAP ABAP
-
nota
Tem mais sobre GitHub. Encontre o exemplo completo e saiba como configurar e executar no AWS Code Examples Repository
. TRY. " List all configuration sets oo_result = lo_pps->listconfigurationsets( iv_nexttoken = iv_next_token " Optional: Token for pagination iv_pagesize = iv_page_size " Optional: Number of results per page, e.g., '10' ). " Process the configuration sets LOOP AT oo_result->get_configurationsets( ) INTO DATA(lo_config_set). DATA(lv_config_set_name) = lo_config_set->get_value( ). MESSAGE |Configuration set: { lv_config_set_name }| TYPE 'I'. ENDLOOP. " Check if there are more results DATA(lv_next_token) = oo_result->get_nexttoken( ). IF lv_next_token IS NOT INITIAL. MESSAGE |More results available. Next token: { lv_next_token }| TYPE 'I'. ENDIF. CATCH /aws1/cx_ppsbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_ppsinternalsvcerrorex INTO DATA(lo_internal_error_ex). MESSAGE lo_internal_error_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_internal_error_ex. CATCH /aws1/cx_ppstoomanyrequestsex INTO DATA(lo_too_many_requests_ex). MESSAGE lo_too_many_requests_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many_requests_ex. ENDTRY.-
Para obter detalhes da API, consulte a ListConfigurationSetsreferência da API AWS SDK for SAP ABAP.
-
O código de exemplo a seguir mostra como usar SendVoiceMessage.
- SDK para SAP ABAP
-
nota
Tem mais sobre GitHub. Encontre o exemplo completo e saiba como configurar e executar no AWS Code Examples Repository
. TRY. " Create SSML message type object with voice parameters DATA(lo_ssml_message) = NEW /aws1/cl_ppsssmlmessagetype( iv_languagecode = iv_language_code " e.g., 'en-US' iv_voiceid = iv_voice_id " e.g., 'Matthew' iv_text = iv_ssml_message " SSML formatted message text ). " Create voice message content with the SSML message DATA(lo_content) = NEW /aws1/cl_ppsvoicemessagecont( io_ssmlmessage = lo_ssml_message ). " Send the voice message DATA(lo_result) = lo_pps->sendvoicemessage( iv_originationphonenumber = iv_origination_number " e.g., '+12065550110' iv_callerid = iv_caller_id " e.g., '+12065550199' iv_destinationphonenumber = iv_destination_number " e.g., '+12065550142' io_content = lo_content ). " Retrieve the message ID from the response ov_message_id = lo_result->get_messageid( ). MESSAGE 'Voice message sent successfully.' TYPE 'I'. CATCH /aws1/cx_ppsbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_ppsinternalsvcerrorex INTO DATA(lo_internal_error_ex). MESSAGE lo_internal_error_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_internal_error_ex. CATCH /aws1/cx_ppstoomanyrequestsex INTO DATA(lo_too_many_requests_ex). MESSAGE lo_too_many_requests_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many_requests_ex. ENDTRY.-
Para obter detalhes da API, consulte a SendVoiceMessagereferência da API AWS SDK for SAP ABAP.
-
O código de exemplo a seguir mostra como usar UpdateConfigurationSetEventDestination.
- SDK para SAP ABAP
-
nota
Tem mais sobre GitHub. Encontre o exemplo completo e saiba como configurar e executar no AWS Code Examples Repository
. TRY. " Update the event destination lo_pps->updateconfseteventdst( iv_configurationsetname = iv_configuration_set_name " e.g., 'my-config-set' iv_eventdestinationname = iv_event_destination_name " e.g., 'my-event-dest' io_eventdestination = io_event_destination ). MESSAGE 'Event destination updated successfully.' TYPE 'I'. CATCH /aws1/cx_ppsnotfoundexception INTO DATA(lo_not_found_ex). MESSAGE lo_not_found_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_not_found_ex. CATCH /aws1/cx_ppsbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_ppsinternalsvcerrorex INTO DATA(lo_internal_error_ex). MESSAGE lo_internal_error_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_internal_error_ex. CATCH /aws1/cx_ppstoomanyrequestsex INTO DATA(lo_too_many_requests_ex). MESSAGE lo_too_many_requests_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many_requests_ex. ENDTRY.-
Para obter detalhes da API, consulte a UpdateConfigurationSetEventDestinationreferência da API AWS SDK for SAP ABAP.
-