This project is a prototype. If you decided to deploy this work in production environment, please conduct your own security reviews and incorporate security controls commensurate with the data classification whitin your organization. (e.g., when S3 is created they should check to make sure BPA is enabled and/or encryption is enabled based on data sensitivity).
AWS now supports Salesforce as a partner event source for Amazon EventBridge, allowing you to send Salesforce events to AWS. You can also configure Salesforce as an EventBridge API Destination and send EventBridge events to Salesforce. These integrations enable you to act on changes to your Salesforce data in real-time and build custom applications with EventBridge and over 100 built-in sources and targets. In this blog post, you learn how to set up a bidirectional integration between Salesforce and EventBridge and use cases for working with Salesforce events. You see an example application for interacting with Salesforce support case events with automated workflows for detecting sentiment with AWS AI/ML services and enriching support cases with customer order data.
This project contains the SAM template and supporting files for a serverless application that you can deploy with the SAM CLI. It includes the following files and folders.
- template.yaml - A template that defines the application's AWS resources.
- stateMachine - Step Functions State Machine to detect customer sentiment and send SMS to the customer.
- src/enrich-case-app - Application to retrieve order details for a customer support case.
To use the SAM CLI, you need the following tools.
- SAM CLI - Install the SAM CLI
- Node.js - Install Node.js 10, including the NPM package management tool.
- Docker - Install Docker community edition
- AWS CLI - Install & Configure AWS Credentials
Learn more about AWS Secret Manager
⚠️ For security best practices, we recommend that you create the following variable with AWS Secret Managers, otherwise you can directly pass in values for the bellow parameters during deplopyment Skip to Step 2
- SalesforceOauthClientId
- SalesforceOauthClientSecret
- SalesforceUsername
- SalesforcePassword
⚠️ DO NOT CHANGE SECRETKEY
. Thesekeys
are referenced on the cloudformation template. Updatevalue
attribute with your corresponding values during deployment.
aws secretsmanager create-secret \
--name SalesforceOauthClientId \
--description "Salesforce Integration Application Client ID." \
--secret-string "{\"Key\":\"SalesforceOauthClientId\",\"Value\":\"INPUT VALUE HERE\"}"
aws secretsmanager create-secret \
--name SalesforceOauthClientSecret \
--description "Salesforce Integration Application Client Secret." \
--secret-string "{\"Key\":\"SalesforceOauthClientSecret\",\"Value\":\"INPUT VALUE HERE\"}"
aws secretsmanager create-secret \
--name SalesforceUsername \
--description "Username of Salesforce integration User." \
--secret-string "{\"Key\":\"SalesforceUsername\",\"Value\":\"INPUT VALUE HERE\"}"
aws secretsmanager create-secret \
--name SalesforcePassword \
--description "Password of Salesforce integration User." \
--secret-string "{\"Key\":\"SalesforcePassword\",\"Value\":\"INPUT VALUE HERE\"}"
Sample output
{
"ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:SalesforcePassword-a1b2c3",
"Name": "SalesforcePassword",
"VersionId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"
}
⚠️ Navigate to AWS Secret Manager Console to double-check that secret value have been correctly set. For each secret retrieve and view the secret value for validation.
Navigate to src/enrich-case-app
and run cmd
eventbridge-salesforce-integration$ cd src/enrich-case-app
eventbridge-salesforce-integration$ npm install
To build and deploy your application for the first time, run the following in your shell and follow the prompts
The first command will build the source of your application. The second command will package and deploy your application to AWS, with a series of prompts:
eventbridge-salesforce-integration$ sam build
eventbridge-salesforce-integration$ sam deploy --guided
- Stack Name: The name of the stack to deploy to CloudFormation. This should be unique to your account and region, and a good starting point would be something matching your project name.
- AWS Region: The AWS region you want to deploy your app to.
- Confirm changes before deploy: If set to yes, any change sets will be shown to you before execution for manual review. If set to no, the AWS SAM CLI will automatically deploy application changes.
- Allow SAM CLI IAM role creation: Many AWS SAM templates, including this example, create AWS IAM roles required for the AWS Lambda function(s) included to access AWS services. By default, these are scoped down to minimum required permissions. To deploy an AWS CloudFormation stack which creates or modifies IAM roles, the
CAPABILITY_IAM
value forcapabilities
must be provided. If permission isn't provided through this prompt, to deploy this example you must explicitly pass--capabilities CAPABILITY_IAM
to thesam deploy
command. - Save arguments to samconfig.toml: If set to yes, your choices will be saved to a configuration file inside the project, so that in the future you can just re-run
sam deploy
without parameters to deploy changes to your application.
To delete the sample application that you created, use the AWS CLI. Assuming you used your project name for the stack name, you can run the following:
eventbridge-salesforce-integration$ aws sam delete --stack-name <stack name>
See the AWS SAM developer guide for an introduction to SAM specification, the SAM CLI, and serverless application concepts.
Next, you can use AWS Serverless Application Repository to deploy ready to use Apps that go beyond hello world samples and learn how authors developed their applications: AWS Serverless Application Repository main page
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.