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.

Disable Standard Email Security

Branded emails require disabling Salesforce’s standard configuration for Sender Policy Framework (SPF) for email. For more information about this feature, see the Salesforce Help article Enable Email Security Compliance.

To disable the standard configuration, open Setup > Deliverability > Email Security Compliance and ensure the option Enable compliance with standard email security mechanisms is not selected.

Configure Email Addresses

  1. Navigate to Setup and use Quick Find to go to Organization-Wide Addresses.

  2. Set Display Name to EventEmailSender.

  3. 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.

  4. Select Allow All Profiles to Use this From Address.

  5. Click Save.

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

Enable Custom Email Notifications

To enable custom email notifications, follow these steps.

Configure Data Change Capture

  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.

  4. Use Quick Find to navigate to Change Data Capture.

  5. Navigate to Entities > Change Manually > Available Entities.

  6. Move AnypointContracts to the Selected Entities list, which enables polling on this object.

Create Apex Trigger

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

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

  3. 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);
        }

    === Configure Branded Email Metadata

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

  5. Click ACM Community Configuration Metadata > Manage Records > New to add a record.

  6. Set Label to your API community’s name and press tab to automatically complete the ACM Community Config Metadata Name.

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

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

  9. 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.

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

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

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

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

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

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

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

  17. 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.

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

  19. Click Save.

  20. 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.

Configure Branded Email Templates

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

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

  3. 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