Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cdp): Salesforce destinations url #24218

Merged
merged 6 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions posthog/cdp/templates/salesforce/template_salesforce.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
template_create: HogFunctionTemplate = HogFunctionTemplate(
status="alpha",
id="template-salesforce-create",
name="Salesforce",
name="Create Salesforce objects",
description="Create objects in Salesforce",
icon_url="/static/services/salesforce.png",
hog="""
let res := fetch(f'https://posthog.my.salesforce.com/services/data/v61.0/sobjects/{inputs.path}', {
let res := fetch(f'{inputs.oauth.instance_url}/services/data/v61.0/sobjects/{inputs.path}', {
'body': inputs.properties,
'method': 'POST',
'headers': {
Expand Down Expand Up @@ -68,11 +68,11 @@
template_update: HogFunctionTemplate = HogFunctionTemplate(
status="alpha",
id="template-salesforce-update",
name="Salesforce",
name="Update Salesforce objects",
description="Update objects in Salesforce",
icon_url="/static/services/salesforce.png",
hog="""
let res := fetch(f'https://posthog.my.salesforce.com/services/data/v61.0/sobjects/{inputs.path}', {
let res := fetch(f'{inputs.oauth.instance_url}/services/data/v61.0/sobjects/{inputs.path}', {
'body': inputs.properties,
'method': 'PATCH',
'headers': {
Expand Down
6 changes: 4 additions & 2 deletions posthog/cdp/templates/salesforce/test_template_salesforce.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class TestTemplateSalesforceCreate(BaseHogFunctionTemplateTest):
def _inputs(self, **kwargs):
inputs = {
"oauth": {
"instance_url": "https://example.my.salesforce.com",
"access_token": "oauth-1234",
},
"path": "Contact",
Expand All @@ -27,7 +28,7 @@ def test_function_works(self):
self.run_function(self._inputs())
assert self.get_mock_fetch_calls()[0] == snapshot(
(
"https://posthog.my.salesforce.com/services/data/v61.0/sobjects/Contact",
"https://example.my.salesforce.com/services/data/v61.0/sobjects/Contact",
{
"body": {"foo": "bar"},
"method": "POST",
Expand All @@ -43,6 +44,7 @@ class TestTemplateSalesforceUpdate(BaseHogFunctionTemplateTest):
def _inputs(self, **kwargs):
inputs = {
"oauth": {
"instance_url": "https://example.my.salesforce.com",
"access_token": "oauth-1234",
},
"path": "Lead/Email/[email protected]",
Expand All @@ -58,7 +60,7 @@ def test_function_works(self):
self.run_function(self._inputs())
assert self.get_mock_fetch_calls()[0] == snapshot(
(
"https://posthog.my.salesforce.com/services/data/v61.0/sobjects/Lead/Email/[email protected]",
"https://example.my.salesforce.com/services/data/v61.0/sobjects/Lead/Email/[email protected]",
{
"body": {"foo": "bar"},
"method": "PATCH",
Expand Down
Loading