Skip to content

signaturit/php-sdk

Repository files navigation

⚠️ DO NOT USE MASTER BRANCH ⚠️

Signaturit PHP SDK

Quality Gate Status

This package is a PHP wrapper around the Signaturit API. If you didn't read the documentation yet you can take a look here.

You'll need at least PHP ^7.2 or ^8.0 to use this package (http://php.net/supported-versions.php).

Configuration

The recommended way to install the SDK is through Composer.

composer require signaturit/signaturit-sdk

Then import Composer's autoload.php file from your script and instantiate the Client class passing in your API access token.

require_once __DIR__.'/vendor/autoload.php';

$accessToken = 'OTllYjUwM2NhYmNjNmJlYTZlNWEzNWYzYmZjNTRiZWI2YjU0ZjUxNzUwZDRjZjEwZTA0ZTFkZWQwZGExNDM3ZQ';

$client = new Signaturit\Client($accessToken);

Please note that by default the client will use our sandbox API. When you are ready to start using the production environment just get the correct access token and pass an additional argument to the constructor:

$client = new Signaturit\Client($accessToken, true);

Examples

Signatures

Count signature requests

Count your signature requests.

$response = $client->countSignatures();

Get all signature requests

Retrieve all data from your signature requests using different filters.

All signatures
$response = $client->getSignatures();
Getting the last 50 signatures
$response = $client->getSignatures(50);
Getting signatures with custom field "crm_id"
$response = $client->getSignatures(100, 0, ['crm_id' => 'CUSTOM_ID'])

Get signature request

Get the information regarding a single signature request passing its ID.

$response = $client->getSignature('a066298d-2877-11e4-b641-080027ea3a6e');

Signature request

Create a new signature request. You can check all signature params.

$filePath   = '/documents/contracts/receipt250.pdf';
$recipients = ['email' => 'john.doe@example.com', 'name' => 'John Doe'];
$options    = ['subject' => 'Receipt no. 250', 'body' => 'Please sign the receipt'];

$response = $client->createSignature($filePath, $recipients, $options);

You can add custom info in your requests

$filePath   = '/documents/contracts/receipt250.pdf';
$recipients = ['email' => 'john.doe@example.com', 'name' => 'John Doe'];
$options    = ['subject' => 'Receipt no. 250', 'body' => 'Please sign the receipt', 'data' => ['crm_id' => '45673']];

$response = $client->createSignature($filePath, $recipients, $options);

You can send templates with the fields filled

$recipients = ['email' => 'john.doe@example.com', 'name' => 'John Doe'];
$options    = ['subject' => 'Receipt no. 250', 'body' => 'Please sign the receipt', 'templates' => ['template_name'], 'data' => ['widget_id' => 'default value']];

$response = $client->createSignature([], $recipients, $options);

Cancel signature request

Cancel a signature request.

$response = $client->cancelSignature('a066298d-2877-11e4-b641-080027ea3a6e');

Send reminder

Send a reminder email.

$response = $client->sendSignatureReminder('a066298d-2877-11e4-b641-080027ea3a6e');

Get audit trail

Get the audit trail of a signature request document

$response = $client->downloadAuditTrail('a066298d-2877-11e4-b641-080027ea3a6e', 'd474a1eb-2877-11e4-b641-080027ea3a6e');

Get signed document

Get the signed document of a signature request document

$response = $client->downloadSignedDocument('a066298d-2877-11e4-b641-080027ea3a6e', 'd474a1eb-2877-11e4-b641-080027ea3a6e');

Branding

Get brandings

Get all account brandings.

$response = $client->getBrandings();

Get branding

Get a single branding.

$response = $client->getBranding('6472aad7-2877-11e4-b641-080027ea3a6e');

Create branding

