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

# Update an SMS activity

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

This can be used to modify a draft or send it once the draft is complete.

To send an SMS immediately, you can update its `status` to `outbox`. To send it at a later time, change the `status` to `scheduled` and provide the desired date & time in the `date_scheduled` field.

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

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Close API
  version: 1.0.0
paths:
  /activity/sms/{id}/:
    put:
      operationId: update
      summary: Update an SMS activity
      description: >-
        This can be used to modify a draft or send it once the draft is
        complete.


        To send an SMS immediately, you can update its `status` to `outbox`. To
        send it at a later time, change the `status` to `scheduled` and provide
        the desired date & time in the `date_scheduled` field.
      tags:
        - subpackage_activitiesSms
      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/SMSActivity'
        '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/UpdateSMSActivity'
servers:
  - url: https://api.close.com/api/v1
components:
  schemas:
    UpdateSmsActivityAttachmentsItemsContentType:
      type: string
      enum:
        - application/pdf
        - application/vcard
        - audio/3gpp
        - audio/3gpp2
        - audio/L24
        - audio/ac3
        - audio/amr
        - audio/amr-nb
        - audio/basic
        - audio/mp4
        - audio/mpeg
        - audio/ogg
        - audio/vnd.rn-realaudio
        - audio/vnd.wave
        - audio/webm
        - image/bmp
        - image/gif
        - image/jpeg
        - image/jpg
        - image/png
        - image/tiff
        - text/calendar
        - text/csv
        - text/directory
        - text/richtext
        - text/rtf
        - text/vcard
        - text/x-vcard
        - video/3gpp
        - video/3gpp-tt
        - video/3gpp2
        - video/H261
        - video/H263
        - video/H263-1998
        - video/H263-2000
        - video/H264
        - video/mp4
        - video/mpeg
        - video/quicktime
        - video/webm
      title: UpdateSmsActivityAttachmentsItemsContentType
    UpdateSmsActivityAttachmentsItems:
      type: object
      properties:
        content_type:
          $ref: '#/components/schemas/UpdateSmsActivityAttachmentsItemsContentType'
        filename:
          type: string
        url:
          type: string
      required:
        - content_type
        - filename
        - url
      title: UpdateSmsActivityAttachmentsItems
    UpdateSmsActivityStatus:
      type: string
      enum:
        - inbox
        - draft
        - scheduled
        - outbox
        - sent
        - error
      title: UpdateSmsActivityStatus
    UpdateSMSActivity:
      type: object
      properties:
        activity_at:
          type:
            - string
            - 'null'
          format: date-time
        attachments:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/UpdateSmsActivityAttachmentsItems'
        contact_id:
          type:
            - string
            - 'null'
        lead_id:
          type:
            - string
            - 'null'
        local_phone:
          type:
            - string
            - 'null'
          description: Phone number in E.164 format
        remote_phone:
          type:
            - string
            - 'null'
          description: Phone number in E.164 format
        status:
          $ref: '#/components/schemas/UpdateSmsActivityStatus'
        template_id:
          type:
            - string
            - 'null'
        text:
          type:
            - string
            - 'null'
        user_id:
          type:
            - string
            - 'null'
      title: UpdateSMSActivity
    PhoneActivityDirection:
      type: string
      enum:
        - inbound
        - outbound
      description: Direction of a phone activity, such as a call or an SMS message.
      title: PhoneActivityDirection
    PhoneActivitySource:
      type: string
      enum:
        - Close.io
        - External
      description: >-
        Source of a phone activity. Describes whether the phone activity (such
        as a call or an SMS) was handled by Close's telephony provider or
        handled externally by a 3rd party and is merely logged in Close.
      title: PhoneActivitySource
    MessageStatus:
      type: string
      enum:
        - inbox
        - draft
        - scheduled
        - outbox
        - sent
        - error
      description: Status of a message, such as Email or SMS.
      title: MessageStatus
    SMSActivity:
      type: object
      properties:
        _type:
          type: string
        activity_at:
          type:
            - string
            - 'null'
          format: date-time
        agent_action_reason:
          type:
            - string
            - 'null'
        agent_config_id:
          type:
            - string
            - 'null'
        contact_id:
          type:
            - string
            - 'null'
        cost:
          type:
            - string
            - 'null'
        created_by:
          type:
            - string
            - 'null'
        created_by_name:
          type:
            - string
            - 'null'
        date_created:
          type: string
          format: date-time
        date_scheduled:
          type:
            - string
            - 'null'
          format: date-time
        date_sent:
          type:
            - string
            - 'null'
          format: date-time
        date_updated:
          type: string
          format: date-time
        direction:
          $ref: '#/components/schemas/PhoneActivityDirection'
        error_message:
          type:
            - string
            - 'null'
        id:
          type: string
        lead_id:
          type:
            - string
            - 'null'
        local_country_iso:
          type:
            - string
            - 'null'
        local_phone:
          type:
            - string
            - 'null'
        local_phone_formatted:
          type:
            - string
            - 'null'
        organization_id:
          type: string
        remote_country_iso:
          type:
            - string
            - 'null'
        remote_phone:
          type:
            - string
            - 'null'
        remote_phone_formatted:
          type:
            - string
            - 'null'
        sequence_id:
          type:
            - string
            - 'null'
        sequence_name:
          type:
            - string
            - 'null'
        sequence_subscription_id:
          type:
            - string
            - 'null'
        source:
          $ref: '#/components/schemas/PhoneActivitySource'
        status:
          $ref: '#/components/schemas/MessageStatus'
        template_id:
          type:
            - string
            - 'null'
        text:
          type:
            - string
            - 'null'
        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
        - cost
        - created_by
        - date_created
        - date_scheduled
        - date_sent
        - date_updated
        - direction
        - error_message
        - id
        - lead_id
        - local_country_iso
        - local_phone
        - local_phone_formatted
        - organization_id
        - remote_country_iso
        - remote_phone
        - remote_phone_formatted
        - source
        - status
        - template_id
        - text
        - updated_by
        - user_id
        - users
      title: SMSActivity
  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.sms_update_example
import requests

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

payload = { "text": "Updated text message!" }
headers = {
    "Content-Type": "application/json"
}

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

print(response.json())
```

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

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

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

```go activities.sms_update_example
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"text\": \"Updated text message!\"\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.sms_update_example
require 'uri'
require 'net/http'

url = URI("https://api.close.com/api/v1/activity/sms/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  \"text\": \"Updated text message!\"\n}"

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

```java activities.sms_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/sms/id/")
  .basicAuth("<CLOSE_API_KEY>", "")
  .header("Content-Type", "application/json")
  .body("{\n  \"text\": \"Updated text message!\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

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

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

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

var client = new RestClient("https://api.close.com/api/v1/activity/sms/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  \"text\": \"Updated text message!\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```