> For the complete documentation index, see [llms.txt](https://docs.ushahidi.com/platform-user-manual/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ushahidi.com/platform-user-manual/3.-configuring-your-deployment/3.4-data-sources/3.4.2-gmail.md).

# 3.4.2 Gmail

{% hint style="info" %}
This data source is not available in your deployments. You will not find it in your settings, please reach out to <support@ushahidi.com> or our chat messenger to enable it in your deployment.
{% endhint %}

This section allows you to set up the platform to receive and send emails through a connected Gmail account via the API. Before getting started, make sure that you have an email account set up on Gmail.\
\&#xNAN;***Note: If you're self hosting the Ushahidi platform, the Gmail Provider makes use of the server-side flow when making a request to Gmail API, and must be authorized using OAuth 2.0 Credentials.***

Follow this guide to create the OAuth 2.0 Credentials (Client ID and Client Secret) with [Gmail](https://support.google.com/googleapi/answer/6158849?hl=en). Keep in mind:

* Select "*where you will be calling the API from*" as Other UI.
* Select User data as the data type to be accessed.
* Select your application type as TVs and Limited Input devices.
* There's a need to set up a consent screen.

***

To ***get started with Gmail set up*** on the Ushahidi platform, click on Gmail from the drop down as shown below.

<figure><img src="/files/4CEc5tU8lDy5IZ4zCiBb" alt="List of available data sources - red arrow pointing to Gmail Data Source"><figcaption><p>List of available data sources - red arrow pointing to Gmail Data Source</p></figcaption></figure>

***Input the following email account settings***

* ***Email Address***: Enter the Gmail address you will be receiving and sending emails with.
* ***Fetch Email From***: Pick the date you want to start fetching messages from.
* ***Client Id***: Enter the Gmail client id gotten from the OAuth credentials.
* ***Client Secret***: Enter the Gmail client secret gotten from the OAuth credentials.
* ***Redirect URL***: Enter the redirect URL from the OAuth credentials. The default value set here is `urn:ietf:wg:oauth:2.0:oob` and in most cases should be left this way.&#x20;
* Click on ***Save*** and this data source’s settings will be saved.

***The below setup will be available to both the hosted and self-hosted users.***

* Next, Scroll up and click on ***Connect your Gmail Account*** and this will show a google prompt to authenticate your Gmail account.

<figure><img src="/files/-MG4W4dh-R5F2QF5t6xA" alt="Connect Your Gmail Account button displayed to prompt for authentication to your Gmail Account"><figcaption><p>Connect Your Gmail Account button displayed to prompt for authentication</p></figcaption></figure>

* Follow the prompt through and click on ***Allow*** to be presented with the list of Gmail accounts that you have.

<figure><img src="/files/-Ml9aaqyNE7bmEu9ZLOY" alt="External Gmail Authentication Page - Red arrow pointing to allow for ushahidi to access google account"><figcaption><p>External Gmail Authentication Page - Red arrow pointing to allow for ushahidi to access google account</p></figcaption></figure>

* Grant permission by selecting the Gmail account that you would like the Ushahidi platform to access.

<figure><img src="/files/-Ml9cA6fgJuGWJ3GZfrT" alt="Choose An Account - Select an account from the list of Gmail accounts you have"><figcaption><p>Select an account from the list of Gmail accounts you have</p></figcaption></figure>

* This will display an auth code.
* Please copy the provided code, switch back to your Ushahidi application, and paste/enter it on the opened modal:
* Enter the point in time that you would like the Ushahidi platform to fetch messages from your inbox.

<figure><img src="/files/-Ml9eEGSp7HctUtcbilU" alt="Coonect Your Gmail Account Page - Enter Auth Code, Sync Date and then authorize or cancel"><figcaption><p>Coonect Your Gmail Account Page - Enter Auth Code, Sync Date and then authorize or cancel</p></figcaption></figure>

* Click on ***Authorize*** to save the auth code and date entered.
* A message will be displayed in your deployment to indicate that your ***account is connected,*** messages from Gmail will now be pulled into the platform via the API.
* To disconnect your account, simply click on ***Disconnect your Gmail account*** to stop all messages from being fetched from your inbox.

***NB: All messages that were previously fetched will not be deleted from your deployment.***

<figure><img src="/files/-Ml9fHXikHrMifP6i2Vr" alt="Disconnect Your Gmail Account to stop all message from being fetched"><figcaption><p>Disconnect Your Gmail Account to stop all message from being fetched</p></figcaption></figure>

* To enable/disable the email data source, simply click on the green toggle and click on save.

<figure><img src="/files/24JuhSl5FuBLMk0wt7Ts" alt="Edit Gmail Data Source Page - Import to Basic Post highlighed."><figcaption><p>Edit Gmail Data Source Page - Import to Basic Post highlighted</p></figcaption></figure>
