codegreencreative / laravel-freshworks
A Laravel wrapper for Freshworks API
Installs: 12 527
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 5
Open Issues: 1
Requires
- php: >=7.4
- guzzlehttp/guzzle: 7.4.5
- illuminate/support: ^6|^7|^8|^9|^10
Requires (Dev)
- nunomaduro/collision: ^5.3
- orchestra/testbench: ^6.15
- pestphp/pest: ^1.18
- pestphp/pest-plugin-laravel: ^1.1
- phpunit/phpunit: ^8.5|^9.0
README
This Laravel package will allow you to connect to Freshworks CRM API using a Laravel like syntax.
See Freshworks CRM API documentation for details on what can be done with their API.
Installation
composer require codegreencreative/laravel-freshworks
Configuration
php artisan vendor:publish --tag="laravel-freshworks"
Environment
Add your Freshworks API key and domain.
Your domain will be the subdomain you chose when creating your account. {subdomain}
.myfreshworks.com
You can gey your app token by going to Admin Settings -> CRM Code Library -> PHP and copying the app_token
value.
FRESHWORKS_API_KEY=
FRESHWORKS_APP_TOKEN=
FRESHWORKS_DOMAIN=
Examples
When an object is returned back from Freshworks, you have two options when returning that object. ->toObject()
or ->toArray()
// Create a new contact= \Freshworks::contacts()->create([ 'first_name' => 'Jane', 'last_name' => 'Doe', 'email' => 'jane@janedoe.com', 'phone' => '555-555-5555' ]); // Update an existing contact \Freshworks::contacts()->update($contact_id, ['email' => 'jd@janedoe.com']); // Get all views/filters for contacts $views = \Freshworks::contacts()->filters()->toObject(); // List all contacts using a view \Freshworks::contacts()->all($view_id)->toObject() // Tracking // Create a new contact \Freshworks::track()->identify([ 'identifier' => 'john.doe@example.com', //Replace with unique identifier 'First name' => 'Johnny', //Replace with first name of the user 'Last name' => 'Doe', //Replace with last name of the user 'Email' => 'john.doe@example.com', //Replace with email of the user 'Alternate contact number' => '98765432', //Replace with custom field 'company' => array( 'Name' => 'Example.com', //Replace with company name 'Website' => 'www.example.com' //Replace with website of company ) ])); // Track an event \Freshworks::track()->event([ 'identifier' => 'john.doe@example.com', 'name' => 'Test Event', 'role' => 'admin' ])); // Track a page view \Freshworks::track()->pageview([ 'identifier' => 'john.doe@example.com', 'url' => 'http://example.com/pricing' ]));
See Freshworks CRM API documentation for details on what can be done with their API.