User Guide
AgencyHandy User Guide - For Client
AgencyHandy User Guide - For Client
  • Agency Handy User Guide - For Client
  • 1. Introduction of Agency Handy
    • 1.1 Why should you choose Agency Handy?
  • 2. Getting Started
    • 2.1 Sign In
    • 2.2 Accessing the Main Interface
  • 3. Managing Dashboard
    • 3.1 Service
      • 3.1.1 View Service Details
      • 3.1.2 Purchase a Service
      • 3.1.4 Share URL of a Service
    • 3.2 Order
    • 3.3 Subscriptions
    • 3.4 Tickets
    • 3.6 Invoices
    • 3.7 Files
      • 3.7.1 Manage Files in Order Task
      • File Feedback
  • Use case
    • How to create Lead via API
Powered by GitBook
On this page

Was this helpful?

  1. Use case

How to create Lead via API

🚀 Create a New Lead Using API

Step 1: Generate an API Key

  1. Go to:

Copy

{{workspaceUrl}}/workspace-config?tab=api-key
  1. Generate and Copy the API key.


Step 2: Get Company ID

📍 Endpoint:

Copy

{{URL}}/accounts/companies

🛠️ Set Headers:

Copy

x-api-key = api Key

You'll get a response like this

Copy

{
    "message": "Companies accosiated with API token.",
    "companies": [
        {
            "_id": "6525994184e9ddd79853450e",
            "name": "onethread123",
            "logo": "",
            "extraSmallLogo": "",
            "largeLogo": ""
        }
    ]
}

📝 What to Do:

  • Get the company ID from the response:

Copy

companies[0]._id
  • Store the ID for later:

Copy

const companyId = "COMPANY_ID_HERE";  // Replace with actual ID

Step 3: Get Client Role ID

📍 Endpoint:

Copy

{{URL}}/roles?type=company

🛠️ Set Headers:

Copy

x-api-key = api Key

You'll get a response like this

Copy

{
    "roles": [
        {
            "_id": "6525994184e9ddd798534535",
            "role": {
                "_id": "6525994184e9ddd79853451e",
                "responsibility": "",
                "name": "client"
            },
            "company": "6525994184e9ddd79853450e",
            "createdAt": "2023-10-10T18:34:41.567Z",
            "updatedAt": "2024-10-01T07:28:48.340Z",
            "__v": 0,
            "type": "company"
        }
    ]
}

📝 What to Do:

  • Find the role with "client" name:

Copy

roles[0].role.name === "client"
  • Store the Client Role ID:

Copy

roles[0]._id

Make sure that you did not copy the _id of roles[0].role object


Step 4: Create a New Lead

📍 Endpoint:

Copy

{{URL}}/company/{{companyId}}/members/bulk-client

🛠️ Headers:

Copy

x-api-key: apiKey
companyid: <companyId>

📦 Request Body:

Copy

    "members": [
        {
            "firstName": "John",
            "lastName": "Doe",
            "email": "john.doe@example.com",
            "role": "ROLE_ID_HERE",
            "isConvertedClient": false,
            "status": "New",
            "contactNo": "1234567890",
            "source": "website",
            "positionInBoard": 1,
            "isConvertedClient": false
        }
    ]
}

✅ Success Response:

Copy

{
    "message": "Lead created successfully",
    "createdMembers": [
        {
            "_id": "NEW_MEMBER_ID",
            "name": "John Doe",
            "status": "New",
            "role": "client"
        }
    ]
}

❗ Important Tips:

  • Make sure "isConvertedClient": false is set in the request.

  • Use the correct Role ID from Step 3.

PreviousUse case

Last updated 3 months ago

Was this helpful?