Contact Free trial Login

Optionally Configure Branded Emails

Anypoint API Community Manager sends notification emails when an API contract is approved or revoked. By default these emails use Anypoint Platform addresses and branding. If you wish to configure them to use your own addresses and branding instead, use these steps.

Enable Custom Email Notifications

  1. Navigate to Setup > Home > Integrations > External Data Sources and ensure Eligible for External Data Change Capture is enabled.

  2. Set Polling Interval for External Change Data Capture (seconds).

    The default is 1800 and the minimum is 300.

  3. Navigate to Setup, use Quick Find to go to Change Data Capture, navigate to Entities > Change Manually > Available Entities, and move AnypointContracts to the Selected Entities list.

  4. Navigate to Setup, use Quick Find to go to Apex Triggers, and click the Developer Console button.

  5. Click File > New > Apex Trigger, set Name to AnypointEmailNotificationsTrigger, and set sObject to acm_pkg__AnypointContracts__ChangeEvent.

  6. Enter this code block:

        trigger AnypointEmailNotificationsTrigger on acm_pkg__AnypointContracts__ChangeEvent (after insert) {
            List<acm_pkg__AnypointContracts__ChangeEvent> events = Trigger.new;
            acm_pkg__.AnypointEmailNotifications.notifyOnContractUpdates(events);
        }
  7. Navigate to Setup and use Quick Find to go to Organization-Wide Addresses.

  8. Set Display Name to EventEmailSender.

  9. Set Email Address to the email address at your organization that sends the API contract event notification emails.

    Ensure you can read confirmation emails sent to this address.

  10. Set Profiles to System Administrator.

  11. Click Save.

  12. Open the confirmation email sent to the notification sender email address and click the link to confirm the address.

  13. Navigate to Setup and use Quick Find to go to Custom Metadata Types.

  14. Click ACM Community Config Metadata to add a record.

  15. Set Label to your API community’s name.

  16. Set ACM Community Config Metadata Name to your API community’s name.

  17. Open the Developer Console and open the Query Editor.

  18. Enter SELECT Id, Name FROM Network and click Execute.

  19. In the list of IDs and communities, choose the row with Name equal to your community’s name, double click the ID, and copy it.

  20. In the ACM Community Config Metadata field NetworkId, paste the ID.

  21. In the Query Editor, enter SELECT Id, Name FROM EmailTemplate and click Execute.

  22. In the list of IDs and email templates, choose the row with Name equal to Contract Approved, double click the ID, and copy it.

  23. In the ACM Community Config Metadata field ContractApprovedEmailTemplateId, paste the ID.

  24. In the list of IDs and email templates, choose the row with Name equal to Contract Revoked, double click the ID, and copy it.

  25. In the ACM Community Config Metadata field ContractRevokedEmailTemplateId, paste the ID.

  26. In the Query Editor, enter SELECT Id, Address FROM OrgWideEmailAddress and click Execute.

  27. In the list of IDs and email addresses, choose the row with Address equal to the organization wide email address you set, double click the ID, and copy it.

  28. In the ACM Community Config Metadata field OrgWideEmailAddressId, paste the ID.

  29. Click Save.

  30. Repeat this process for all additional communities, creating one record for each community.

    NetworkId is different for each community. ContractApprovedEmailTemplateId, ContractRevokedEmailTemplateId, and OrgWideEmailAddressId may be the same for multiple communities.

  31. Navigate to Setup, use Quick Find to go to Classic Email Templates, and navigate to Folder > ACM.

  32. Customize the Contract Approved and Contract Revoked templates, or create your own templates and configure the ACM Community Config Metadata to use them.

  33. Configure an email relay as described in the Salesforce documentation page Send Email Through Email Relay.

    If the relay is not configured, notification emails are sent from a Salesforce domain with a sender email address in your organization’s domain. If the actual sender domain and sender email address domain do not match, many email providers mark the notification emails as spam.

Disable Default Anypoint Email Notifications

The impersonation mechanism creates Anypoint user records with member email addresses. To prevent a community member from receiving the default Anypoint notification emails, alter these email addresses so the Anypoint user record email is not a valid address.

  1. In Salesforce, navigate to Setup > External Data Sources.

  2. Click the Name of the external data source Exchange to open it in view mode.

  3. Under Custom HTTP Headers, find the X-Email header and click Edit.

  4. In the Header field value field, add a suffix. Example: $User.Email + ".donotsend"

Anypoint Permissions Configuration

  1. Log in to your API community as an administrative user.

  2. In Access Management, click Users.

  3. Click the impersonated Anypoint user with the email address of the Salesforce administrator.

  4. Click Permissions, click API Manager, and for each environment, open the permissions list and enable the Manage Contracts permission.

  5. In the public side of the community, request access to an API with manual approval.

  6. Log in to Anypoint and approve the requested API contract.

    This creates the Anypoint user named Automated Process, which works with the Salesforce user named Automated Process to process triggers.

  7. Grant the Anypoint user named Automated Process the Organization Administrator role using Anypoint Access Management.

    This enables the Anypoint user to process API contract events when API contracts are approved or revoked.

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub