# General documentation of gyfti

## Login api call

<mark style="color:green;">`POST`</mark> `https://app.gyfti.fr/api/1.1/wf/login/`

This call allows you to login on the platform

#### Request Body

| Name                                       | Type   | Description                                      |
| ------------------------------------------ | ------ | ------------------------------------------------ |
| email<mark style="color:red;">\*</mark>    | string | user's email login address for his gyfti account |
| password<mark style="color:red;">\*</mark> | string | user's password                                  |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "status": "success",
    "response": {
        "token": "[YOUR_TOKEN]",
        "user_id": "[YOUR_USER_ID]",
        "expires": 
    }
}
```

{% endtab %}

{% tab title="201 " %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

```
{
    "email" : "user@email.com",
    "password" : "userspassword"
}
```

## Verify credentials with token

<mark style="color:green;">`POST`</mark> `https://app.gyfti.fr/api/1.1/wf/is_log`

#### Headers

| Name                                            | Type   | Description              |
| ----------------------------------------------- | ------ | ------------------------ |
| Authorization<mark style="color:red;">\*</mark> | string | 'Bearer  \[YOUR\_TOKEN]' |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "status": "success",
    "response": {
        "user": {
            "Created Date": 1632500327533,
            "Modified Date": 1654592353339,
            "user_signed_up": true,
            "authentication": {
                "email": {
                    "email": "users@email.com",
                    "email_confirmed": true
                }
            },
            "FirstName": "User First Name",
            "LastName": "User Last Name",
            "Company": "Company ID",
            "FullName": " ",
            "Picture": "Profile picture",
            "Signature": "Your signature",
            "Favorite products": [
                "Product ID",
                "Product ID"
            ],
            "Confirm-email": true,
            "news-update": true,
            "Role": "Admin",
            "Status": "Actif",
            "onboarding": true,
            "Team": "1653036584766x296414308790698000",
            "_id": "1632500327487x574792221359071300"
        },
        "state": "The user is logged in"
    }
}
```

{% endtab %}
{% endtabs %}

## Retrieve user's campaign trigger

<mark style="color:blue;">`GET`</mark> `https://app.gyfti.fr/api/1.1/obj/Campaign`

#### Headers

