Repository: amp-labs/connectors
Pull request #87 (2024-03-13 07:25:31)

[ENG-792] feat: Add Close CRM connector 
## Catalog variables
No catalog variables

## Notes

## Testing 
### GET 
localhost:4444/api/v1/contact/
![Get contact proxy ok](https://github.com/amp-labs/connectors/assets/95291462/02b73131-c017-45c6-9c37-d5f1730bac2d)


### POST
localhost:4444/api/v1/contact/
![POST - create contact proxy ok](https://github.com/amp-labs/connectors/assets/95291462/2c7531a8-432b-4f72-962c-4b33b60ac044)

### PUT
localhost:4444/api/v1/contact/cont_4fWk9sSGSSUBbKKT42bdmoskEXZiV1N5ojp5vbHqlKr - failed with error 403 
![PUT - Update contact error ](https://github.com/amp-labs/connectors/assets/95291462/86b73dec-bd5b-4285-9f6b-7d88f3ec78ff)
while the direct request to https://api.close.com/api/v1/contact/cont_Zgz6xgtpLEELtYdABl4rHO3RvJjW4hmEWiKVPcY4ujr
worked just fine
![Update contact direct ok](https://github.com/amp-labs/connectors/assets/95291462/25808a8a-3bea-4184-bdc3-f114480cf6c2)

###DEL
localhost:4444/api/v1/contact/cont_4fWk9sSGSSUBbKKT42bdmoskEXZiV1N5ojp5vbHqlKr
![DEL proxy contact ok](https://github.com/amp-labs/connectors/assets/95291462/b3999a31-1a72-4fc0-80dd-9c47b5eaf2c1)

## Pagination
localhost:4444/api/v1/contact?_skip=0&_limit=2
This request failed with error Error: write EPROTO 12884924564552:error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER:../../../../src/third_party/boringssl/src/ssl/tls_record.cc:242
![Pagination_via_proxy_error](https://github.com/amp-labs/connectors/assets/95291462/bf17dc81-afc2-4689-839c-1b38e43ecba1)
While direct request works fine - https://api.close.com/api/v1/contact?skip=0&_limit=2
![Pagination_works_ok_direct](https://github.com/amp-labs/connectors/assets/95291462/66997999-819c-44ed-99ab-60dfbf86ca4f)



Patch:
diff --git a/providers/catalog.go b/providers/catalog.go
index 11050ca8..0a8a67cf 100644
--- a/providers/catalog.go
+++ b/providers/catalog.go
@@ -10,6 +10,7 @@ const (
 	LinkedIn   Provider = "linkedIn"
 	Salesloft  Provider = "salesloft"
 	Outreach   Provider = "outreach"
+	Close      Provider = "close"
 	Keap       Provider = "keap"
 	Asana      Provider = "asana"
 )
@@ -118,6 +119,26 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 		},
 	},
 
+	// Close configuration
+	Close: {
+		AuthType: Oauth2,
+		BaseURL:  "https://api.close.com/api",
+		OauthOpts: OauthOpts{
+
+			AuthURL:                   "https://app.close.com/oauth2/authorize",
+			TokenURL:                  "https://api.close.com/oauth2/token/",
+			ExplicitScopesRequired:    true,
+			ExplicitWorkspaceRequired: false,
+		},
+		Support: Support{
+			BulkWrite: false,
+			Proxy:     false,
+			Read:      false,
+			Subscribe: false,
+			Write:     false,
+		},
+	},
+
 	Keap: {
 		AuthType: Oauth2,
 		BaseURL:  "https://api.infusionsoft.com",


Test patch:
diff --git a/providers/catalog_test.go b/providers/catalog_test.go
index d7a041d8..77792895 100644
--- a/providers/catalog_test.go
+++ b/providers/catalog_test.go
@@ -150,6 +150,30 @@ var testCases = []struct { // nolint
 		expectedErr: nil,
 	},
 
+	{
+		provider:    Close,
+		description: "Valid Close provider config with no substitutions",
+		expected: &ProviderInfo{
+			Support: Support{
+				Read:  false,
+				Write: false,
+
+				BulkWrite: false,
+				Subscribe: false,
+				Proxy:     false,
+			},
+			AuthType: Oauth2,
+			OauthOpts: OauthOpts{
+				AuthURL:                   "https://app.close.com/oauth2/authorize",
+				TokenURL:                  "https://api.close.com/oauth2/token/",
+				ExplicitScopesRequired:    false,
+				ExplicitWorkspaceRequired: false,
+			},
+			BaseURL: "https://api.close.com/api",
+		},
+		expectedErr: nil,
+	},
+
 	{
 		provider:    Keap,
 		description: "Valid Keap provider config with no substitutions",