Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Pipedrive - Add a deal #2482

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
252 changes: 252 additions & 0 deletions Pipedrive/Pipedrive_Add_a_deal.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "7c345a60-a5a2-4b4e-83e8-3fd26b8d7fc5",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"<img width=\"8%\" alt=\"Naas.png\" src=\"https://raw.githubusercontent.com/jupyter-naas/awesome-notebooks/master/.github/assets/logos/Naas.png\" style=\"border-radius: 15%\">"
]
},
{
"cell_type": "markdown",
"id": "4fc0e3f6-2f55-43c3-8dae-7feab09fc725",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"# Pipedrive - Add a deal"
]
},
{
"cell_type": "markdown",
"id": "867b0456-5d9a-4bd6-809c-eaa1a7086151",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Tags:** #pipedrive #deal #add #api #v1 #python"
]
},
{
"cell_type": "markdown",
"id": "ff84e3bb-95cc-41f5-aab0-8c4b00349e6c",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Author:** [Florent Ravenel](https://www.linkedin.com/in/florent-ravenel/)"
]
},
{
"cell_type": "markdown",
"id": "0a6b2e92-b353-4c61-8461-ad9f3332aa61",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Last update:** 2023-12-22 (Created: 2023-12-22)"
]
},
{
"cell_type": "markdown",
"id": "05e9fd8b-27dc-4b43-9a67-3b25eda59699",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Description:** This notebook adds a new deal. It uses the Pipedrive API v1 to add a deal to the Pipedrive platform."
]
},
{
"cell_type": "markdown",
"id": "15336c56-acca-459a-a075-f81a5ab5cdf3",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**References:**\n- [Pipedrive API v1 - Deals](https://developers.pipedrive.com/docs/api/v1/Deals#addDeal)\n- [Pipedrive API v1 - Authentication](https://developers.pipedrive.com/docs/api/v1/#authentication)"
]
},
{
"cell_type": "markdown",
"id": "b394e079-8484-49d0-b00b-e7f3b72a2ef0",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"## Input"
]
},
{
"cell_type": "markdown",
"id": "5e69d42d-4223-4c1f-adbe-fceb68813a2d",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Import libraries"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b1b6896f-0f5b-4e1f-be53-3060fa30f069",
"metadata": {
"papermill": {},
"tags": []
},
"source": "import requests",
"outputs": []
},
{
"cell_type": "markdown",
"id": "133dc409-7a59-4d33-b8e6-172d558fd5d9",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Setup variables\n- **api_token**: API token used to authenticate the request. [See how to get an API token](https://developers.pipedrive.com/docs/api/v1/#authentication).\n- **title**: Title of the deal.\n- **value**: Value of the deal."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e576b493-07a7-4569-a73b-e72f3a9f8ae6",
"metadata": {
"papermill": {},
"tags": []
},
"source": "api_token = \"<YOUR_API_TOKEN>\"\ntitle = \"New deal\"\nvalue = 1000",
"outputs": []
},
{
"cell_type": "markdown",
"id": "88290219-023b-4671-9932-3cf769ae0673",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"## Model"
]
},
{
"cell_type": "markdown",
"id": "73bc422a-b87b-4ff8-9491-3606f32e759b",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Add a deal"
]
},
{
"cell_type": "markdown",
"id": "61751a41-7899-42e9-913e-da51562213ab",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"This function adds a new deal to the Pipedrive platform."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f2472e57-d5d5-4d1c-9111-b472c0baa810",
"metadata": {
"papermill": {},
"tags": []
},
"source": "def add_deal(api_token, title, value):\n url = \"https://api.pipedrive.com/v1/deals\"\n headers = {\"Authorization\": \"Bearer \" + api_token}\n data = {\"title\": title, \"value\": value}\n response = requests.post(url, headers=headers, data=data)\n return response",
"outputs": []
},
{
"cell_type": "markdown",
"id": "2985a82b-b80b-4825-a8d7-83bf5c41d7ce",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"## Output"
]
},
{
"cell_type": "markdown",
"id": "17e3d4a2-d27d-4c47-92e8-23e1c7259440",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Display result"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f1e4699a-0379-476e-9107-9b4677fb8de6",
"metadata": {
"papermill": {},
"tags": []
},
"source": "response = add_deal(api_token, title, value)\nprint(response.json())",
"outputs": []
},
{
"cell_type": "markdown",
"id": "e6774dc4-600a-4993-a82e-ee2556a04a94",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
" "
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"state": {},
"version_major": 2,
"version_minor": 0
}
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading