<br />

You can use the Google Business Profile (GBP) API to add or update the WhatsApp
and text messaging URL attributes for a specific location.

By implementing these attributes, businesses enable customers to contact them
using WhatsApp or SMS. This allows merchants to open direct communication
channels with users on GBP, with the goal of improving customer engagement and
support.

Here we show you how to [add, update](https://developers.google.com/my-business/content/whatsapp-text#request-add-update-attribute) or
[delete](https://developers.google.com/my-business/content/whatsapp-text#delete-attributes) URL attributes.

## Prerequisites

Before proceeding, ensure you have

- A Google Business Profile account and location
- The necessary authorization credentials to make changes to the Google Business Profile location

## Verify success

To add, update or delete attributes you will make PATCH requests. A successful
PATCH request returns a status code of `HTTP 200 OK`.

## Request to add or update an attribute

This approach applies to both WhatsApp and Text Messaging.

To add or update a single attribute, use an HTTP PATCH request sent to the
Google Business Profile API endpoint for
[`location.updateattributes`](https://developers.google.com/my-business/reference/businessinformation/rest/v1/locations/updateAttributes).

Specify the attribute you are targeting using the `attributeMask` query
parameter in the URL. The request body will contain the updated attribute data.

### For WhatsApp

The request looks like the following.

    PATCH
    https://mybusinessbusinessinformation.googleapis.com/v1/locations/{locationId}/attributes?attributeMask=attributes/url_whatsapp

In your implementation replace `{locationId}` with the actual ID of your Google
Business Profile location.

The request body (application/JSON) would look like the following.

    {
      "name": "locations/17826990302864573181/attributes",
      "attributes": [
      {
        "name":"attributes/url_whatsapp",

        "values":[],
        "uriValues": [
            {
              "uri": "https://wa.me/55555555"
            }
          ]
        }
      ]
    }

Replace the example `55555555` with the business WhatsApp phone number using
international format.

### For Text Messaging

The request would be as follows.

    PATCH
    https://mybusinessbusinessinformation.googleapis.com/v1/locations/{locationId}/attributes?attributeMask=attributes/url_text_messaging

In your implementation replace `{locationId}` with the actual ID of your Google
Business Profile location.

The request body (application/JSON) would look like the following.

    {
      "name": "locations/17826990302864573181/attributes",
      "attributes": [
        {
          "name":"attributes/url_text_messaging",

          "values":[],
          "uriValues": [
            {
            "uri": "sms:5555555555"
            }
          ]
        }
      ]
    }

Replace the example `sms:5555555555` with the business phone number for text
messaging.

## Delete attributes

You can delete both attributes in a DELETE request by including
`attributes/url_whatsapp` **or** `attributes/url_text_messaging` in the
`attributeMask` query parameter. The request body will contain an array of
attribute objects, one for each attribute you want to update or delete.

The request looks like the following.

    DELETE
    https://mybusinessbusinessinformation.googleapis.com/v1/locations/{locationId}/attributes?attributeMask=attributes/url_whatsapp,attributes/url_text_messaging

In your implementation replace `{locationId}` with the actual ID of your Google
Business Profile location.

The request body (application/JSON) would look like the following.

    {
      "name": "locations/17826990302864573181/attributes",
      "attributes": [
        {
        "name":"attributes/url_whatsapp",

        "values":[],
        "uriValues": []
        }
      ]
    }

Replace the example `uriValues` with empty brackets. This resets the value and
removes it from your GBP.