# Version 1 (old method)

{% hint style="warning" %}
This procedure is for users who already have a configured WhatsApp application. If not, please refer to V2 to create a new application.
{% endhint %}

## Features

* Open tickets directly from WhatsApp
* Simplify your exchanges and track your tickets directly from the app or a web browser

## Requirements (self-hosted)

| GLPI     | PHP minimum | PHP recommanded |
| -------- | ----------- | --------------- |
| ≥ 11.0.3 | 8.2         | 8.4             |

{% hint style="info" %}
A [GLPI Network BASIC](https://services.glpi-network.com/#offers) subscription (or higher) is required. This plugin is also available for all GLPI Network [Cloud instances](https://glpi-network.cloud).
{% endhint %}

* Must have an active WhatsApp Business account (Meta) with a valid phone number
* Must have a GLPI instance accessible via the internet and HTTPS

{% hint style="success" %}
**GDPR - Good to know** For the WhatsApp plugin to function correctly, GLPI stores the user's phone number in its database. This information is essential for the WhatsApp plugin to function.

Using the anonymize plugin may lead to undesired behavior if the phone number is anonymized.
{% endhint %}

***

## Install the plugin

<div align="left"><img src="https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/ydlMKj5rln7FxM9QAb3o/attachments/de293202-7883-40aa-8336-a5da825a0438.png" alt="Install the plugin"></div>

The plugin settings will then be configured in **`Setup`** > **`General`** > **`Whatsapp`**.

***

## Create an application from a Meta account

### Create an App ID

* From the Developer Meta account <https://developers.facebook.com/apps/creation/>
* Click on **`Create an App ID`**
* Give the app a name, and provide a contact email address.
* In the next step, specify which use case will be linked to the application (All > Other).
* Select the application type (Business), to be able to send/receive notifications from WhatsApp.
* Click on **Create app**

![Create your application](https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/gEHzkVyyJrtKP9sXOPJt/attachments/1090f910-36b6-4489-a12f-4f16b637ea26.png)

![Select the usage case](https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/abEk5CgxbOgio5wVvgRC/attachments/fc5deca5-ff26-4b6c-a6bd-78a4f94c6282.png)

![Select the application type](https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/hc8FJizlLuFAjnSmOOcy/attachments/19c83e5b-80d5-4fa8-af66-61afac2c747b.png)

![Save your application](https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/bgM0aNEzxr1aopxsBhdg/attachments/cdec7607-a517-4aea-b929-6b1aba843ecc.png)

### Add and configure products to your application

* On the next page, you will be prompted to add products (services) to your application.
* Locate WhatsApp in the list and click **Set up**.

<div align="left"><img src="https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/sYtV3aPpj8p1TE4RHsHk/attachments/5ac40ddd-4168-4b3d-a55c-35b62cc5dce1.png" alt="Add WhatsApp to your application"></div>

* Click **Configure API** in the left-hand menu and ensure the phone number is correctly entered.

![Control the phone number](https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/bdAr5e2pyifynfJp2Yvf/attachments/e73383b4-fe1c-40f3-9866-e139b3816442.png)

* If not, go to step 5 and click on **Add a phone number** and follow the steps.

![Add a phone number to your application](https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/TUQREA0vqPYxYsvQu0s1/attachments/de3625f9-0221-4472-903a-c5cb567c323a.png)

### Set up the Webhooks

* From the Webhook tab, re-enter the URL and token (available from GLPI (**`Setup`** > **`General`** > **`Whatsapp`**)
* Click on **Verify and Save**

![Verify and save your informations](https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/e1Lr77hfq6CCwKTOxWi2/attachments/5ba74809-9836-4444-b12e-1f26c8bddc29.png)

* In the product list, select **WhatsApp Business Account**
* Check the **Subscriber** box in the **`Message`** field (you may need to refresh the page to access this option)

![Activate messges](https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/JIJR8j8DS35bPHGdnkyg/attachments/56e9a92b-9b38-49bb-bec5-bc376aaea5e0.png)

***

## User Management

It is best to create a dedicated user with specific permissions to be authorized to use WhatsApp webhooks.

### Create a User

* From your [account Meta](https://business.facebook.com/), go to **`Users`** > **`People`**
* Click on **Invite a person**
* Enter the requested information at each step:
  * Email address
  * Assign access: select **Full control**
  * Assign an asset: select the desired WhatsApp account and ensure that the **`Messages`** and **`Message templates`** options are checked

<div align="left"><img src="https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/WBpGOnkEQ7Gi2qsdORYg/attachments/d85528af-c8bf-4026-81d1-b89d26959c9e.png" alt="Activate messges and templates"></div>

{% hint style="success" %}
Before the user can manage the application, the invitation to join the WhatsApp account must be accepted. Once the invitation is accepted, there may be a delay before the user can be granted access to the application.

![](https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/inH3kpWQqRuCw5nVEPYY/attachments/9796a5ed-fb90-4323-b07f-c2b8e6617da7.png)
{% endhint %}

* Confirm your entry to save the account and send the invitation.

### Assign the application

* Once the invitation has been accepted, go to your Meta account, then **`Accounts`** > **`Applications`**
* Select the application you created earlier, then **Assign a user**
* Check the desired user
* Assign the necessary permissions
* Click **Assign**

![Assign user](https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/04VL7r2CFxnO7XfSG15l/attachments/84d57bcc-da7d-4263-af2d-19ae58ca1f2d.png)

### Creating a System user account

The system user account allows generation of a token that must be entered in GLPI to validate the configuration between WhatsApp and GLPI.

* From **`Users`** > **`System Users`**, click **`+ Add`**
* Enter a name for the account
* Confirm your entry

Once the account is created:

* Click on the menu on the right, then **Assign assets**

![Assign assets](https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/72ea1fkToq6RfavIDMXc/attachments/d493c501-a101-42e0-8a70-be23c99a590c.png)

* Select the created application, then **Full Control**
* From WhatsApp Account (**`https://business.facebook.com/latest/settings/system_users`**), select **`Messages`** and **`Messages_Templates`**

![Assign and save the asset](https://3573604317-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUCcURk2xlvtpVGbiRZf%2Fuploads%2Fy3wJ5YNsnDN0bumj03NE%2F84a794cd-1480-46f4-94bf-36c905c97fa4.png?alt=media\&token=b630a4da-2137-4e16-aefd-cfdbacd727a9)

* Click on **Assign Assets**

### Token Generation

* On this same page, click on **Generate Token**

![Generate a token](https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/JMghrVef0piI6rTkn9b7/attachments/29afd9bb-213a-4f2a-98af-aee551fb8dd9.png)

* Select the desired application
* Select the token expiration time (60 days or **never**)

{% hint style="danger" %}
**If you select 60 days, you will need to renew your token to avoid a service interruption for your application**
{% endhint %}

* Assign the following 3 permissions:
  * **`whatsapp_business_manage_events`**
  * **`whatsapp_business_management`**
  * **`whatsapp_business_messaging`**

![Token permissions](https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/S1j2sfx4ES4Rj9rY1QLE/attachments/89604c80-fd33-4725-ba55-02c1b9979f03.png)

* Then click on **Generate token**

{% hint style="success" %}
Keep this token, as it must be entered in GLPI.
{% endhint %}

***

## Setup GLPI

* From your GLPI instance, go to `**Setup**` > `**General**` > `**WhatsApp**`
* In **WhatsApp Business Account ID**, enter the WhatsApp account ID (available in your account settings [Meta](https://business.facebook.com/) then **Accounts** > **WhatsApp Accounts** `https://business.facebook.com/latest/settings/whatsapp_account`)

![Retrieve the Meta Application ID](https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/p8rrlfhMW0wWXtDPUNjx/attachments/84fa47b9-a2e2-428f-89bc-3438506a45f4.png)

* In **Access Token**, enter the previously generated token.
* Save your entry.

If everything is OK, a message will appear informing you that your configuration is valid.

![Validate your GLPI configuration](https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/dAzZQyRM3F1UqPvFWlIy/attachments/a5b57826-a951-4e3c-9046-e1d0033a31b1.png)

***

## Setting up Notification Templates

You don't need to do anything special regarding the templates. They are generated directly by the plugin and are visible in the Message Templates section of the WhatsApp plugin configuration on GLPI.

![Templates GLPI's messages](https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/732TSYBdbu0VDoXas8mC/attachments/208c4611-696d-49df-89d5-814e62ffd8f2.png)

The **`refresh`** button allows you to resynchronize the templates with WhatsApp if they are not **APPROVED** (or when adding new languages ​​via the plugin).

***

## Before publishing your application

### Privacy Policy and Logo

Before activating your application, you will need to specify a URL for the privacy policy.

* From **`Application Configuration`** > **`Basic`**, specify the appropriate URL.
* Also add a **logo** (the one that will appear publicly on WhatsApp contacts).

![Information required before publication](https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/t3EMN9EpxMYbNJahCMWF/attachments/93caadc8-3aa5-479d-990b-6e91c92f0aff.png)

***

### Payment Method

A payment method must be activated, otherwise message templates cannot be sent.

* From your [Meta account](https://business.facebook.com/), go to **`Accounts`** > **`WhatsApp accounts`**
* Select the desired account
* Click on **Payment settings** and follow the steps

![Payment information](https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/cErdQMkNIZW2MGIs3XGe/attachments/ac05a5cd-eee9-4bb3-a2e3-d36d0984116c.png)

***

## Publish the application

You can now publish your application.

![Publish your application](https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/eun7HA0U36LZSAOD11MW/attachments/5cdc3d1a-3923-4664-9909-9cc795b6edfa.png)

***

## Ticket Configuration

### Anonymous Access

You can allow or deny access to anonymous users (those not present in the database).

![Anonymous access](https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/4xvyZil1K6Brwm3UdhYb/attachments/6e859db5-ae71-4a7e-9fb4-8b63debfdb80.png)

### Ticket Title Template

You can add variables and/or text that will be included in the ticket title.

<div align="left"><img src="https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/TXTXfM1GbFecj1L6kaZA/attachments/0b64f11c-41ed-4274-a524-e904d3fb865e.png" alt="Example of a ticket title template"></div>

### Business Rules

To customize the plugin's behavior, you can add business rules. The engine works like the GLPI rules engine.

Rule management is located in **`Administration`** > **`Rules`** > **`WhatsApp - Ticket Rules`**

![Example of rules](https://content.gitbook.com/content/uUCcURk2xlvtpVGbiRZf/blobs/FL587ubvvJWdhlFWC0k0/attachments/bb5c9024-1d9f-43a0-9a57-14e41ac471d3.png)

The criteria relate to either anonymous users or WhatsApp numbers and will trigger actions such as sending a message upon receipt of a ticket, updating the entity, category, urgency, etc.

***

## Current Limitations

* Only ticket status updates and solutions are sent to the user. Tasks and satisfaction surveys are not supported.
