# SDKs

Texa's SDKs for Python, JavaScript and TypeScript, React Native, Go, Swift and PHP, and the widgets for websites and apps.


Every SDK is a thin client over the same [Texa API](/api-reference/texa-api): one method per route,
errors that carry the request's id, an **action handler** that runs Texa AI's action requests with
your functions, and a **webhook check**. None of them retries behind your back: to retry safely, send
the same `Idempotency-Key` or `message_id` again ([why](/api-basics/idempotency)). Each passes the
same contract tests against the Texa API.

| Language | Install | Runs on |
|---|---|---|
| [Python](/sdks/python) | `pip install texa` | your server; sync and async |
| [JavaScript and TypeScript](/sdks/typescript) | `npm install @texadesk/sdk` | Node 20+, Deno, Bun, edge runtimes |
| [React Native and Expo](/sdks/react-native) | `npm install @texadesk/react-native` | your customers' app: the chat component |
| [Go](/sdks/go) | `go get github.com/texadigital/texa-go` | your server; standard library only |
| [Swift](/sdks/swift) | Swift Package Manager: `https://github.com/texadigital/texa-swift` | server-side Swift; voice in iOS apps |
| [PHP](/sdks/php) | `composer require texa/texa-php` | PHP 8.1+: Laravel, Symfony, plain PHP |
| [Java and Kotlin](/sdks/java) | coming soon | Java 17+ |
| [Flutter](/sdks/flutter) | coming soon | your customers' app |

The source of every SDK is public at
[github.com/texadigital/texa-sdks](https://github.com/texadigital/texa-sdks), MIT licensed. Report a
problem there.

## Server SDKs and widgets

- **Server SDKs** hold your API key. They run on your server only.
- **Widgets** run in a web page or an app and never hold a key. Your server makes a
  [widget session](/guides/website-and-app#2-signed-in-customers-your-server-says-who-they-are) for
  the customer and gives the widget its token:
  - [`widget.js`](/sdks/widget) for websites, one script tag;
  - [`@texadesk/react-native`](/sdks/react-native) for React Native and Expo apps;
  - Flutter, coming soon.

## The same calls in every language

| Route | Python | JavaScript | Go | PHP |
|---|---|---|---|---|
| `POST /v1/conversations` | `open_conversation` | `openConversation` | `OpenConversation` | `openConversation` |
| `POST …/messages` | `send_message` | `sendMessage` | `SendMessage` | `sendMessage` |
| `POST …/action-results` | `action_result` | `actionResult` | `ActionResult` | `actionResult` |
| `POST …/handover`, `…/handback`, `…/close` | `handover`, `handback`, `close` | the same | `Handover`, `Handback`, `Close` | the same |
| `POST …/human-messages` | `human_message` | `humanMessage` | `HumanMessage` | `humanMessage` |
| `POST …/voice-sessions` | `voice_session` | `voiceSession` | `VoiceSession` | `voiceSession` |
| `GET …/transcript`, `…/export`, `…/quality` | `transcript`, `export`, `quality` | `transcript`, `exportConversation`, `quality` | `Transcript`, `Export`, `Quality` | `transcript`, `export`, `quality` |
| `POST /v1/widget-sessions` | `widget_session` | `widgetSession` | `WidgetSession` | `widgetSession` |
| `GET /v1/events` | `events` (all pages), `events_page` | `eventsPage` | `Events`, `EventsPage` | `events`, `eventsPage` |
| Customers | `get_customer`, `merge_customer`, `forget_customer` | `getCustomer`, `mergeCustomer`, `forgetCustomer` | `GetCustomer`, `MergeCustomer`, `ForgetCustomer` | the same as JavaScript |
| Sandbox fixtures | `put_fixture`, `list_fixtures`, `delete_fixture` | `putFixture`, `deleteFixture` | `PutFixture`, `DeleteFixture` | `putFixture`, `listFixtures`, `deleteFixture` |
| Run action requests | `run_actions` | `runActions` | `RunActions` | `runActions` |
| Check a webhook | `webhooks.parse` | `parseWebhook` | `ParseWebhook` | `Texa\Webhooks::parse` |

## The action handler

`run_actions` (`runActions`) takes the answer to a request and a function per action. For each action
request Texa didn't already run (`handled_by` is not set), it calls your function with the inputs,
gives Texa the result, and collects what Texa AI says next. Return the action's data, or
`{"status": "failed", "error": "..."}`. Throwing is a failure too, which Texa AI tells the customer
honestly. Actions with no function are left for you.
