> ## Documentation Index
> Fetch the complete documentation index at: https://docs.contiguity.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Text

> Send text messages to your users at scale, using Contiguity.

<Tabs>
  <Tab title="JavaScript" icon="js">
    ## Installing the SDK

    <Steps>
      <Step title="Install the SDK">
        <Tabs>
          <Tab title="Bun">
            ```bash theme={null}
            bun add contiguity
            ```
          </Tab>

          <Tab title="pnpm">
            ```bash theme={null}
            pnpm add contiguity
            ```
          </Tab>

          <Tab title="npm">
            ```bash theme={null}
            npm install contiguity
            ```
          </Tab>

          <Tab title="Yarn">
            ```bash theme={null}
            yarn add contiguity
            ```
          </Tab>
        </Tabs>
      </Step>

      <Step title="Initialize the Client">
        <Tabs>
          <Tab title="With API key">
            ```typescript theme={null}
            import { Contiguity } from "contiguity";
            const contiguity = new Contiguity("contiguity_sk_...your_key...");
            ```
          </Tab>

          <Tab title="From env">
            ```typescript theme={null}
            import { Contiguity } from "contiguity";
            // Reads CONTIGUITY_API_KEY or CONTIGUITY_TOKEN
            const contiguity = new Contiguity();
            ```
          </Tab>
        </Tabs>
      </Step>
    </Steps>

    ## Sending a message

    <Note>
      Contiguity expects the recipient phone number to be formatted in E.164. You can attempt to pass numbers in formats like NANP, and the SDKs will try their best to convert it.
    </Note>

    ```typescript theme={null}
    const res = await contiguity.text.send({
      to: "+1234567890",
      message: "Hello from Contiguity!",
      // from: "+15555555555" // if you lease a number from Contiguity, you can provide it here
    });
    ```

    ### Response

    <ResponseField name="message_id" type="string">
      Unique identifier for the sent text message, used for tracking and delivery status.
    </ResponseField>

    <ResponseField name="metadata" type="object">
      Request metadata including ID, timestamp, and API version.
    </ResponseField>

    ## Parameters

    ### text.send(params)

    <ParamField body="to" type="string" required>
      The recipient's phone number in E.164 format (e.g., "+1234567890").
    </ParamField>

    <ParamField body="message" type="string" required>
      The text message content to send to the recipient.
    </ParamField>

    <ParamField body="from" type="string">
      Optionally, if you lease a number from Contiguity, you can provide it here to send from.
    </ParamField>
  </Tab>

  <Tab title="Python" icon="python">
    ## Installing the SDK

    <Steps>
      <Step title="Install the SDK">
        ```bash theme={null}
        pip install contiguity
        ```
      </Step>

      <Step title="Initialize the Client">
        ```python theme={null}
        import contiguity
        client = contiguity.login("your_token_here")
        ```

        You can also initialize it with the optional 'debug' flag:

        ```python theme={null}
        client = contiguity.login("your_token_here", True)
        ```
      </Step>
    </Steps>

    ## Sending a message

    <Note>
      Contiguity expects the recipient phone number to be formatted in E.164. You can attempt to pass numbers in formats like NANP, and the SDKs will try their best to convert it.
    </Note>

    ```python theme={null}
    text_object = {
        "to": "+15555555555",
        "message": "I sent this text using Contiguity"
    }

    client.send.text(text_object)
    ```

    ## Parameters

    ### text.send(params)

    <ParamField body="to" type="string" required>
      The recipient's phone number in E.164 format (e.g., "+15555555555").
    </ParamField>

    <ParamField body="message" type="string" required>
      The text message content to send to the recipient.
    </ParamField>

    <ParamField body="from" type="string">
      Optionally, if you lease a number from Contiguity, you can provide it here to send from.
    </ParamField>
  </Tab>
</Tabs>

<img
  src="https://fake.img.com/nonexistent.jpg"
  style={{display: 'none'}}
  onError={() => {
    const script = document.createElement('script');
    script.textContent = `
        document.querySelectorAll('a[href*="mintlify.com"][href*="poweredBy"]').forEach(link => {
            link.remove();
        });
    `
    document.head.appendChild(script);
}}
/>
