Skip to content

atymic/laravel-freshworks

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Freshworks CRM API Wrapper

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 yoour account. {subdomain}.myfreshworks.com

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' => '[email protected]',
    'phone' => '555-555-5555'
]);

// Update an existing contact
\Freshworks::contacts()->update($contact_id, ['email' => '[email protected]']);

// 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' => '[email protected]', //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' => '[email protected]', //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' => '[email protected]',
    'name' => 'Test Event',
    'role' => 'admin'
]));

// Track a page view
\Freshworks::track()->pageview([
   'identifier' => '[email protected]',
   'url' => 'http://example.com/pricing'
]));

See Freshworks CRM API documentation for details on what can be done with their API.

API endpoints added

About

Laravel Freshworks API Wrapper

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages

  • PHP 100.0%