-
Notifications
You must be signed in to change notification settings - Fork 119
/
salesforceIntegration.yml
51 lines (49 loc) · 2.35 KB
/
salesforceIntegration.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
integrations:
- name: nri-flex
# interval: 30s
config:
name: SalesforceSample
secrets:
mylogin:
kind: local # Use Flex local/internal decryption function
key: N3wR3lic! # Your pass_phrase to encrypt/decrypt the Salesforce login info
data: <==YOUR ENCRYPTED LOGIN INFO from the command below==>
# Run the following command to generate a encrypted login info, paste it to the above -> data
# nri-flex -encrypt_pass 'username=<YOUR USERNAME>,password=<YOUR PASSWORD>' -pass_phrase 'N3wR3lic!'
# The decrypted username and password will be used to exchange for access_token
type: equal
variable_store:
rest_host: https://<==YOUR SALESFORCE HOST==>.my.salesforce.com
client_id: <==YOUR SALESFORCE CLIENT_ID==>
client_secret: <==YOUR SALESFORCE CLIENT_SECRET==>
# Your query timestamp and offset, utc time is being used in the following example
startDatetime: ${timestamp:datetimeutc-5min}
username: ${secret.mylogin:username}
password: ${secret.mylogin:password}
rest_api: /services/data/v47.0/query?q=
oauth_token_endpoint: /services/oauth2/token
# Your Salesforce query string
queryString: select Id, Stack_Trace__c, Message__c, Created_Date_Time__c, Exception_Type__c from Exception_Log__c
# Your Salesforce query where clause
queryWhere: " where Created_Date_Time__c > "
# Timezone, 0000 for utc
Timezone: "%2B0000"
apis:
# Get access_token
- name: authentication
url: ${var:rest_host}${var:oauth_token_endpoint}
method: POST
store_variables:
storedtoken: access_token
# This payload assumes oauth2 grant_type=password.
# This should be configured based on your oauth flow
payload: >-
client_id=${var:client_id}&grant_type=password&client_secret=${var:client_secret}&username=${var:username}&password=${var:password}
ignore_output: true
# Get data using access_token
- name: salesforceExceptionSample
event_type: SalesforceExceptionSample
url: ${var:rest_host}${var:rest_api}${var:queryString}${var:queryWhere}${var:startDatetime}${var:Timezone}
headers:
Authorization: Bearer ${var:storedtoken}