| 
									
										
										
										
											2023-09-02 08:50:31 -07:00
										 |  |  | #!/usr/bin/env bash
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Processes multiple files in a nested folder structure from Salesforce | 
					
						
							|  |  |  | # through Unstructured's library in 2 processes. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Available categories are: Account, Case, Campaign, EmailMessage, Lead | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Structured outputs are stored in salesforce-output/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Using JWT authorization | 
					
						
							|  |  |  | # https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_key_and_cert.htm | 
					
						
							|  |  |  | # https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_connected_app.htm | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-11 12:15:24 +01:00
										 |  |  | # private-key is the path to the key file or key contents | 
					
						
							| 
									
										
										
										
											2023-09-02 08:50:31 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-11 20:04:15 -05:00
										 |  |  | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) | 
					
						
							| 
									
										
										
										
											2023-09-02 08:50:31 -07:00
										 |  |  | cd "$SCRIPT_DIR"/../../.. || exit 1 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PYTHONPATH=. ./unstructured/ingest/main.py \
 | 
					
						
							| 
									
										
										
										
											2023-12-18 23:48:21 -08:00
										 |  |  |   salesforce \
 | 
					
						
							|  |  |  |   --username "$SALESFORCE_USERNAME" \
 | 
					
						
							|  |  |  |   --consumer-key "$SALESFORCE_CONSUMER_KEY" \
 | 
					
						
							| 
									
										
										
										
											2024-01-11 12:15:24 +01:00
										 |  |  |   --private-key "$SALESFORCE_PRIVATE_KEY_PATH" \
 | 
					
						
							| 
									
										
										
										
											2023-12-18 23:48:21 -08:00
										 |  |  |   --categories "EmailMessage,Account,Lead,Case,Campaign" \
 | 
					
						
							|  |  |  |   --output-dir salesforce-output \
 | 
					
						
							|  |  |  |   --preserve-downloads \
 | 
					
						
							|  |  |  |   --reprocess \
 | 
					
						
							|  |  |  |   --verbose |