Skip to Content
SAP Marketing

How To Connect Your Own Email Service Provider to SAP Hybris Marketing (III) - Process Integration

Tags:

Specific Process Integration Related Topics

In the last part of our example to connect SendGrid as Email Service Provider we describe two methods of the adapter class that supported the integration of own ESPs in the overall process. They focus on dedicated aspects during the configuration steps that are performed by a business user.


RETRIEVE_VERIFIED_SENDERS

Many ESPs demand the up-front verification of addresses that should be used as senders / reply-tos. Otherwise corresponding sending requests are rejected at runtime.

With this method, the verified addresses can be retrieved using the ESP's API. This includes verified (sub-)domains, e.g. <all_adresses>@example.com. This data is used to be checked against during execution time to avoid unnecessary stops of the sending process during the campaign execution.

The data retrieved here is used to verify the addresses that are entered in the corresponding fields of the sender profile app.

In our example, we state in our adapter class that we verified our own domain:

METHOD if_cuan_mkt_exec_email~retrieve_verified_senders.

    APPEND '<your domain>.com' TO et_domains.

ENDMETHOD.

In a productive adapter class implementation you may want to retrieve the actually verified senders from the ESP. SendGrid offers the Sender Identities API for that purpose.


CHECK_CONNECTION


For health checks and before executing a campaign, it is useful to verify that the connection to the ESP is up and running. This can be done by implementing an appropriate check in this method.

This method is called in the connection test of the provider configuration app and the configuration check report.

The method gets the results of an HTTP “ping” request as importing parameters. Together with the connection type (SEND or BOUNCE) you can validate whether the network connection works in principle. For sure, advanced topics, such as the correctness of provider credentials are not covered here.

  METHOD if_cuan_mkt_exec_http_outbound~check_connection.

    ev_success = abap_false.

    IF iv_connection_type = if_cuan_mkt_exec_c=>c_connection_check_send

     OR iv_connection_type = if_cuan_mkt_exec_c=>c_connection_check_bounce.

      IF iv_http_code <> 405 OR iv_reason <> 'Method Not Allowed'.

        MESSAGE e002(cuan_mkt_exec_frw) WITH iv_http_code && ' ' && iv_reason

                INTO DATA(lv_message).

              cl_cuan_mkt_exec_messages=>add_message(

                        CHANGING ct_messages = et_messages ).

        RETURN.

      ENDIF.

    ENDIF.

  ENDMETHOD.

Configuration Check Report

A handy tool for checking whether your integration works correctly is the configuration check report CUAN_MKT_EXEC_CHECK_CONFIG that we deliver from release 1602 onwards.

When entering your own email address you will receive a test email for each sender profile in the system. In case of errors, you will receive here detailed technical error messages.

Handling of ESP Credentials

In general, the requests should use HTTPS. Therefore, appropriate certificates for the service provider's API endpoint may need to be imported into transaction STRUST and configured during the RFC destination configuration in transaction SM59.

There are several ways how the authentication/authorization for calling a service provider's API is realized. The most common approach is using HTTP basic authentication using a user and password. The recommended way to store these credentials is maintaining them directly in transaction SM59 when defining the RFC destination.

Another approach is the one represented by SendGrid with API keys that are used to authorize the HTTP requests. Then, these credentials should be stored in the ABAP secure store if possible and read at execution runtime from there using method GET_PARAMETERS. We did not do this in this example, but you have a look at the class CL_CUAN_MKT_EXEC_EMAIL_AMZN how to do that.

Former Member

No comments