> For the complete documentation index, see [llms.txt](https://docs.taptalk.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.taptalk.io/~/changes/FMvVnz8ZkLFBmR0Wx2wq/powertalk-chat-sdk-documentation/powertalk-ios/group-chat/group-chat-tapui.md).

# Chat Room and Messages - TapUI

You can use these methods when implementing your app with TapUI to open a chat room when UI implementation type is used.

| **TapTalk UI Chat Room Method**                                                                                                                                                                                                      | **Description**                                                                                                                         |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
| [Create Personal Chat Room with User Model](#create-chat-room-with-user-model)                                                                                                                                                       | Creates room with user model. This method will return `TapUIChatViewController` on success.                                             |
| [Create Personal Chat Room with TapTalk.io User ID](#create-chat-room-with-taptalk.io-user-id)                                                                                                                                       | Creates room with TapTalk.io user ID. This method will return `TapUIChatViewController` on success.                                     |
| [Create Personal Chat Room with Client User ID](#create-chat-room-with-client-user-id)                                                                                                                                               | Creates room with client user ID. This method will return `TapUIChatViewController` on success.                                         |
| [Create Room with Room Model](/~/changes/FMvVnz8ZkLFBmR0Wx2wq/powertalk-chat-sdk-documentation/powertalk-ios/group-chat/group-chat-tapui.md#create-room-with-room-model)                                                             | Creates room with room model. This method will return `TapUIChatViewController` on success.                                             |
| [Create Room with Room Model & Scroll to Selected Message](/~/changes/FMvVnz8ZkLFBmR0Wx2wq/powertalk-chat-sdk-documentation/powertalk-ios/group-chat/group-chat-tapui.md#create-room-with-room-model-and-scroll-to-selected-message) | Creates room with room model. This method will return `TapUIChatViewController` on success and scroll the view to the selected message. |
| [Create Saved Messages Chat Room](#create-saved-messages-chat-room)                                                                                                                                                                  | Creates the active user's Saved Messages chat room. This method will return `TapUIChatViewController` on success.                       |

{% hint style="info" %}
**Note:** You can get TapTalk.io current view controller or navigation controller to integrate to your current view controller by using [getCurrentTapTalkActiveViewController](/~/changes/FMvVnz8ZkLFBmR0Wx2wq/powertalk-chat-sdk-documentation/powertalk-ios/general.md#obtain-current-navigation-controller-in-tapui) method.
{% endhint %}

### Create Personal Chat Room with User Model

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
#import <TapTalk/TapUI.h>

[TapUI sharedInstance] createRoomWithOtherUser:OTHER_USER success:^[(TapUIChatViewController * _Nonnull chatViewController) {
   
   //You can choose to present or push view controller using this code
   //Present room list view
   [self presentViewController:chatViewController animated:YES completion:^{
     //completion
   }];

   //Push room list view
   [self.navigationController pushViewController:chatViewController animated:YES];
  
}];
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**\
**`OTHER_USER`**: (TAPUserModel) recipient user model that will be shown
{% endhint %}

### Create Personal Chat Room with TapTalk.io User ID

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
#import <TapTalk/TapUI.h>

[[TapUI sharedInstance] createRoomWithUserID:USER_ID prefilledText:PREFILLED_TEXT customQuoteTitle:CUSTOM_QUOTE_TITLE customQuoteContent:CUSTOM_QUOTE_CONTENT customQuoteImageURLString:CUSTOM_QUOTE_IMAGE_URL_STRING userInfo:USER_INFO success:^(TapUIChatViewController * _Nonnull chatViewController) {
  //Success open room
  
  //You can choose to present or push view controller using this code
    //Present room list view
    [self presentViewController:chatViewController animated:YES completion:^{
    //completion    
    }];

    //Push room list view
    [self.navigationController pushViewController:chatViewController animated:YES];
  
} failure:^(NSError * _Nonnull error) {
  //Failed open room
  
}];
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**\
**`USER_ID`**: (String) TapTalk.io user ID\
**`PREFILLED_TEXT`**: (String) prefilled text of message\
**`CUSTOM_QUOTE_TITLE`**: (String) title of custom quote data\
**`CUSTOM_QUOTE_CONTENT`**: (String) content / subtitle of custom quote data\
**`CUSTOM_QUOTE_IMAGE_URL_STRING`**: (String) image url string of custom quote image\
**`USER_INFO`**: (String) client-specified data or details of the custom quote
{% endhint %}

### Create Personal Chat Room with Client User ID

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
#import <TapTalk/TapUI.h>

[[TapUI sharedInstance] createRoomWithXCUserID:XC_USER_ID prefilledText:PREFILLED_TEXT customQuoteTitle:CUSTOM_QUOTE_TITLE customQuoteContent:CUSTOM_QUOTE_CONTENT customQuoteImageURLString:CUSTOM_QUOTE_IMAGE_URL_STRING userInfo:USER_INFO success:^(TapUIChatViewController * _Nonnull chatViewController) {
  //Success open room
  
  //You can choose to present or push view controller using this code
    //Present room list view
    [self presentViewController:chatViewController animated:YES completion:^{
    //completion
    }];

    //Push room list view
    [self.navigationController pushViewController:chatViewController animated:YES];
  
} failure:^(NSError * _Nonnull error) {
  //Failed open room
  
}];
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**\
**`XC_USER_ID`**: (String) client user ID\
**`PREFILLED_TEXT`**: (String) prefilled text of message\
**`CUSTOM_QUOTE_TITLE`**: (String) title of custom quote data\
**`CUSTOM_QUOTE_CONTENT`**: (String) content / subtitle of custom quote data\
**`CUSTOM_QUOTE_IMAGE_URL_STRING`**: (String) image url string of custom quote image\
**`USER_INFO`**: (String) client-specified data or details of the custom quote
{% endhint %}

### Create Room with Room Model

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
#import <TapTalk/TapUI.h>

[[TapUI sharedInstance] createRoomWithRoom:ROOM success:^(TapUIChatViewController * _Nonnull chatViewController) {
   //You can choose to present or push view controller using this code
   //Present room list view
   [self presentViewController:chatViewController animated:YES completion:^{
     //completion
   }];

   //Push room list view
   [self.navigationController pushViewController:chatViewController animated:YES];
}];
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**\
**`ROOM`**: (TAPRoomModel) recipient room data model
{% endhint %}

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
#import <TapTalk/TapUI.h>

[[TapUI sharedInstance] createRoomWithRoom:ROOM customQuoteTitle:CUSTOM_QUOTE_TITLE customQuoteContent:CUSTOM_QUOTE_CONTENT customQuoteImageURLString:CUSTOM_QUOTE_IMAGE_URL_STRING userInfo:USER_INFO success:^(TapUIChatViewController * _Nonnull chatViewController) {

   //You can choose to present or push view controller using this code
   //Present room list view
   [self presentViewController:chatViewController animated:YES completion:^{
     //completion
   }];

   //Push room list view
   [self.navigationController pushViewController:chatViewController animated:YES];

}];
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**\
**`ROOM`**: (TAPRoomModel) recipient room data model\
**`CUSTOM_QUOTE_TITLE`**: (String) title of custom quote data\
**`CUSTOM_QUOTE_CONTENT`**: (String) content / subtitle of custom quote data\
**`CUSTOM_QUOTE_IMAGE_URL_STRING`**: (String) image url string of custom quote image\
**`USER_INFO`**: (String) client-specified data or details of the custom quote
{% endhint %}

### Create Room with Room Model & Scroll to Selected Message

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
#import <TapTalk/TapUI.h>

[[TapUI sharedInstance] createRoomWithRoom:ROOM scrollToMessageWithLocalID:MESSAGE_LOCAL_ID] success:^(TapUIChatViewController * _Nonnull chatViewController) {
   //You can choose to present or push view controller using this code
   //Present room list view
   [self presentViewController:chatViewController animated:YES completion:^{
      //completion
   }];

   //Push room list view
   [self.navigationController pushViewController:chatViewController animated:YES];
}];
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**\
**`ROOM`**: (TAPRoomModel) recipient room data model\
**`MESSAGE_LOCAL_ID`**: (String) scrolls the view to the message with the specified local ID when the chat room is opened
{% endhint %}

### Create Saved Messages Chat Room

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
#import <TapTalk/TapUI.h>

[[TapUI sharedInstance] createSavedMessagesChatRoom:^(TapUIChatViewController * _Nonnull chatViewController) {
  //Success open room
  
  //You can choose to present or push view controller using this code
    //Present room list view
    [self presentViewController:chatViewController animated:YES completion:^{
    //completion    
    }];

    //Push room list view
    [self.navigationController pushViewController:chatViewController animated:YES];
  
} failure:^(NSError * _Nonnull error) {
  //Failed open room
}];
```

{% endtab %}
{% endtabs %}
