> For a complete page index, fetch https://developer.close.com/llms.txt

# Update a WhatsAppMessage activity

PUT https://api.close.com/api/v1/activity/whatsapp_message/{id}/
Content-Type: application/json

Reference: https://developer.close.com/api/resources/activities/whatsapp/update

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Close API
  version: 1.0.0
paths:
  /activity/whatsapp_message/{id}/:
    put:
      operationId: update
      summary: Update a WhatsAppMessage activity
      tags:
        - subpackage_activitiesWhatsappMessages
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: Use your API key as the username and leave the password empty.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WhatsAppMessageActivity'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                description: Any type
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                description: Any type
        '404':
          description: Not found
          content:
            application/json:
              schema:
                description: Any type
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateWhatsAppMessage'
servers:
  - url: https://api.close.com/api/v1
components:
  schemas:
    WhatsAppAttachmentData:
      type: object
      properties:
        content_type:
          type: string
        filename:
          type: string
        url:
          type: string
      required:
        - content_type
        - filename
        - url
      title: WhatsAppAttachmentData
    CommunicationDirection:
      type: string
      enum:
        - incoming
        - outgoing
      description: >-
        Direction of communication. Outgoing means the communication flowing
        from the user to the lead/contact. Inbound means the opposite.
      title: CommunicationDirection
    UpdateWhatsAppMessage:
      type: object
      properties:
        activity_at:
          type: string
          format: date-time
        attachments:
          type: array
          items:
            $ref: '#/components/schemas/WhatsAppAttachmentData'
        contact_id:
          type: string
        direction:
          $ref: '#/components/schemas/CommunicationDirection'
        integration_link:
          type:
            - string
            - 'null'
          format: uri
        local_phone:
          type: string
        message_markdown:
          type: string
        remote_phone:
          type: string
        response_to_id:
          type:
            - string
            - 'null'
        user_id:
          type: string
      title: UpdateWhatsAppMessage
    Attachment:
      type: object
      properties:
        content_type:
          type:
            - string
            - 'null'
        filename:
          type:
            - string
            - 'null'
        size:
          type:
            - integer
            - 'null'
        thumbnail_url:
          type:
            - string
            - 'null'
        url:
          type: string
      required:
        - content_type
        - filename
        - size
        - url
      title: Attachment
    CreationSource:
      type: string
      enum:
        - ui
        - api
        - import
        - clipper
        - email
        - suggestion
        - segment-integration
        - customerio-integration
        - calendly-integration
        - ai
        - whatsapp
        - webform
      title: CreationSource
    WhatsAppMessageActivity:
      type: object
      properties:
        _type:
          type: string
        activity_at:
          type:
            - string
            - 'null'
          format: date-time
        attachments:
          type: array
          items:
            $ref: '#/components/schemas/Attachment'
        contact_id:
          type:
            - string
            - 'null'
        created_by:
          type:
            - string
            - 'null'
        created_by_name:
          type:
            - string
            - 'null'
        date_created:
          type: string
          format: date-time
        date_updated:
          type: string
          format: date-time
        direction:
          $ref: '#/components/schemas/CommunicationDirection'
        external_whatsapp_message_id:
          type: string
        id:
          type: string
        integration_link:
          type:
            - string
            - 'null'
        integration_name:
          type:
            - string
            - 'null'
        lead_id:
          type:
            - string
            - 'null'
        local_phone:
          type: string
        local_phone_formatted:
          type: string
        message_html:
          type: string
        message_markdown:
          type: string
        organization_id:
          type: string
        remote_phone:
          type: string
        remote_phone_formatted:
          type: string
        response_to_id:
          type:
            - string
            - 'null'
        sequence_id:
          type:
            - string
            - 'null'
        sequence_name:
          type:
            - string
            - 'null'
        sequence_subscription_id:
          type:
            - string
            - 'null'
        source:
          $ref: '#/components/schemas/CreationSource'
        text:
          type: string
        updated_by:
          type:
            - string
            - 'null'
        updated_by_name:
          type:
            - string
            - 'null'
        user_id:
          type:
            - string
            - 'null'
        user_name:
          type:
            - string
            - 'null'
        users:
          type: array
          items:
            type: string
      required:
        - _type
        - activity_at
        - contact_id
        - created_by
        - date_created
        - date_updated
        - direction
        - external_whatsapp_message_id
        - id
        - integration_link
        - integration_name
        - lead_id
        - local_phone
        - local_phone_formatted
        - message_html
        - message_markdown
        - organization_id
        - remote_phone
        - remote_phone_formatted
        - response_to_id
        - source
        - text
        - updated_by
        - user_id
        - users
      title: WhatsAppMessageActivity
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: basic
      description: Use your API key as the username and leave the password empty.
    OAuth2:
      type: http
      scheme: bearer

```

## SDK Code Examples

```python activities.whatsapp_messages_update_example
import requests

url = "https://api.close.com/api/v1/activity/whatsapp_message/id/"

payload = { "message_markdown": "Updated content." }
headers = {
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers, auth=("<CLOSE_API_KEY>", ""))

print(response.json())
```

```javascript activities.whatsapp_messages_update_example
const url = 'https://api.close.com/api/v1/activity/whatsapp_message/id/';
const credentials = btoa("<CLOSE_API_KEY>:");

const options = {
  method: 'PUT',
  headers: {Authorization: `Basic ${credentials}`, 'Content-Type': 'application/json'},
  body: '{"message_markdown":"Updated content."}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go activities.whatsapp_messages_update_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.close.com/api/v1/activity/whatsapp_message/id/"

	payload := strings.NewReader("{\n  \"message_markdown\": \"Updated content.\"\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.SetBasicAuth("<CLOSE_API_KEY>", "")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby activities.whatsapp_messages_update_example
require 'uri'
require 'net/http'

url = URI("https://api.close.com/api/v1/activity/whatsapp_message/id/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request.basic_auth("<CLOSE_API_KEY>", "")
request["Content-Type"] = 'application/json'
request.body = "{\n  \"message_markdown\": \"Updated content.\"\n}"

response = http.request(request)
puts response.read_body
```

```java activities.whatsapp_messages_update_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.close.com/api/v1/activity/whatsapp_message/id/")
  .basicAuth("<CLOSE_API_KEY>", "")
  .header("Content-Type", "application/json")
  .body("{\n  \"message_markdown\": \"Updated content.\"\n}")
  .asString();
```

```php activities.whatsapp_messages_update_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.close.com/api/v1/activity/whatsapp_message/id/', [
  'body' => '{
  "message_markdown": "Updated content."
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
    'auth' => ['<CLOSE_API_KEY>', ''],
]);

echo $response->getBody();
```

```csharp activities.whatsapp_messages_update_example
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://api.close.com/api/v1/activity/whatsapp_message/id/");
client.Authenticator = new HttpBasicAuthenticator("<CLOSE_API_KEY>", "");
var request = new RestRequest(Method.PUT);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"message_markdown\": \"Updated content.\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```