{"id":33760387,"url":"https://github.com/watadarkstar/react-native-parlant","last_synced_at":"2025-12-05T10:02:36.978Z","repository":{"id":310907685,"uuid":"1041727062","full_name":"watadarkstar/react-native-parlant","owner":"watadarkstar","description":"A React Native library for integrating Parlant AI agents into your React Native, Expo and React applications.","archived":false,"fork":false,"pushed_at":"2025-09-06T01:33:18.000Z","size":1157,"stargazers_count":43,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-11T14:56:42.559Z","etag":null,"topics":["agent","ai-agents","llm","openai","parlant","react-native","react-native-parlant","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/react-native-parlant","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/watadarkstar.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-20T23:36:04.000Z","updated_at":"2025-10-11T12:50:32.000Z","dependencies_parsed_at":"2025-08-21T00:33:46.073Z","dependency_job_id":"ce63d986-e124-4c49-85b9-30deffac1584","html_url":"https://github.com/watadarkstar/react-native-parlant","commit_stats":null,"previous_names":["watadarkstar/react-native-parlant"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/watadarkstar/react-native-parlant","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watadarkstar%2Freact-native-parlant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watadarkstar%2Freact-native-parlant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watadarkstar%2Freact-native-parlant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watadarkstar%2Freact-native-parlant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/watadarkstar","download_url":"https://codeload.github.com/watadarkstar/react-native-parlant/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watadarkstar%2Freact-native-parlant/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27517116,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-05T02:00:07.920Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","ai-agents","llm","openai","parlant","react-native","react-native-parlant","typescript"],"created_at":"2025-12-05T10:01:59.076Z","updated_at":"2025-12-05T10:02:36.966Z","avatar_url":"https://github.com/watadarkstar.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch3 align=\"center\"\u003e\n  💬 React Native Parlant\n\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\nA React Native library for integrating \u003ca href=\"https://www.parlant.io\"\ntarget=\"_blank\"\u003eParlant AI\u003c/a\u003e agents\u003cbr /\u003einto your React Native, Expo, and React\napplications.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://snack.expo.dev/@flyreel/react-native-parlant-example\" target=\"_blank\"\u003e🕹️ Snack playground\u003c/a\u003e\n   • \n  \u003ca href=\"https://www.linkedin.com/feed/update/urn:li:activity:7369036507208183808/\" target=\"_blank\"\u003e👀 Watch a demo\u003c/a\u003e \n  \u003cbr /\u003e\n  \u003ca href=\"https://x.com/icookandcode\" target=\"_blank\"\u003e🚀 Need help building your agent? Connect with Adrian on X \n\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/react-native-parlant\"\u003e\n    \u003cimg alt=\"npm version\" src=\"https://badge.fury.io/js/react-native-parlant.svg?icon=si%3Anpm\"/\u003e\n  \u003c/a\u003e\n  \u003ca title='License' href=\"https://github.com/watadarkstar/react-native-parlant/blob/master/LICENSE\" height=\"18\"\u003e\n    \u003cimg src='https://img.shields.io/badge/license-MIT-blue.svg' /\u003e\n  \u003c/a\u003e\n  \u003ca title='Tweet' href=\"https://twitter.com/intent/tweet?text=Check%20out%20this%20awesome%20React%20Native%20Parlant%20repository\u0026url=https://github.com/watadarkstar/react-native-parlant\u0026via=icookandcode\u0026hashtags=react,reactnative,opensource,github,ai,parlant\" height=\"18\"\u003e\n    \u003cimg src='https://img.shields.io/twitter/url/http/shields.io.svg?style=social' /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## Installation\n\nYarn:\n\n```bash\nyarn add react-native-parlant\n```\n\nNpm:\n\n```bash\nnpm install --save react-native-parlant\n```\n\nExpo\n\n```bash\nnpx expo install react-native-parlant\n```\n\n## Quick Start\n\n```tsx\nimport { SafeAreaView, StyleSheet } from \"react-native\";\nimport { useChat } from \"react-native-parlant\";\nimport { GiftedChat, IMessage } from \"react-native-gifted-chat\";\n\nexport default function Example() {\n  const { messages, sendMessage, isTyping, isLoading } = useChat({\n    agentId: \"agent-id\",\n    api: \"http://localhost:8800\",\n  });\n  const onSend = (messages: IMessage[]) =\u003e {\n    const userMessage = messages[0]?.text || \"\";\n    sendMessage(userMessage);\n  };\n\n  return (\n    \u003cSafeAreaView style={styles.container}\u003e\n      \u003cGiftedChat\n        messages={messages}\n        placeholder=\"Start typing...\"\n        onSend={onSend}\n        isTyping={isTyping || isLoading}\n        user={{\n          _id: 1,\n          name: \"You\",\n        }}\n        alwaysShowSend\n        textInputProps={{\n          style: styles.textInput,\n        }}\n      /\u003e\n    \u003c/SafeAreaView\u003e\n  );\n}\n\nconst styles = StyleSheet.create({\n  container: {\n    flex: 1,\n    backgroundColor: \"white\",\n  },\n  textInput: {\n    flex: 1,\n    marginHorizontal: 10,\n    paddingVertical: 12,\n    paddingHorizontal: 16,\n  },\n});\n```\n\n## API Reference\n\n### `useChat(props: Props)`\n\nThe main hook for managing chat sessions with Parlant AI agents.\n\n#### Props\n\n| Prop              | Type                     | Required | Default                 | Description                           |\n| ----------------- | ------------------------ | -------- | ----------------------- | ------------------------------------- |\n| `agentId`         | `string`                 | ✅       | -                       | The ID of the Parlant AI agent        |\n| `api`             | `string`                 | ✅       | `http://localhost:8800` | The Parlant API endpoint              |\n| `initialMessages` | `IMessage[]`             | ❌       | `[]`                    | Initial messages to populate the chat |\n| `moderation`      | `string`                 | ❌       | `\"auto\"`                | Moderation setting for messages       |\n| `customerId`      | `string`                 | ❌       | `\"guest\"`               | Unique identifier for the customer    |\n| `title`           | `string`                 | ❌       | `\"New Conversation\"`    | Title for the chat session            |\n| `maxRetries`      | `number`                 | ❌       | `3`                     | Maximum retries for message fetching  |\n| `headers`         | `Record\u003cstring, string\u003e` | ❌       | `{}`                    | Custom headers for API requests       |\n| `aiAvatar`        | `string`                 | ❌       | `\"\"`                    | Avatar URL for AI agent messages      |\n\n#### Returns\n\n| Property      | Type                                         | Description                           |\n| ------------- | -------------------------------------------- | ------------------------------------- |\n| `messages`    | `IMessage[]`                                 | Array of chat messages                |\n| `sendMessage` | `(message: string) =\u003e Promise\u003cMessageEvent\u003e` | Function to send a message            |\n| `isLoading`   | `boolean`                                    | Whether a message is being sent       |\n| `isTyping`    | `boolean`                                    | Whether the agent is currently typing |\n\n### `append(currentMessages, newMessages, inverted?)`\n\nUtility function for appending messages to the chat.\n\n#### Parameters\n\n- `currentMessages` (`TMessage[]`) - Existing messages array\n- `newMessages` (`TMessage[]`) - New messages to append\n- `inverted` (`boolean`, default: `true`) - Whether to prepend (true) or append (false) messages\n\n## Types\n\n### `IMessage`\n\n```typescript\ninterface IMessage {\n  _id: string | number;\n  text: string;\n  createdAt: Date | number;\n  user: {\n    _id: string | number;\n    name?: string;\n    avatar?: string | number | renderFunction;\n  };\n  image?: string;\n  video?: string;\n  audio?: string;\n  system?: boolean;\n  sent?: boolean;\n  received?: boolean;\n  pending?: boolean;\n  quickReplies?: QuickReplies;\n}\n```\n\n### `MessageEvent`\n\n```typescript\ninterface MessageEvent {\n  id: string;\n  source: string;\n  kind: \"message\" | \"status\";\n  offset: number;\n  creation_utc: string;\n  correlation_id: string;\n  data: {\n    message: string;\n    participant: {\n      id: string;\n      display_name: string;\n    };\n    flagged: boolean;\n    tags: string[];\n    status?: \"typing\" | \"ready\";\n  };\n  deleted: boolean;\n}\n```\n\n### `Session`\n\n```typescript\ninterface Session {\n  id: string;\n  agent_id: string;\n  customer_id: string;\n  creation_utc: string;\n  title: string;\n  mode: string;\n  consumption_offsets: {\n    client: number;\n  };\n}\n```\n\n## Features\n\n- 🤖 **Real-time AI Chat** - Connect to Parlant AI agents with real-time messaging\n- 📱 **Cross-Platform** - Works with React Native, Expo, and React applications\n- 🔄 **Auto-Reconnection** - Automatic retry logic for robust connections\n- 🎯 **TypeScript Support** - Full TypeScript definitions included\n- 💾 **Session Management** - Automatic session creation and management\n- 🔒 **Content Moderation** - Built-in support for message moderation\n- ⚡ **Long Polling** - Efficient real-time message fetching\n- 🎨 **Customizable** - Flexible message and user interface customization\n\n## Advanced Usage\n\n### Custom Headers\n\n```tsx\nconst { messages, sendMessage } = useChat({\n  agentId: \"your-agent-id\",\n  api: \"https://your-api.com\",\n  headers: {\n    Authorization: \"Bearer your-token\",\n    \"X-Custom-Header\": \"custom-value\",\n  },\n});\n```\n\n### Initial Messages\n\n```tsx\nconst initialMessages: IMessage[] = [\n  {\n    _id: 1,\n    text: \"Hello! How can I help you today?\",\n    createdAt: new Date(),\n    user: {\n      _id: 2,\n      name: \"AI Assistant\",\n      avatar: \"https://example.com/avatar.png\",\n    },\n  },\n];\n\nconst { messages, sendMessage } = useChat({\n  agentId: \"your-agent-id\",\n  api: \"https://your-api.com\",\n  initialMessages,\n});\n```\n\n### Error Handling\n\n```tsx\nconst handleSendMessage = async (text: string) =\u003e {\n  try {\n    await sendMessage(text);\n  } catch (error) {\n    if (error.message === \"Failed to send message\") {\n      // Handle send failure\n      console.error(\"Message failed to send\");\n    } else if (error.message === \"Failed to create session\") {\n      // Handle session creation failure\n      console.error(\"Could not establish chat session\");\n    }\n  }\n};\n```\n\n## Requirements\n\n- React 16.8+ (for hooks support)\n- TypeScript 4.0+ (optional but recommended)\n\n## License\n\nMIT\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## Support\n\nFor questions and support, please contact [Adrian](https://x.com/icookandcode) on X or open an issue on GitHub.\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n**Ready to build AI agents that actually work?**\n\n⭐ **Star this repo** • 💬 **[Contact Adrian to Build It](https://x.com/icookandcode)**\n\n_Built with ❤️ by [Adrian](https://x.com/icookandcode)_\n\n\u003c/div\u003e\n\n---\n\n**Keywords:** react-native, react, parlant, ai, agent, chat, conversation, typescript, react-native-parlant\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwatadarkstar%2Freact-native-parlant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwatadarkstar%2Freact-native-parlant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwatadarkstar%2Freact-native-parlant/lists"}