> For the complete documentation index, see [llms.txt](https://help.clickatell.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.clickatell.com/developers-api-reference/developers-archive/sdks/python.md).

# Python

ARCHIVED

You can use this Python library with our HTTP or REST messaging APIs to interact with the Clickatell SMS Gateway. The Python library below allows you to send one- or two-way SMS messages using Clickatell’s SMS Platform.

[View on Github](https://github.com/clickatell/clickatell-python)

This library supports version **2** of Python. It allows easy access to connecting Clickatell’s different messaging APIs.

\
**Installation**&#x20;

You can install this library via PIP as part of your requirements file.

| `pip install clickatell-platform` |
| --------------------------------- |

&#x20;

[Clickatell Python PyPI](https://pypi.python.org/pypi?name=clickatell\&version=0.0.1&:action=display)

&#x20;

**Usage**

The library currently supports the `Http` and `Rest` protocols.

\
**HTTP API**

| `from` `clickatell.http import` `Http` `clickatell =` `Http(apiKey)response =` `clickatell.sendMessage(['1111111111'], "My Message rest")` `print(response) #Returns the headers with all the messages` `for` `entry in` `response['messages']:print(entry) #Returns all the message details per message#print(entry['apiMessageId'])#print(entry['to'])#print(entry['accepted'])#print(entry['error'])` |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

&#x20;

**REST API**

| `from` `clickatell.rest import` `Rest` `clickatell =` `Rest(apiKey)response =` `clickatell.sendMessage(['1111111111'], "My Message rest")` `print` `response #Returns the headers with all the messages` `for` `entry in` `response['messages']:    print(entry) #Returns all the message details per message    #print(entry['apiMessageId'])    #print(entry['to'])    #print(entry['accepted'])    #print(entry['error'])` |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

```
 
```

**Sending to multiple numbers**

The `sendMessage` call `to` parameter can take an array of numbers. If you specify only a single number e.g. *`clickatell.sendMessage(1111111111, "Message"),`* the library will automatically convert it to an array for your convenience.

To send to multiple numbers, just pass a list of numbers e.g. *clickatell.sendMessage(\[1111111111,2222222222], “Message”)*&#x20;

\
**Supported API calls**

The available calls are defined in the `clickatell.Transport` interface.

| `def sendMessage(self, to, message, extra={})` |
| ---------------------------------------------- |

\
**Dealing with extra parameters in sendMessage**

For usability purposes the `sendMessage` call focuses on the recipients and the content. In order to specify any of the additional parameters defined in the Clickatell document, you can use the `extra` parameter and pass them as a dictionary.

\
**Receiving and consuming the status callback**

The following will be returned from the callback in two different sets:

DELIVERED\_TO\_GATEWAY :

* *integrationName*
* *messageId*
* *requestId*
* *clientMessageId*
* *to*
* *from*
* *statusCode*
* *status*
* *statusDescription*
* *timestamp*

RECEIVED\_BY\_RECIPIENT :

* *integrationName*
* *messageId*
* *requestId*
* *clientMessageId*
* *to*
* *from*
* *statusCode*
* *status*
* *statusDescription*
* *timestamp*

There is a python test server included in the Clickatell folder. To run this server, you require the endpoints pip package:

| `pip install endpoints` |
| ----------------------- |

&#x20;

You can run the server using the following command:

| `endpoints --dir=clickatell/ --prefix=controller --host=<hostname>:<port>` |
| -------------------------------------------------------------------------- |

&#x20;

This server currently prints out to the server console. Replace the print function with your function name to consume the data. All data is returned in JSON.

#### &#x20;

**Read more:**

* Found a bug or missing a feature? Log it [here ](https://github.com/ninjakitteh69/Clickatell-Csharp/issues)and we will take a look.
* Register a new account to send SMSs
* Log in to the platform for API Id, etc.
* [Request parameters](https://docs.clickatell.com/channels/sms-rest-api-platform-archived/sms-rest-api-request-parameters/)&#x20;
* [Send message ](https://docs.clickatell.com/channels/sms-rest-api-platform-archived/sms-rest-api-send-message-2/)info&#x20;
* [Error messages](https://docs.clickatell.com/channels/sms-rest-api-platform-archived/rest-api-error-message-descriptions/)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.clickatell.com/developers-api-reference/developers-archive/sdks/python.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
