-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathllms-full.txt
More file actions
13029 lines (9538 loc) · 459 KB
/
llms-full.txt
File metadata and controls
13029 lines (9538 loc) · 459 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!-- Source: https://docs.yourgpt.ai/chatbot/developer-guide/api-reference/chatbot/createSession -->
# Create Session
> >-
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
Create a new chatbot session. You must create a session before sending messages. The session_uid returned from this endpoint is required for the Send Message API.
<APIPage document={"./openapi.json"} operations={[{"path":"/createSession","method":"post"}]} />
---
<!-- Source: https://docs.yourgpt.ai/chatbot/developer-guide/api-reference/chatbot/sendMessage -->
# Send Message
> >-
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
Send a message to your chatbot and receive an AI response. You must first create a session using the Create Session API to obtain a session_uid.
<APIPage document={"./openapi.json"} operations={[{"path":"/sendMessage","method":"post"}]} />
---
<!-- Source: https://docs.yourgpt.ai/chatbot/developer-guide/api-reference -->
# API Reference
> API Reference for YourGPT chatbot integration.
# API Reference
YourGPT provides a REST API for you to integrate our chatbot into your applications.
<Cards>
<Card
title="Create Session"
href="/chatbot/developer-guide/api-reference/chatbot/createSession"
/>
<Card
title="Send Message"
href="/chatbot/developer-guide/api-reference/chatbot/sendMessage"
/>
</Cards>
---
<!-- Source: https://docs.yourgpt.ai/chatbot/developer-guide/getting-started/api-integration -->
# API Integration
> Learn how to integrate your chatbot using the YourGPT Chatbot API
<Callout title="Connect Your Chatbot Anywhere with Chatbot API" type="tip" />
Welcome to the Documentation page for **YourGPT Chatbot APIs**
## Generating Keys
- Go to your **Integration** and click on **manage API integration**
<div className="flex justify-center items-center rounded-md p-4">
<img
src="../../../assets/chatbot/API/Integration-API.png"
alt="API Integration"
style={{ width: "100%" }}
className="rounded-md object-contain"
/>
</div>
- Now create one key.
- Copy your **Generated API key**
<div className="flex justify-center items-center rounded-md p-4 md:pl-20">
<img
src="../../../assets/chatbot/API/API-key.png"
alt="Copy API Key"
style={{ width: "88%" }}
className="rounded-md object-contain"
/>
</div>
<Callout title="Note" type="note">
The widget_uid is your chatbot's Widget ID.
**For Example**: `84292q0qw1eqw124-4173-af6e-569477ac9013`
</Callout>
<div className="mt-12">
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<a href="/chatbot/api-reference/chatbot/createSession" className="block p-6 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 hover:shadow-lg transition-shadow no-underline">
<div className="text-xl font-semibold mb-2 text-gray-900 dark:text-white">How to Create Session</div>
<p className="text-gray-600 dark:text-gray-400 m-0">Guide to Creating Sessions</p>
</a>
<a href="/chatbot/api-reference/chatbot/sendMessage" className="block p-6 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 hover:shadow-lg transition-shadow no-underline">
<div className="text-xl font-semibold mb-2 text-gray-900 dark:text-white">Send a Message via API</div>
<p className="text-gray-600 dark:text-gray-400 m-0">API to send messages seamlessly</p>
</a>
</div>
</div>
The Integration ID for the API is **17**.
## API Usage
- **success code : 200, type: RXSUCCESS**
- **error code 400, type RXERROR**
### Create Session API
```bash
curl --location 'https://api.yourgpt.ai/chatbot/v1/createSession' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'api-key: pks-3e0a221e3dqweqwef0ecd123qe33a728e1dfa2a0ee01cc4ff8b8c99c21a45cff9' \
--data-urlencode 'widget_uid=84292q0qw1eqw124-4173-af6e-569477ac9013'
```
**Response**
```js
{
"type": "RXSUCCESS",
"message": "Chatbot session created successfully",
"data": {
"id": 1910677,
"session_uid": 17226012685401506,
"chat_mode": "1",
"project_id": 197,
"integration_id": 17,
"state": "pending",
"segment": "chat",
"status": "open",
"device_type": null,
"platform": null,
"ip": null,
"country": "IN",
"visitor_id": null,
"is_emulator": false,
"data": {},
"contact_id": null,
"updatedAt": "2024-08-02T12:21:08.540Z",
"createdAt": "2024-08-02T12:21:08.540Z"
}
}
```
<Callout title="Note" type="note">
To use the send message API, you must first establish a session. Obtain a session UID by executing the Create Session API.
</Callout>
### Send Message API
```bash
curl --location 'https://api.yourgpt.ai/chatbot/v1/sendMessage' --header 'Content-Type: application/x-www-form-urlencoded' --header 'api-key: pks-3e0a221e3dqweqwef0ecd123qe33a728e1dfa2a0ee01cc4ff8b8c99c21a45cff9' --data-urlencode 'widget_uid=84292q0qw1eqw124-4173-af6e-569477ac9013' --data-urlencode 'session_uid=3977b1x2d-d1e1-0d5a-a473-a6841bc4c880' --data-urlencode 'message=hey there?'
```
**Response**
```js
{
"type": "RXSUCCESS",
"message": "AI reply",
"data": {
"send_by": "assistant",
"origin": "api",
"session_uid": "39772b8d-d1c8-4d5a-a473-a6841bc4c880",
"type": "text",
"message_id": 241043,
"message": "Hello! How can I assist you today?",
"content_type": "picker",
"id": 241043,
"choices": [
{
"icon": "👍",
"text": "I am satisfied",
"value": "like",
"enabled": true
},
{
"icon": "👎",
"text": "I am not satisfied",
"value": "dislike",
"enabled": true
},
{
"icon": "🦸",
"text": "Request a human operator",
"value": "requesthumanoperator",
"enabled": true
}
]
}
}
```
---
<!-- Source: https://docs.yourgpt.ai/chatbot/developer-guide/getting-started/sdks -->
# SDKs
> Available SDKs for YourGPT chatbot integration.
YourGPT provides multiple SDKs to help you integrate our chatbot into your applications.
## Web SDKs
- [$yourgpt Method](/chatbot/developer-guide/web-sdks/yourgpt-method) - Integrate using the $yourgpt JavaScript method
- [NPM Package](/chatbot/developer-guide/web-sdks/npm-package) - Use our NPM package for React and other frameworks
## Mobile SDKs
- [Android SDK](/chatbot/developer-guide/mobile-sdks/android-sdk) - Native Android integration
- [iOS SDK](/chatbot/developer-guide/mobile-sdks/ios-sdk) - Native iOS integration
- [Flutter SDK](/chatbot/developer-guide/mobile-sdks/flutter-sdk) - Cross-platform Flutter integration
- [React Native SDK](/chatbot/developer-guide/mobile-sdks/react-native-sdk) - React Native integration
---
<!-- Source: https://docs.yourgpt.ai/chatbot/developer-guide/identity-verification -->
# Identity Verification
Identity verification helps you to setup a secure chatbot.
The identity verification system uses HMAC (Hash-based Message Authentication Code) to securely verify user identities. When enabled, users must provide valid authentication credentials to interact with the chatbot.
---
## Step 1: Get your secret key
First, get your widget secret key from your widget settings:
1. Open your chatbot from the dashboard
2. Go to **Widget → Settings**
<img src="../../assets/chatbot/sdk/widget-settings.png" alt="Widget settings" className="rounded-md" />
3. Copy your **Secret Key** — you'll need it for generating HMAC signatures
<img src="../../assets/chatbot/sdk/widget-secret.png" alt="Widget secret key" className="rounded-md" />
---
## Step 2: Generate HMAC Signature
The HMAC verification follows a specific priority order:
1. **external_user_id** (highest priority)
2. **email**
3. **phone** (lowest priority)
Generate the HMAC signature using your secret key and the highest-priority parameter available.
```javascript
const crypto = require('crypto');
function generateHMAC(data, secret) {
// Create a new HMAC object using SHA-256 and the secret key
let generatedHash = crypto.createHmac('sha256', secret);
// Write the data to be hashed
generatedHash.write(data);
// Finalize the HMAC calculation
generatedHash.end();
// Return the HMAC as a hexadecimal string
return generatedHash.read().toString('hex');
}
const secretKey = 'your_secret_key';
// Example: Generate HMAC using external_user_id
const externalUserId = '<unique user id>';
const hmacForExternalUserId = generateHMAC(externalUserId, secretKey);
// Example: Generate HMAC using email
const email = '<valid email>';
const hmacForEmail = generateHMAC(email, secretKey);
// Example: Generate HMAC using phone
const phone = '<valid phone number>';
const hmacForPhone = generateHMAC(phone, secretKey);
```
---
## Step 3: Perform identity verification
You can perform identity verification by setting the user's contact information using the `set` method and including the HMAC hash in the `user_hash` parameter.
```javascript
$yourgptChatbot.set("contact:data", {
email: "<valid email>",
phone: "<valid phone number>",
name: "<user name>",
ext_user_id: "<unique user id>",
user_hash: hmac
});
```
<Callout type="note" title="Note">
When setting user data, include a valid HMAC hash that matches the highest-priority identifier in your data. Verification order: <strong>external_user_id → email → phone</strong>. If the hash doesn't match, you will receive an <strong>"invalid hmac hash"</strong> error.
</Callout>
---
## Security Considerations
- Keep your secret key secure and never expose it in client-side code
- Implement proper error handling for failed verifications
---
## Troubleshooting
If you encounter verification issues:
- Ensure your secret key matches the one in your dashboard
- Check that all parameters match between HMAC generation and visitor identification
- Confirm your HMAC generation algorithm matches the specifications
For additional support or questions, please contact our support team.
---
<!-- Source: https://docs.yourgpt.ai/chatbot/developer-guide -->
# Introduction
> Integrate YourGPT chatbot using SDKs and APIs.
Welcome to the YourGPT Developer Guide. Here you'll find everything you need to integrate our chatbot into your applications.
<Cards>
<Card title="Identity Verification" href="/chatbot/developer-guide/identity-verification" />
<Card title="Web SDKs" href="/chatbot/developer-guide/web-sdks" />
<Card title="Mobile SDKs" href="/chatbot/developer-guide/mobile-sdks" />
<Card title="AI Copilot" href="/chatbot/developer-guide/widget/ai-copilot" />
<Card title="API Reference" href="/chatbot/developer-guide/api-reference" />
</Cards>
---
<!-- Source: https://docs.yourgpt.ai/chatbot/developer-guide/mobile-sdks/android-sdk -->
# Android Chatbot SDK
The Android SDK allows you to integrate YourGPT Chatbot into your Android applications with a native, fully featured experience. It supports AI conversations, custom UI styling, event listeners, and advanced configuration options.
---
## Installation
### SDK Repository
<Callout type="note" title="SDK Repository">
View the full SDK source code and examples on GitHub:
<a href="https://github.com/YourGPT/yourgpt-widget-sdk-android" target="_blank">yourgpt-widget-sdk-android</a>
</Callout>
1. Add the dependency to your app's `build.gradle` file:
```bash
dependencies {
implementation 'com.yourgpt:android-sdk:1.0.0'
implementation 'androidx.webkit:webkit:1.8.0'
}
```
---
## Permissions
Add required permissions and activities to your `AndroidManifest.xml`:
```xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Required permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar">
<!-- Main activity -->
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- YourGPT Chatbot Activity -->
<activity
android:name="com.yourgpt.sdk.ChatbotActivity"
android:exported="false"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:hardwareAccelerated="true" />
</application>
</manifest>
```
---
## Implementation
Follow these steps to start using the chatbot in your Android app.
### Step 1: Create Your Activity
Implement `YourGPTEventListener`, observe SDK state, and initialize the chatbot:
```kotlin
package com.yourapp
import android.os.Bundle
import android.widget.Button
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.lifecycleScope
import com.yourgpt.sdk.*
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
class MainActivity : AppCompatActivity(), YourGPTEventListener {
private lateinit var openChatButton: Button
private lateinit var statusText: TextView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
setupUI()
setupSDK()
initializeSDK()
}
private fun setupUI() {
openChatButton = findViewById(R.id.btn_open_chat)
statusText = findViewById(R.id.tv_status)
openChatButton.setOnClickListener {
openChatbot()
}
openChatButton.isEnabled = false
statusText.text = "SDK Status: Initializing..."
}
private fun setupSDK() {
YourGPTSDK.setEventListener(this)
lifecycleScope.launch {
YourGPTSDK.stateFlow.collect { state ->
updateUIForSDKState(state)
}
}
}
private fun initializeSDK() {
val configuration = YourGPTConfig(
widgetUid = "your-widget-uid-here"
)
lifecycleScope.launch {
try {
YourGPTSDK.initialize(configuration)
} catch (error: Exception) {
runOnUiThread {
Toast.makeText(
this@MainActivity,
"SDK initialization failed: ${error.message}",
Toast.LENGTH_LONG
).show()
}
}
}
}
private fun updateUIForSDKState(state: YourGPTSDKState) {
runOnUiThread {
statusText.text = "SDK Status: ${state.connectionState.name.lowercase().replaceFirstChar { it.uppercase() }}"
when (state.connectionState) {
YourGPTConnectionState.CONNECTED -> {
statusText.setTextColor(0xFF28A745.toInt())
openChatButton.isEnabled = true
}
YourGPTConnectionState.CONNECTING -> {
statusText.setTextColor(0xFFFFC107.toInt())
openChatButton.isEnabled = false
}
YourGPTConnectionState.ERROR -> {
statusText.setTextColor(0xFFDC3545.toInt())
openChatButton.isEnabled = false
state.error?.let {
statusText.text = "SDK Error: $it"
}
}
YourGPTConnectionState.DISCONNECTED -> {
statusText.setTextColor(0xFF6C757D.toInt())
openChatButton.isEnabled = false
}
}
}
}
private fun openChatbot() {
val configuration = YourGPTConfig(
widgetUid = "your-widget-uid-here"
)
YourGPTSDK.openChatbot(this, configuration)
}
override fun onMessageReceived(message: Map<String, Any>) {
Toast.makeText(this, "New message: $message", Toast.LENGTH_SHORT).show()
}
override fun onChatOpened() {
Toast.makeText(this, "Chat opened", Toast.LENGTH_SHORT).show()
}
override fun onChatClosed() {
Toast.makeText(this, "Chat closed", Toast.LENGTH_SHORT).show()
}
override fun onError(error: String) {
Toast.makeText(this, "Error: $error", Toast.LENGTH_LONG).show()
}
override fun onLoadingStarted() {
Toast.makeText(this, "Loading started", Toast.LENGTH_SHORT).show()
}
override fun onLoadingFinished() {
Toast.makeText(this, "Loading finished", Toast.LENGTH_SHORT).show()
}
}
```
---
### Step 2: Create Layout File
Create a simple layout with a button to open the chatbot:
```xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp"
android:gravity="center">
<TextView
android:id="@+id/tv_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SDK Status: Initializing..."
android:textSize="16sp"
android:layout_marginBottom="32dp" />
<Button
android:id="@+id/btn_open_chat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Open YourGPT Chat"
android:textSize="16sp"
android:padding="16dp" />
</LinearLayout>
```
---
## Requirements
The Android Chatbot SDK requires:
- Android API level 21 (Android 5.0) or higher
- Kotlin 1.8.0 or higher
- AndroidX libraries
For the latest compatibility information and updates, refer to the official SDK documentation and release notes.
---
## Resources
- **GitHub Repository**: [yourgpt-widget-sdk-android](https://github.com/YourGPT/yourgpt-widget-sdk-android)
---
<!-- Source: https://docs.yourgpt.ai/chatbot/developer-guide/mobile-sdks/flutter-sdk -->
# Flutter Chatbot SDK
The Flutter SDK allows you to seamlessly integrate YourGPT Chatbot into your flutter applications. This SDK provides a native experience with full access to all YourGPT features including AI conversations, custom styling, and advanced functionality.
---
## Installation
Follow these steps to install and configure the flutter Chatbot SDK in your project:
<Callout type="note" title="SDK Repository">
View the full SDK source code and examples on GitHub: [yourgpt-widget-sdk-flutter](https://github.com/YourGPT/yourgpt-widget-sdk-flutter)
</Callout>
1. Add this to your package's `pubspec.yaml` file:
```bash
dependencies:
yourgpt_flutter_sdk: ^1.0.0
webview_flutter: ^4.4.2
```
2. Then run:
```bash
flutter pub get
```
---
## Permissions
### iOS
No permissions needed.
### Android
Add internet permission:
```xml
<uses-permission android:name="android.permission.INTERNET" />
```
---
## Implementation
To use a Chatbot widget in your flutter application, follow the below steps:
### Step 1: Update your `Main.dart` file
```dart
// Show chatbot in a bottom sheet (recommended)
YourGPTChatScreen.showAsBottomSheet(
context: context,
widgetUid: 'your-widget-uid',
);
```
Wrap this inside a function and call it on any event.
### Alternative: Full Screen Usage
```dart
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Scaffold(
body: SafeArea(
child: YourGPTChatScreen(
widgetUid: 'your-widget-uid',
),
),
),
),
);
```
---
## Requirements
- Flutter: 3.13+
- Dart: 3.0+
- Android: minSdk 21+, compileSdk 33+
- iOS: 12.0+
---
## Resources
- **GitHub Repository**:
https://github.com/YourGPT/yourgpt-widget-sdk-flutter
---
<!-- Source: https://docs.yourgpt.ai/chatbot/developer-guide/mobile-sdks -->
# Mobile SDKs
> Available Mobile SDKs for YourGPT chatbot integration.
YourGPT provides multiple Mobile SDKs to help you integrate our chatbot into your applications.
<Cards>
<Card
title="React Native SDK"
description="Seamlessly integrate YourGPT Chatbot into your React Native applications with native experience and advanced functionality."
href="/chatbot/developer-guide/mobile-sdks/react-native-sdk"
/>
<Card
title="iOS SDK"
description="Seamlessly integrate YourGPT Chatbot into your iOS applications with native experience and full feature access."
href="/chatbot/developer-guide/mobile-sdks/ios-sdk"
/>
<Card
title="Flutter SDK"
description="Integrate YourGPT Chatbot into your Flutter applications with native experience and full feature support."
href="/chatbot/developer-guide/mobile-sdks/flutter-sdk"
/>
<Card
title="Android SDK"
description="Native Android integration with full access to all YourGPT features including AI conversations, custom styling, and advanced functionality."
href="/chatbot/developer-guide/mobile-sdks/android-sdk"
/>
</Cards>
---
<!-- Source: https://docs.yourgpt.ai/chatbot/developer-guide/mobile-sdks/ios-sdk -->
# iOS Chatbot SDK
The iOS SDK allows you to seamlessly integrate YourGPT Chatbot into your iOS applications. This SDK provides a native experience with full access to all YourGPT features including AI conversations, custom styling, and advanced functionality.
---
## Installation
Follow these steps to install and configure the iOS Chatbot SDK in your project:
<Callout type="note" title="SDK Repository">
View the full SDK source code and examples on GitHub: [yourgpt-widget-sdk-ios](https://github.com/YourGPT/yourgpt-widget-sdk-ios)
</Callout>
1. Add this to your `Podfile`:
```bash
$ pod 'YourGPTSDK', '~> 1.0'
```
2. Then run:
```bash
$ pod install
```
### Swift Package Manager
Add the package dependency in Xcode:
1. File → Add Package Dependencies
2. Enter: `https://github.com/YourGPT/yourgpt-widget-sdk-ios.git`
3. Select version `1.0.0`
Or add to `Package.swift`:
```bash
dependencies: [
.package(url: "https://github.com/YourGPT/yourgpt-widget-sdk-ios.git", from: "1.0.0")
]
```
---
## Implementation
To use a Chatbot widget in your iOS application, follow the steps below or copy and paste the code into your application's respective files.
### Step 1: Create a Wrapper Class (Recommended)
For better organization and reusability, create a wrapper class to manage the SDK:
```swift
import UIKit
import YourGPTSDK
import Combine
@available(iOS 13.0, *)
class YourGPTWrapper: NSObject {
static let shared = YourGPTWrapper()
private var cancellables = Set<AnyCancellable>()
private var chatbotViewController: YourGPTChatbotViewController?
// State observer
var onStateChange: ((YourGPTSDKState) -> Void)?
private override init() {
super.init()
setupSDKObserver()
}
private func setupSDKObserver() {
YourGPTSDK.core.$state
.receive(on: DispatchQueue.main)
.sink { [weak self] state in
self?.onStateChange?(state)
}
.store(in: &cancellables)
}
func initializeSDK(widgetUid: String) async throws {
let config = YourGPTConfig(widgetUid: widgetUid)
try await YourGPTSDK.initialize(config: config)
}
func openChatbot(from presentingViewController: UIViewController, delegate: YourGPTChatbotDelegate?) {
guard YourGPTSDK.isReady else {
showAlert(on: presentingViewController, title: "SDK Not Ready", message: "Please wait for the SDK to initialize.")
return
}
chatbotViewController = YourGPTSDK.createChatbotViewController()
chatbotViewController?.delegate = delegate
// Add close button
let closeButton = UIBarButtonItem(
barButtonSystemItem: .close,
target: self,
action: #selector(closeChatbot)
)
chatbotViewController?.navigationItem.rightBarButtonItem = closeButton
let navigationController = UINavigationController(rootViewController: chatbotViewController!)
navigationController.modalPresentationStyle = .overCurrentContext
navigationController.modalTransitionStyle = .coverVertical
presentingViewController.present(navigationController, animated: true)
}
@objc private func closeChatbot() {
chatbotViewController?.dismiss(animated: true) { [weak self] in
self?.chatbotViewController = nil
}
}
func dismissChatbot() {
chatbotViewController?.dismiss(animated: true) { [weak self] in
self?.chatbotViewController = nil
}
}
var isReady: Bool {
return YourGPTSDK.isReady
}
var currentState: YourGPTSDKState {
return YourGPTSDK.core.state
}
private func showAlert(on viewController: UIViewController, title: String, message: String) {
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default))
viewController.present(alert, animated: true)
}
}
```
### Step 2: Initialize the SDK in Your View Controller
```swift
import UIKit
import YourGPTSDK
@available(iOS 13.0, *)
class ViewController: UIViewController {
@IBOutlet weak var statusLabel: UILabel?
@IBOutlet weak var openChatButton: UIButton?
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
setupSDKObserver()
initializeSDK()
}
private func setupUI() {
title = "YourGPT iOS SDK Demo"
view.backgroundColor = .systemBackground
// Configure button
openChatButton?.layer.cornerRadius = 8
openChatButton?.isEnabled = false
updateStatus("Initializing...")
}
private func setupSDKObserver() {
YourGPTWrapper.shared.onStateChange = { [weak self] state in
self?.updateUIForSDKState(state)
}
}
private func initializeSDK() {
Task {
do {
try await YourGPTWrapper.shared.initializeSDK(widgetUid: "your-widget-uid")
} catch {
await MainActor.run {
self.showAlert(title: "SDK Error", message: error.localizedDescription)
}
}
}
}
private func updateUIForSDKState(_ state: YourGPTSDKState) {
switch state.connectionState {
case .connected:
statusLabel?.textColor = .systemGreen
openChatButton?.isEnabled = true
updateStatus("Ready - SDK Connected!", color: .systemGreen)
case .connecting:
statusLabel?.textColor = .systemOrange
openChatButton?.isEnabled = false
updateStatus("Connecting...", color: .systemOrange)
case .error:
statusLabel?.textColor = .systemRed
openChatButton?.isEnabled = false
if let error = state.error {
updateStatus("Error: \(error)", color: .systemRed)
}
case .disconnected:
statusLabel?.textColor = .systemGray
openChatButton?.isEnabled = false
updateStatus("Disconnected", color: .systemGray)
}
}
private func updateStatus(_ text: String, color: UIColor = .systemOrange) {
statusLabel?.text = "SDK Status: \(text)"
statusLabel?.textColor = color
}
@IBAction func openChatTapped(_ sender: UIButton? = nil) {
YourGPTWrapper.shared.openChatbot(from: self, delegate: self)
}
private func showAlert(title: String, message: String) {
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default))
present(alert, animated: true)
}
}
```
---
## Requirements
The iOS Chatbot SDK requires the following versions:
- iOS 13.0+
- Xcode 12.0+
- Swift 5.0+
For the latest compatibility information and updates, refer to the official SDK documentation and release notes.
---
## Resources
- **GitHub Repository**: [yourgpt-widget-sdk-ios](https://github.com/YourGPT/yourgpt-widget-sdk-ios)
---
<!-- Source: https://docs.yourgpt.ai/chatbot/developer-guide/mobile-sdks/react-native-sdk -->
# React Native Chatbot SDK
> Integrate YourGPT Chatbot seamlessly into your react-native application.
The React Native Chatbot SDK allows you to seamlessly integrate YourGPT Chatbot into your React Native applications. This SDK provides a native experience with full access to all YourGPT features including AI conversations, custom styling, and advanced functionality.
---