{"id":22954250,"url":"https://github.com/orlo/example-crm-integration","last_synced_at":"2025-07-14T13:04:59.093Z","repository":{"id":109973042,"uuid":"67216107","full_name":"orlo/example-crm-integration","owner":"orlo","description":null,"archived":false,"fork":false,"pushed_at":"2022-11-07T09:24:13.000Z","size":107,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-02-07T15:45:01.700Z","etag":null,"topics":["crm","example","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/orlo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-02T11:10:08.000Z","updated_at":"2022-06-11T08:22:22.000Z","dependencies_parsed_at":"2023-03-07T19:00:41.352Z","dependency_job_id":null,"html_url":"https://github.com/orlo/example-crm-integration","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orlo%2Fexample-crm-integration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orlo%2Fexample-crm-integration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orlo%2Fexample-crm-integration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orlo%2Fexample-crm-integration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orlo","download_url":"https://codeload.github.com/orlo/example-crm-integration/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246731163,"owners_count":20824514,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crm","example","php"],"created_at":"2024-12-14T16:16:43.687Z","updated_at":"2025-04-02T00:22:34.888Z","avatar_url":"https://github.com/orlo.png","language":"PHP","readme":"# Example CRM Integration\n\nThis project aims to illustrate the functionality required for a custom CRM to integrate with SocialSignIn.\n\n## SocialSignIn Configuration \n\nWithin the SocialSignIn application, head to https://app.socialsignin.net/#/settings/inbox and add a Custom CRM integration.\n\n * Name - something of your choosing\n * Search Endpoint URL - https://myserver.example.com/search\n * Search Endpoint Secret - LongStringlyThingOfYourChoosing (aka SECRET)\n * Iframe Endpoint URL - https://myserver.example.com/iframe\n * Iframe Endpoint Secret - LongStringlyThingOfYourChoosing (aka SECRET)\n\n( For this integration, the Search and Iframe Endpoint Secrets need to be the same, replace 'myserver.example.com' with a real hostname you have assigned to your deployment of this code ).\n\n### SocialSignIn Secret \n\nWhen SocialSignIn make requests on your integration, the requests are signed with a shared secret (SECRET) which you can check against, to ensure a third party isn't trying to access your pipedrive data.\n\nYou define this secret when adding the CRM integration within SocialSignIn. It can be a string of any length (although as with all passwords, longer is generally better).\n\n## Sample Integration Installation\n\n```bash\ndocker build -t crm-integration-image .\ndocker run -e SECRET=changeme --rm --name crm-integration crm-integration-image\n```\n\nCode should work on a generic-ish PHP 7.1 Linux server if you wish to deploy it manually. Sufficient setup instructions should be within the ```Dockerfile```. \n\nIt requires a SECRET environment variable to be set.\n\n## Configuration\n\nThe SECRET environment variable is used to verify that SocialSignIn made the CRM request, and for SocialSignIn to  verify responses.\n\nThe signing works by adding a sha256 hash\\_hmac query parameter on all requests (see: http://php.net/hash\\_hmac )\n\nYou can choose to ignore this parameter if you so wish.\n\n## Required HTTP Interface\n\nAny third party / custom integration needs to support the following :\n\n## Search \n\n * GET request, with signed parameters (see SECRET above)\n * Endpoint is specified by you when adding the integration\n * Parameter 'q' contains the search string.\n * Return json (application/json mimetype).\n * e.g. https://my.integration.com/search?q=bob\n   \n### Request \n \n Assuming a shared secret of 'changeme!'\n \n A request from SocialSignIn searching for users matching 'red' might look like :\n \n ```raw\n GET $CustomUrl?q=red\u0026expires=1500472622\u0026sig=7c9a0a55dc2d1542ec736b8021f048da114fcba11ca1fb0219c122dfd789e48c HTTP/1.1\n Host: ....\n Accept: application/json\n \n\n ```\n\nWhere :\n\n * expires - unix timestamp with a small TTL value added.\n * sig - sha256 hash of GET query (q=red\u0026expires=12345678)\n * q - search term \n\n \n#### Example request validation \n\nYou **should** check that the expires value in the URL is greater or equal to your current system timestamp. \n\nYou **should** check that the signature is valid.\n\n\n```php\n$our_timestamp = time();\n\n// ... logic to check existance of expires/sig parameters in query string.\n\n$url = parse_str($_SERVER['QUERY_STRING'], $params);\n$actual_sig = $params['sig'];\n$request_time = $params['expires'];\n\n\nif($request_time \u003c $our_timestamp) {\n   // request from too long ago?\n}\n\nunset($params['sig']);\n// hash_hmac('sha256', 'q=red\u0026expires=1500472622', 'changeme!');\n$expected_sig = hash_hmac('sha256', http_build_query($params) , 'changeme!');\n\nif($expected_sig != $actual_sig) { \n    // handle error \n}\n\n```\n\n### Response\n \n```json\n{\n    \"results\" : [\n        { \"id\": 1, \"name\": \"Susan Red\"} ,\n        { \"id\": 4, \"name\": \"Frank Redford\"} \n    ]\n}\n```\n \n## Get Specific User\n \n * GET request, with signed parameters\n * Endpoint is specified by you when adding the integration\n * Returns HTML (iframe content).\n\n### Request \n\n```raw\nGET $CustomUrl/iframe?id=12345\u0026expires=1234567\u0026sig=hashhashhash HTTP/1.1\nHost: .....\n\n```\n\n * You **should** verify the 'sig' URL parameter is correct (see above)\n * You **should** verify the 'expires' URL parameter is greater or equal to the current system time.\n \n### Response\n\nHTML to render the user, as determined by your internal requirements.\n\nFor example :\n\n````html\n\u003chtml\u003e\n\u003chead\u003e\n    \u003cmeta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" /\u003e\n    \u003ctitle\u003eSome user\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n    \u003ch1\u003eFred Bloggs\u003c/h1\u003e\n    \n    \u003cp\u003eFred \u003ca href=\"https://internal.crm/employee?id=12345\"\u003ecrm\u003c/a\u003e\u003c/p\u003e\n    \n    \u003cp\u003eEmail: test@example.com\u003c/p\u003e\n    \u003cp\u003eSales (2017): £390.46\u003c/p\u003e\n    \u003cp\u003eSales (2016): £39.42\u003c/p\u003e\n    \u003ch2\u003eNotes\u003c/h2\u003e\n    \u003cp\u003eLorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce magna magna, convallis quis auctor bibendum, rutrum ut risus. Nulla dictum pulvinar turpis id sodales. Maecenas gravida quam nibh, accumsan egestas nisl mattis ut.\u003c/p\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n````\n\nThis is rendered as an iframe within the SSI webapp.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forlo%2Fexample-crm-integration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forlo%2Fexample-crm-integration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forlo%2Fexample-crm-integration/lists"}