| Name                                            | Type   | Description              |
| ----------------------------------------------- | ------ | ------------------------ |
| Authorization<mark style="color:red;">\*</mark> | string | 'Bearer  \[YOUR\_TOKEN]' |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "response": {
        "cursor": 0,
        "results": [
            {
                "Campaign_Name": "",
                "Campaign Reason": "",
                "Start date": "",
                "Tag": [],
                "Created By": "",
                "Created Date": "",
                "Modified Date": "",
                "Campaign Type": "",
                "_id": ""
            },
}
```

{% endtab %}
{% endtabs %}

## Retrieve user's campaign trigger (postal)

<mark style="color:blue;">`GET`</mark> `https://app.gyfti.fr/api/1.1/obj/Campaign`

#### Headers

| Name                                            | Type   | Description              |
| ----------------------------------------------- | ------ | ------------------------ |
| Authorization<mark style="color:red;">\*</mark> | String | 'Bearer  \[YOUR\_TOKEN]' |

{% tabs %}
{% tab title="200: OK " %}

```javascript
[
  {
    "Campaign Status": "Published",
    "Created Date": "2022-11-09T14:54:54.973Z",
    "Created By": "1632500327487x574792221359071300",
    "Modified Date": "2023-02-07T19:09:27.314Z",
    "Campaign_Name": "test campagne Zapier",
    "Campaign Reason": "Début de contrat",
    "Contacts": [
      "1632758122730x597040260919066600"
    ],
    "Products": [
      "1635951543416x839792715571966700"
    ],
    "Company owner": "1634657344041x544157150139120900",
    "Cost": 20.5,
    "Owner": "1632500327487x574792221359071300",
    "english": false,
    "Email-company": false,
    "Campaign Type": "Directe trigger",
    "Campaign Active Status": "Active",
    "Payment Method ID": "card_1L8NOrBYenjykI90G88Flhfb",
    "Etat de facturation": "En attente",
    "Donations Allowed": true,
    "id": "1668005694737x814513677559398400"
  },
  {
    "Campaign Status": "Published",
    "Created Date": "2023-01-18T18:29:49.646Z",
    "Created By": "1632500327487x574792221359071300",
    "Modified Date": "2023-01-18T18:33:44.832Z",
    "Campaign_Name": "test trigger avant MEP",
    "Campaign Reason": "Fidélisation",
    "Contacts": [
      "1669814854853x372123130763149300",
      "1674064068360x106670271629885440"
    ],
    "Email message": "",
    "Products": [
      "1635951551681x278283392916034440"
    ],
    "Company owner": "1634657344041x544157150139120900",
    "Cost": 84.08,
    "Owner": "1632500327487x574792221359071300",
    "english": false,
    "Email-company": false,
    "Campaign Type": "Directe trigger",
    "Campaign Active Status": "Active",
    "Payment Method ID": "Virement",
    "Etat de facturation": "En attente",
    "CGV_Accepted": true,
    "Donations Allowed": true,
    "id": "1674066589330x346680148415217660"
  }
]
```

{% endtab %}
{% endtabs %}

## Add new contact to a trigger campaign (email)

<mark style="color:green;">`POST`</mark> `https://app.gyfti.fr/api/1.1/wf/1_zapier_add_contact_trigger/`

#### Request Body

| Name                                                 | Type   | Description                                                            |
| ---------------------------------------------------- | ------ | ---------------------------------------------------------------------- |
| contact\_firstname<mark style="color:red;">\*</mark> | String | Your recipent first name                                               |
| contact\_lastname<mark style="color:red;">\*</mark>  | String | Your recipient last name                                               |
| contact\_email<mark style="color:red;">\*</mark>     | String | Your recipient email adress                                            |
| campaign<mark style="color:red;">\*</mark>           | String | The gyfti campaign from your account you wish to send to the recipient |
| jobtitle                                             | String | Your recipient jobtitile                                               |
| Phone                                                | String | Your recipient jobtitle                                                |
| Additional\_address                                  | String | Your recipient additional address                                      |
| Address                                              | String | Your recipient address (number and street)                             |
| City                                                 | String | Your recipient's city                                                  |
| Postal\_code                                         | String | Your recipient's postal code                                           |
| Country                                              | String | Your recipient's country                                               |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  "status": "success",
  "response": {}
}
```

{% endtab %}
{% endtabs %}

```
{
  "inputData": {
    "campaign": "",
    "contact_email": "",
    "contact_firstname": "",
    "contact_lastname": "",
    "jobtitle": "",
    "Phone": "",
    "Adress": "",
    "Additional_address": "",
    "Postal_code": "",
    "City": "",
    "Country": ""
  },
}
```

## Add new contact to a trigger campaign (postal)

<mark style="color:green;">`POST`</mark> `https://app.gyfti.fr/api/1.1/wf/1_zapier_add_contact_trigger_directe/`

#### Request Body

| Name                                                | Type   | Description                                                                     |
| --------------------------------------------------- | ------ | ------------------------------------------------------------------------------- |
| contact\_email<mark style="color:red;">\*</mark>    | String | Your recipient email address                                                    |
| contact\_fistname<mark style="color:red;">\*</mark> | String | Your recipient first name                                                       |
| country<mark style="color:red;">\*</mark>           | String | Your recipient's country (for delivery purposes)                                |
| city<mark style="color:red;">\*</mark>              | String | Your recipient's city (for delivery purposes)                                   |
| postal\_code<mark style="color:red;">\*</mark>      | String | Your recipient's postal code (for delivery purposes)                            |
| additional\_address                                 | String | Your recipient's additional address (for delivery purposes)                     |
| address<mark style="color:red;">\*</mark>           | String | Your recipient's address (number and street name) for delivery purposes         |
| phone<mark style="color:red;">\*</mark>             | String | Your recipient phone number (for delivery purposes)                             |
| jobtitle                                            | String | Your recipient jobtitle                                                         |
| campaign<mark style="color:red;">\*</mark>          | String | The gyfti campaign (postal) from your account you wish to send to the recipient |
| contact\_lastname<mark style="color:red;">\*</mark> | String | Your recipient last name                                                        |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  "status": "success",
  "response": {}
}
```

{% endtab %}
{% endtabs %}
