Create a new contract

Connector functions are a new addition to Slack automations. We recommend understanding the systems and APIs you're integrating with before setup.

Facts

Create a new contract

Schema: Connectors.Deel.functions.CreateContract
Service: Deel

Input parameters

Required parameters
Determines whether this connector will use the credentials of the user starting the workflow or the credentials configured by an app collaborator. See the authentication section on this page for details.

Example
{ credential_source: "END_USER" }
The title of the contract

Example
"Scott Slacksalot Sales Contracting"
The ID of the legal entity to associate with this contract

Example
"12345"
The ID of the team to associate with this contract

Example
"12345"
The job title to associate with this contract

Example
"Lead Sales Enablement Guru"
If true, the contractor is required to upload necessary compliance documents as per their country's labor laws

Example
false
The specific type of this contract

Example
One of: "pay_as_you_go_time_based", "payg_tasks", "payg_milestones", "ongoing_time_based"
The date when this contract shall start, in YYYY-MM-DD format

Example
"2024-05-05"
The currency code to use for this contract

Example
"AL"
The scale of the invoice cycle

Example
One of: "weekly", "monthly", "biweekly", "semimonthly", "calendar-month"
The day of the cycle_end_type in which the invoice cycle ends

Example
1
The end-type for the contract cycle (if weekly, monday = 1; if monthly, can be 1-31)

Example
One of: "DAY_OF_WEEK", "DAY_OF_LAST_WEEK", "DAY_OF_MONTH"
The classification of how payments will be due (if payment is due on the last day of the month, use WITHIN_MONTH)

Example
One of: "REGULAR", "WITHIN_MONTH"
The number of days between 0-90 in which the payment is due

Example
45
Optional parameters
The total amount to be paid for this contract (can be excluded when creating a pay-as-you-go, task-based, or milestone contracts)
The frequency at which the amount is paid

Output parameters

Required parameters
Contract ID
Contract URL

Authentication

A connector's access token property specifies how the connector handles authentication.

This connector only supports using the credentials of the user running the workflow, so the credential_source of this connector's access token parameter must be set to "END_USER".

End-user authentication

user Workflows that include a connector function relying on end-user authentication can can only be started with a link trigger.

deel_access_token: {
    credential_source: "END_USER"
}

End-user experience: User will be prompted to link their external account via OAuth when they first start the workflow that contains this connector.

Developer experience: Developer does not have to implement authentication in app.

How to use

First, import Connectors from deno-slack-hub into your project's import_map.json file, like this:

{
  "imports": {
    "deno-slack-hub/": "https://deno.land/x/deno_slack_hub@2.2.0/",
    "deno-slack-sdk/": "https://deno.land/x/deno_slack_sdk@2.14.2/",
    "deno-slack-api/": "https://deno.land/x/deno_slack_api@2.8.0/",
  }
}

Next, import Connectors at the top of your workflow's definition file:

// my_workflow_file.ts
import { Connectors } from "deno-slack-hub/mod.ts";

Finally, add the connector as a step in your workflow just like you would a built-in Slack function.

SomeWorkflow.addStep(
  Connectors.Deel.functions.CreateContract, {
    deel_access_token: { credential_source: "END_USER" },

    // The title of the contract
    title: "Scott Slacksalot Sales Contracting",

    // The ID of the legal entity to associate with this contract
    legal_entity_id: "12345",

    // The ID of the team to associate with this contract
    team_id: "12345",

    // The job title to associate with this contract
    job_title: "Lead Sales Enablement Guru",

    // If true, the contractor is required to upload necessary compliance documents as per their country's labor laws
    documents_required: false,

    // The specific type of this contract
    contract_type: "payg_milestones",

    // The date when this contract shall start, in <code>YYYY-MM-DD</code> format
    start_date: "2024-05-05",

    // (Optional) The total amount to be paid for this contract (can be excluded when creating a pay-as-you-go, task-based, or milestone contracts)
    // amount: 24000,

    // The currency code to use for this contract
    currency_code: "AL",

    // The scale of the invoice cycle
    frequency: "weekly",

    // The day of the <code>cycle_end_type</code> in which the invoice cycle ends
    cycle_end: 1,

    // The end-type for the contract cycle (if weekly, monday = 1; if monthly, can be 1-31)
    cycle_end_type: "DAY_OF_WEEK",

    // The classification of how payments will be due (if payment is due on the last day of the month, use <code>WITHIN_MONTH</code>)
    payment_due_type: "REGULAR",

    // The number of days between 0-90 in which the payment is due
    payment_due_days: 45,

    // (Optional) The frequency at which the amount is paid
    // scale: "monthly"
  }
);

🧙🏼 Your admin may need to approve the connector first. If your workspace has been configured to only allow admin-approved apps, the CLI will prompt you to send an admin approval request the first time you try to use a connector that hasn't been approved by an admin yet. While waiting for admin approval, the CLI may report an error like this:

Workflow function... is referring to an unknown step output parameter...

You can safely ignore this error; it will go away as soon as your workspace admin approves your request to use the connector.