Create a new branding. You can check all branding params.`

$options = [
    'layout_color'      => '#FFBF00',
    'text_color'        => '#2A1B0A',
    'application_texts' => ['sign_button' => 'Sign!']
];

$response = $client->createBranding($options);

Update branding

Update a single branding.

$options = ['application_texts' => ['send_button' => 'Send!']];

$response = $client->updateBranding('6472aad7-2877-11e4-b641-080027ea3a6e', $options);

Template

Get all templates

Retrieve all data from your templates.

$response = $client->getTemplates();

Email

Get emails

####Get all certified emails

response = client->getEmails()

####Get last 50 emails

response = client->getEmails(50)

####Navigate through all emails in blocks of 50 results

response = client->getEmails(50, 50)

Count emails

Count all certified emails

response = client->countEmails()

Get email

Get a single email

client->getEmail('EMAIL_ID')

Create email

Create a new certified email.

response = client.createEmail(
    ['demo.pdf', 'receipt.pdf'],
    ['email' => 'john.doe@signaturit.com', 'name' => 'Mr John'],
    'Php subject',
    'Php body',
    []
)

Get audit trail document

Get the audit trail document of an email request.

response = client.downloadEmailAuditTrail('EMAIL_ID','CERTIFICATE_ID')

Sms

Get all sms

response = client->getSms()

Count emails

Count all certified sms

response = client->countSms()

Get sms

Get a single sms

client->getSms('SMS_ID')

Create sms

Create a new certified sms.

response = client.createSms(
    [],
    ['phone' => '34123456', 'name' => 'Mr John'],
    'Php body',
    []
)

Get audit trail document

Get the audit trail document of an sms request.

response = client.downloadSmsAuditTrail('SMS_ID','CERTIFICATE_ID')

Team

Get users

Get all account users

$response = $client->getUsers();

Get seats

Get all account seats

$response = $client->getSeats();

Get user

Get a single user

$response = $client->getUser('USER_ID');

Invite users to join your team

Invite user to join the team

$response = $client->inviteUser('bob.soap@signaturit.com', 'admin');

Change user role

Change role for user

$response = $client->changeUserRole('USER_ID', 'member');

Remove user

Remove user from the team

$response = $client->removeUser('USER_ID');

Remove seat

Remove seat from the team

$response = $client->removeSeat('SEAT_ID');

Get groups

Get all account groups

$response = $client->getGroups();

Get group

Get a single group

$response = $client->getGroup('GROUP_ID');

Create group

Create a new group

$response = $client->createGroup('test_node');

Update group

Update group name

$response = $client->updateGroup('GROUP_ID', 'new_name');

Delete group

Delete a group

$response = $client->deleteGroup('GROUP_ID');

Add manager to group

Add a manager to a group

$response = $client->addManagerToGroup('GROUP_ID', 'USER_ID');

Add manager to group

Add a member to a group

$response = $client->addMemberToGroup('GROUP_ID', 'USER_ID');

Delete manager from group

Remove a manager from group

$response = $client->removeManagerFromGroup('GROUP_ID', 'USER_ID');

Delete member from group

Remove a member from group

$response  = $client->removeMemberFromGroup('GROUP_ID', 'USER_ID');

Contacts

Get contacts

Get all contacts

$response = $client->getContacts();

Get contact

Get a single contact

$response = $client->getContact('CONTACT_ID');

Create contact

Create a new contact

$response = $client->createContact('email@signaturit.com', 'name');

Update contact

Update contact

$response = $client->updateContact('CONTACT_ID', 'new_email@signaturit.com', 'name1');

Delete contact

Delete a contact

$response = $client->deleteContact('CONTACT_ID');

Get subscriptions

Get all subscriptions

$response = $client->getSubscriptions();

Get subscription

Get a single subscription

$response = $client->getSubscription('SUBSCRIPTION_ID');

Create subscription

Create a new subscription

$response = $client->createSubscription('http://httpbin.org/post', 'email_processed');

Update subscription

Update contact

$response = $client->updateSubscription('SUBSCRIPTION_ID', null, 'email_delivered');

Delete subscription

Delete a subscription

$response = $client->deleteSubscription('SUBSCRIPTION_ID');