Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit dc93fea

Browse files
committed
add salesforce source docs
1 parent ea99773 commit dc93fea

File tree

8 files changed

+107
-0
lines changed

8 files changed

+107
-0
lines changed
9.62 KB
Loading
14.8 KB
Loading
14.6 KB
Loading
77.8 KB
Loading
50.8 KB
Loading
15.8 KB
Loading

docs/sources/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The following is a list of Triggermesh event Sources, some available as open sou
99
* [AWS CodeCommit](./awscodecommit.md): Capture notifications from an AWS CodeCommit repository.
1010
* [AWS DynamoDB](./awsdynamodb.md): Capture activity from an AWS DynamoDB table.
1111
* [AWS Kinesis](./awskinesis.md): Forward messages from an AWS Kinesis Data Stream.
12+
* [Salesforce](./salesforce.md): Consume messages from Salesforce Streaming API.
1213

1314
<!--
1415
* [Azure Storage](./azurestorage.md):

docs/sources/salesforce.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Event source for Salesforce
2+
3+
This event source acts as a consumer of the [Salesforce stream API][salesforce-stream-api-docs] and forwards all messages it receives
4+
after wrapping them in a [CloudEvent][ce] envelope.
5+
6+
## Prerequisites
7+
8+
### Salesforce account
9+
10+
Salesforce source uses [OAuth JWT credentials][salesforce-oauth-jwt] for service authentication.
11+
12+
1. First you will need to generate a X509 certificate for signing and verifying requests.
13+
We will be using `openssl` but any other certificate generation tool should work.
14+
15+
```sh
16+
openssl req -x509 -sha256 -nodes -days 36500 -newkey rsa:2048 -keyout tm-sf.key -out tm-sf.crt
17+
```
18+
19+
2. At Salesforce site select `Setup > Apps > App Manager`, click on `New Connected App`.
20+
21+
- Fill in mandatory fields, then click `Enable OAuth Settings`.
22+
- Callback URL is mandatory but can be filled with any HTTPS data.
23+
- Enable `Use digital signatures` and upload the public cert (`tm-sf.crt` in the example above).
24+
- Add Scopes for `api` and `refresh_token, offline_access`.
25+
- Save.
26+
27+
![Salesforce connected app](../images/salesforce-source/salesforce-connected-app.png)
28+
29+
- Select the Connected App from the list and at the click on `Manage`.
30+
- Click `Edit policies`.
31+
- Set Permitted users to `Admin approved users are pre-authorized`.
32+
- Save.
33+
34+
![Connected app policies](../images/salesforce-source/connected-app-policies.png)
35+
36+
- Select the Connected App from the list and at the click on `Manage`.
37+
- Click `Manage Profiles`.
38+
- Add permissions on the data this user will have access to.
39+
- Save.
40+
41+
3. Retrieve OAuth data to configure Triggermesh Source.
42+
43+
- Select the Connected App from the list and at the click on `View`.
44+
- Copy `Consumer Key`
45+
- Reveal and copy `Consumer Secret`
46+
47+
### Salesforce stream channel
48+
49+
Refer to [Salesforce stream API][salesforce-stream-api-docs] on how to create stream channels:
50+
51+
- Change Data Capture events: `/data/ChangeEvents`
52+
- PushTopics for streams based on single entity SOQL querys: `/topic/TicketsSold`
53+
- Standard Platform Events for Salesforce event monitoring: `/event/LoginEventStream`
54+
- Custom Platform Events for your SOQL plaform events: `/event/MyCustom__e`
55+
56+
Each Streaming event type has a distinct [set of features][salesroce-event-features]
57+
58+
### Certificate Key Secret
59+
60+
The TriggerMesh Salesforce integration needs the certificate key to sign authentication requests with the Salesforce API.
61+
A [secret needs to be created at Triggermesh][tm-secret] that contains that certificate key.
62+
The file name containing the key will need to be renamed to `certKey`, then select `Secrets` > `+ ADD SECRET`, `File Upload`
63+
64+
![Upload secret](../images/salesforce-source/file-upload-secret.png)
65+
66+
## Deploying an instance of the Source
67+
68+
Open the Bridge creation screen and add a source of type `Salesforce`.
69+
70+
![Adding Salesforce source](../images/salesforce-source/salesforce-source.png)
71+
72+
In the Source creation form, give a name to the event source and add the following information:
73+
74+
* **Broker** to send the events to.
75+
* **Client ID** as retrieved from Salesforce Connected App.
76+
* **Server** for authentication at Salesforce.
77+
* **User** for the Salesforce account.
78+
* **Channel** as configured at the Salesforce stream.
79+
80+
![Salesforce source form](../images/salesforce-source/salesforce-source-form.png)
81+
82+
After clicking the `Save` at the source you will be taken back to the Bridge editor. Proceed to adding the remaining
83+
components to the Bridge, then submit it.
84+
85+
Wait a few seconds for all components to become ready, the green `Status` indicator for the bridge indicates that the event source is ready to forward messages from the Salesforce event Stream.
86+
87+
![Bridge status](../images/salesforce-source/salesforce-bridge-ready.png)
88+
89+
## Event types
90+
91+
The Salesforce event source emits events of the following types:
92+
93+
* `com.salesforce.stream.message`
94+
95+
96+
97+
98+
99+
[salesforce-stream-api-docs]: https://developer.salesforce.com/docs/atlas.en-us.api_streaming.meta/api_streaming/
100+
[salesforce-oauth-jwt]: https://help.salesforce.com/articleView?id=remoteaccess_oauth_jwt_flow.htm
101+
[salesroce-event-features]: https://developer.salesforce.com/docs/atlas.en-us.api_streaming.meta/api_streaming/event_comparison.htm
102+
[ce]: https://cloudevents.io/
103+
104+
[tm-secret]: ../guides/secrets.md
105+
106+

0 commit comments

Comments
 (0)