Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions direct/salesforce_with_sandbox.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import scalekit.client
import os
from dotenv import load_dotenv



# Load environment variables
load_dotenv()
connection_name = "salesforce-connected" # Get this from your scalekit dashboard
identifier = "sandbox-user-1" # A unique identifier for the connected account


scalekit = scalekit.client.ScalekitClient(
client_id=os.getenv("SCALEKIT_CLIENT_ID"),
client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"),
env_url=os.getenv("SCALEKIT_ENV_URL"),
)
actions = scalekit.actions

response = actions.get_or_create_connected_account(
connection_name=connection_name,
identifier=identifier,
api_config={
"environment_type" : "SANDBOX",
}
)

link = actions.get_authorization_link(
connection_name=connection_name,
identifier=identifier,
)

print("click on the link to authorize Salseforce", link.link)
input("Press Enter after authorizing salesforce...")


tool_response = scalekit.connect.execute_tool(
tool_name="salesforce_soql_execute",
identifier=identifier,
tool_input={
"soql_query": "SELECT Id, Name FROM Account"
}
)

print(tool_response)

# change the environment type to PRODUCTION after testing
response = actions.update_connected_account(
connection_name=connection_name,
identifier=identifier,
api_config={
"environment_type" : "PRODUCTION",
}
)
print("Updated connected account to PRODUCTION")
Loading