Skip to content

Latest commit

 

History

History
509 lines (429 loc) · 145 KB

README.md

File metadata and controls

509 lines (429 loc) · 145 KB

Activities

(crm.activities)

Overview

Available Operations

list

List activities

Example Usage

import apideck_unify
from apideck_unify import Apideck
import dateutil.parser
import os

with Apideck(
    api_key=os.getenv("APIDECK_API_KEY", ""),
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:

    res = apideck.crm.activities.list(service_id="salesforce", filter_={
        "updated_since": dateutil.parser.isoparse("2020-09-30T07:43:32.000Z"),
    }, sort={
        "by": apideck_unify.ActivitiesSortBy.CREATED_AT,
        "direction": apideck_unify.SortDirection.DESC,
    }, pass_through={
        "search": "San Francisco",
    }, fields="id,updated_at")

    while res is not None:
        # Handle items

        res = res.next()

Parameters

Parameter Type Required Description Example
raw Optional[bool] Include raw response. Mostly used for debugging purposes
service_id Optional[str] Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. salesforce
cursor OptionalNullable[str] Cursor to start from. You can find cursors for next/previous pages in the meta.cursors property of the response.
limit Optional[int] Number of results to return. Minimum 1, Maximum 200, Default 20
filter_ Optional[models.ActivitiesFilter] Apply filters {
"updated_since": "2020-09-30T07:43:32.000Z"
}
sort Optional[models.ActivitiesSort] Apply sorting {
"by": "created_at",
"direction": "desc"
}
pass_through Dict[str, Any] Optional unmapped key/values that will be passed through to downstream as query parameters. Ie: ?pass_through[search]=leads becomes ?search=leads {
"search": "San Francisco"
}
fields OptionalNullable[str] The 'fields' parameter allows API users to specify the fields they want to include in the API response. If this parameter is not present, the API will return all available fields. If this parameter is present, only the fields specified in the comma-separated string will be included in the response. Nested properties can also be requested by using a dot notation.

Example: fields=name,email,addresses.city

In the example above, the response will only include the fields "name", "email" and "addresses.city". If any other fields are available, they will be excluded.
id,updated_at
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.CrmActivitiesAllResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 4XX, 5XX */*

create

Create activity

Example Usage

import apideck_unify
from apideck_unify import Apideck
import os

with Apideck(
    api_key=os.getenv("APIDECK_API_KEY", ""),
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:

    res = apideck.crm.activities.create(type_=apideck_unify.ActivityType.MEETING, service_id="salesforce", activity_datetime="2021-05-01T12:00:00.000Z", duration_seconds=1800, user_id="12345", account_id="12345", contact_id="12345", company_id="12345", opportunity_id="12345", lead_id="12345", owner_id="12345", campaign_id="12345", case_id="12345", asset_id="12345", contract_id="12345", product_id="12345", solution_id="12345", custom_object_id="12345", title="Meeting", description="More info about the meeting", note="An internal note about the meeting", location="Space", location_address={
        "id": "123",
        "type": apideck_unify.Type.PRIMARY,
        "string": "25 Spring Street, Blackburn, VIC 3130",
        "name": "HQ US",
        "line1": "Main street",
        "line2": "apt #",
        "line3": "Suite #",
        "line4": "delivery instructions",
        "street_number": "25",
        "city": "San Francisco",
        "state": "CA",
        "postal_code": "94104",
        "country": "US",
        "latitude": "40.759211",
        "longitude": "-73.984638",
        "county": "Santa Clara",
        "contact_name": "Elon Musk",
        "salutation": "Mr",
        "phone_number": "111-111-1111",
        "fax": "122-111-1111",
        "email": "elon@musk.com",
        "website": "https://elonmusk.com",
        "notes": "Address notes or delivery instructions.",
        "row_version": "1-12345",
    }, all_day_event=False, private=True, group_event=True, event_sub_type="debrief", group_event_type="Proposed", child=False, archived=False, deleted=False, show_as=apideck_unify.ShowAs.BUSY, done=False, start_datetime="2021-05-01T12:00:00.000Z", end_datetime="2021-05-01T12:30:00.000Z", activity_date="2021-05-01", end_date="2021-05-01", recurrent=False, reminder_datetime="2021-05-01T17:00:00.000Z", reminder_set=False, video_conference_url="https://us02web.zoom.us/j/88120759396", video_conference_id="zoom:88120759396", custom_fields=[
        {
            "id": "2389328923893298",
            "name": "employee_level",
            "description": "Employee Level",
        },
    ], attendees=[
        {
            "name": "Elon Musk",
            "first_name": "Elon",
            "middle_name": "D.",
            "last_name": "Musk",
            "prefix": "Mr.",
            "suffix": "PhD",
            "email_address": "elon@musk.com",
            "is_organizer": True,
            "status": apideck_unify.ActivityAttendeeStatus.ACCEPTED,
        },
    ], pass_through=[

    ])

    assert res.create_activity_response is not None

    # Handle response
    print(res.create_activity_response)

Parameters

Parameter Type Required Description Example
type Nullable[models.ActivityType] ✔️ The type of the activity meeting
raw Optional[bool] Include raw response. Mostly used for debugging purposes
service_id Optional[str] Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. salesforce
activity_datetime OptionalNullable[str] The date and time of the activity 2021-05-01T12:00:00.000Z
duration_seconds OptionalNullable[int] The duration of the activity in seconds 1800
user_id OptionalNullable[str] The user related to the activity 12345
account_id OptionalNullable[str] The account related to the activity 12345
contact_id OptionalNullable[str] The contact related to the activity 12345
company_id OptionalNullable[str] The company related to the activity 12345
opportunity_id OptionalNullable[str] The opportunity related to the activity 12345
lead_id OptionalNullable[str] The lead related to the activity 12345
owner_id OptionalNullable[str] The owner of the activity 12345
campaign_id OptionalNullable[str] The campaign related to the activity 12345
case_id OptionalNullable[str] The case related to the activity 12345
asset_id OptionalNullable[str] The asset related to the activity 12345
contract_id OptionalNullable[str] The contract related to the activity 12345
product_id OptionalNullable[str] The product related to the activity 12345
solution_id OptionalNullable[str] The solution related to the activity 12345
custom_object_id OptionalNullable[str] The custom object related to the activity 12345
title OptionalNullable[str] The title of the activity Meeting
description OptionalNullable[str] A description of the activity More info about the meeting
note OptionalNullable[str] An internal note about the activity An internal note about the meeting
location OptionalNullable[str] The location of the activity Space
location_address Optional[models.Address] N/A
all_day_event OptionalNullable[bool] Whether the Activity is an all day event or not false
private OptionalNullable[bool] Whether the Activity is private or not true
group_event OptionalNullable[bool] Whether the Activity is a group event or not true
event_sub_type OptionalNullable[str] The sub type of the group event debrief
group_event_type OptionalNullable[str] The type of the group event Proposed
child OptionalNullable[bool] Whether the activity is a child of another activity or not false
archived OptionalNullable[bool] Whether the activity is archived or not false
deleted OptionalNullable[bool] Whether the activity is deleted or not false
show_as OptionalNullable[models.ShowAs] N/A busy
done OptionalNullable[bool] Whether the Activity is done or not false
start_datetime OptionalNullable[str] The start date and time of the activity 2021-05-01T12:00:00.000Z
end_datetime OptionalNullable[str] The end date and time of the activity 2021-05-01T12:30:00.000Z
activity_date OptionalNullable[str] The date of the activity 2021-05-01
end_date OptionalNullable[str] The end date of the activity 2021-05-01
recurrent Optional[bool] Whether the activity is recurrent or not false
reminder_datetime OptionalNullable[str] The date and time of the reminder 2021-05-01T17:00:00.000Z
reminder_set OptionalNullable[bool] Whether the reminder is set or not false
video_conference_url OptionalNullable[str] The URL of the video conference https://us02web.zoom.us/j/88120759396
video_conference_id OptionalNullable[str] The ID of the video conference zoom:88120759396
custom_fields List[models.CustomField] Custom fields of the activity
attendees List[models.ActivityAttendeeInput] N/A
pass_through List[models.PassThroughBody] The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.CrmActivitiesAddResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 4XX, 5XX */*

get

Get activity

Example Usage

from apideck_unify import Apideck
import os

with Apideck(
    api_key=os.getenv("APIDECK_API_KEY", ""),
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:

    res = apideck.crm.activities.get(id="<id>", service_id="salesforce", fields="id,updated_at")

    assert res.get_activity_response is not None

    # Handle response
    print(res.get_activity_response)

Parameters

Parameter Type Required Description Example
id str ✔️ ID of the record you are acting upon.
service_id Optional[str] Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. salesforce
raw Optional[bool] Include raw response. Mostly used for debugging purposes
fields OptionalNullable[str] The 'fields' parameter allows API users to specify the fields they want to include in the API response. If this parameter is not present, the API will return all available fields. If this parameter is present, only the fields specified in the comma-separated string will be included in the response. Nested properties can also be requested by using a dot notation.

Example: fields=name,email,addresses.city

In the example above, the response will only include the fields "name", "email" and "addresses.city". If any other fields are available, they will be excluded.
id,updated_at
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.CrmActivitiesOneResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 4XX, 5XX */*

update

Update activity

Example Usage

import apideck_unify
from apideck_unify import Apideck
import os

with Apideck(
    api_key=os.getenv("APIDECK_API_KEY", ""),
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:

    res = apideck.crm.activities.update(id="<id>", type_=apideck_unify.ActivityType.MEETING, service_id="salesforce", activity_datetime="2021-05-01T12:00:00.000Z", duration_seconds=1800, user_id="12345", account_id="12345", contact_id="12345", company_id="12345", opportunity_id="12345", lead_id="12345", owner_id="12345", campaign_id="12345", case_id="12345", asset_id="12345", contract_id="12345", product_id="12345", solution_id="12345", custom_object_id="12345", title="Meeting", description="More info about the meeting", note="An internal note about the meeting", location="Space", location_address={
        "id": "123",
        "type": apideck_unify.Type.PRIMARY,
        "string": "25 Spring Street, Blackburn, VIC 3130",
        "name": "HQ US",
        "line1": "Main street",
        "line2": "apt #",
        "line3": "Suite #",
        "line4": "delivery instructions",
        "street_number": "25",
        "city": "San Francisco",
        "state": "CA",
        "postal_code": "94104",
        "country": "US",
        "latitude": "40.759211",
        "longitude": "-73.984638",
        "county": "Santa Clara",
        "contact_name": "Elon Musk",
        "salutation": "Mr",
        "phone_number": "111-111-1111",
        "fax": "122-111-1111",
        "email": "elon@musk.com",
        "website": "https://elonmusk.com",
        "notes": "Address notes or delivery instructions.",
        "row_version": "1-12345",
    }, all_day_event=False, private=True, group_event=True, event_sub_type="debrief", group_event_type="Proposed", child=False, archived=False, deleted=False, show_as=apideck_unify.ShowAs.BUSY, done=False, start_datetime="2021-05-01T12:00:00.000Z", end_datetime="2021-05-01T12:30:00.000Z", activity_date="2021-05-01", end_date="2021-05-01", recurrent=False, reminder_datetime="2021-05-01T17:00:00.000Z", reminder_set=False, video_conference_url="https://us02web.zoom.us/j/88120759396", video_conference_id="zoom:88120759396", custom_fields=[
        {
            "id": "2389328923893298",
            "name": "employee_level",
            "description": "Employee Level",
        },
        {
            "id": "2389328923893298",
            "name": "employee_level",
            "description": "Employee Level",
            "value": True,
        },
        {
            "id": "2389328923893298",
            "name": "employee_level",
            "description": "Employee Level",
        },
    ], attendees=[
        {
            "name": "Elon Musk",
            "first_name": "Elon",
            "middle_name": "D.",
            "last_name": "Musk",
            "prefix": "Mr.",
            "suffix": "PhD",
            "email_address": "elon@musk.com",
            "is_organizer": True,
            "status": apideck_unify.ActivityAttendeeStatus.ACCEPTED,
        },
    ], pass_through=[
        {
            "service_id": "<id>",
            "extend_paths": [

            ],
        },
        {
            "service_id": "<id>",
            "extend_paths": [
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
            ],
        },
        {
            "service_id": "<id>",
            "extend_paths": [
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
            ],
        },
    ])

    assert res.update_activity_response is not None

    # Handle response
    print(res.update_activity_response)

Parameters

Parameter Type Required Description Example
id str ✔️ ID of the record you are acting upon.
type Nullable[models.ActivityType] ✔️ The type of the activity meeting
service_id Optional[str] Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. salesforce
raw Optional[bool] Include raw response. Mostly used for debugging purposes
activity_datetime OptionalNullable[str] The date and time of the activity 2021-05-01T12:00:00.000Z
duration_seconds OptionalNullable[int] The duration of the activity in seconds 1800
user_id OptionalNullable[str] The user related to the activity 12345
account_id OptionalNullable[str] The account related to the activity 12345
contact_id OptionalNullable[str] The contact related to the activity 12345
company_id OptionalNullable[str] The company related to the activity 12345
opportunity_id OptionalNullable[str] The opportunity related to the activity 12345
lead_id OptionalNullable[str] The lead related to the activity 12345
owner_id OptionalNullable[str] The owner of the activity 12345
campaign_id OptionalNullable[str] The campaign related to the activity 12345
case_id OptionalNullable[str] The case related to the activity 12345
asset_id OptionalNullable[str] The asset related to the activity 12345
contract_id OptionalNullable[str] The contract related to the activity 12345
product_id OptionalNullable[str] The product related to the activity 12345
solution_id OptionalNullable[str] The solution related to the activity 12345
custom_object_id OptionalNullable[str] The custom object related to the activity 12345
title OptionalNullable[str] The title of the activity Meeting
description OptionalNullable[str] A description of the activity More info about the meeting
note OptionalNullable[str] An internal note about the activity An internal note about the meeting
location OptionalNullable[str] The location of the activity Space
location_address Optional[models.Address] N/A
all_day_event OptionalNullable[bool] Whether the Activity is an all day event or not false
private OptionalNullable[bool] Whether the Activity is private or not true
group_event OptionalNullable[bool] Whether the Activity is a group event or not true
event_sub_type OptionalNullable[str] The sub type of the group event debrief
group_event_type OptionalNullable[str] The type of the group event Proposed
child OptionalNullable[bool] Whether the activity is a child of another activity or not false
archived OptionalNullable[bool] Whether the activity is archived or not false
deleted OptionalNullable[bool] Whether the activity is deleted or not false
show_as OptionalNullable[models.ShowAs] N/A busy
done OptionalNullable[bool] Whether the Activity is done or not false
start_datetime OptionalNullable[str] The start date and time of the activity 2021-05-01T12:00:00.000Z
end_datetime OptionalNullable[str] The end date and time of the activity 2021-05-01T12:30:00.000Z
activity_date OptionalNullable[str] The date of the activity 2021-05-01
end_date OptionalNullable[str] The end date of the activity 2021-05-01
recurrent Optional[bool] Whether the activity is recurrent or not false
reminder_datetime OptionalNullable[str] The date and time of the reminder 2021-05-01T17:00:00.000Z
reminder_set OptionalNullable[bool] Whether the reminder is set or not false
video_conference_url OptionalNullable[str] The URL of the video conference https://us02web.zoom.us/j/88120759396
video_conference_id OptionalNullable[str] The ID of the video conference zoom:88120759396
custom_fields List[models.CustomField] Custom fields of the activity
attendees List[models.ActivityAttendeeInput] N/A
pass_through List[models.PassThroughBody] The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.CrmActivitiesUpdateResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 4XX, 5XX */*

delete

Delete activity

Example Usage

from apideck_unify import Apideck
import os

with Apideck(
    api_key=os.getenv("APIDECK_API_KEY", ""),
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:

    res = apideck.crm.activities.delete(id="<id>", service_id="salesforce")

    assert res.delete_activity_response is not None

    # Handle response
    print(res.delete_activity_response)

Parameters

Parameter Type Required Description Example
id str ✔️ ID of the record you are acting upon.
service_id Optional[str] Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. salesforce
raw Optional[bool] Include raw response. Mostly used for debugging purposes
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.CrmActivitiesDeleteResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 4XX, 5XX */*