Skip to content

Latest commit

 

History

History
293 lines (207 loc) · 10.3 KB

File metadata and controls

293 lines (207 loc) · 10.3 KB

sunshine_conversations_client.ParticipantsApi

All URIs are relative to https://api.smooch.io

Method HTTP request Description
join_conversation POST /v2/apps/{appId}/conversations/{conversationId}/join Join Conversation
leave_conversation POST /v2/apps/{appId}/conversations/{conversationId}/leave Leave Conversation
list_participants GET /v2/apps/{appId}/conversations/{conversationId}/participants List Participants

join_conversation

ParticipantResponse join_conversation(app_id, conversation_id, participant_join_body)

Join Conversation

Adds a user to a conversation using either their userId or userExternalId. The endpoint only supports adding a participant to a sdkGroup conversation.

Example

  • Basic Authentication (basicAuth):
  • Bearer (JWT) Authentication (bearerAuth):
import sunshine_conversations_client
from sunshine_conversations_client.models.participant_join_body import ParticipantJoinBody
from sunshine_conversations_client.models.participant_response import ParticipantResponse
from sunshine_conversations_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.smooch.io
# See configuration.py for a list of all supported configuration parameters.
configuration = sunshine_conversations_client.Configuration(
    host = "https://api.smooch.io"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure HTTP basic authorization: basicAuth
configuration = sunshine_conversations_client.Configuration(
    username = os.environ["USERNAME"],
    password = os.environ["PASSWORD"]
)

# Configure Bearer authorization (JWT): bearerAuth
configuration = sunshine_conversations_client.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with sunshine_conversations_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = sunshine_conversations_client.ParticipantsApi(api_client)
    app_id = '5d8cff3cd55b040010928b5b' # str | Identifies the app.
    conversation_id = '029c31f25a21b47effd7be90' # str | Identifies the conversation.
    participant_join_body = {"userId":"67a11490f0305f4a391e9f8a","subscribeSDKClient":true} # ParticipantJoinBody | 

    try:
        # Join Conversation
        api_response = api_instance.join_conversation(app_id, conversation_id, participant_join_body)
        print("The response of ParticipantsApi->join_conversation:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling ParticipantsApi->join_conversation: %s\n" % e)

Parameters

Name Type Description Notes
app_id str Identifies the app.
conversation_id str Identifies the conversation.
participant_join_body ParticipantJoinBody

Return type

ParticipantResponse

Authorization

basicAuth, bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Created -
400 Bad request -
404 Not found -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

leave_conversation

object leave_conversation(app_id, conversation_id, participant_leave_body)

Leave Conversation

Removes a user from a conversation using either their userId, userExternalId, or participantId.

Example

  • Basic Authentication (basicAuth):
  • Bearer (JWT) Authentication (bearerAuth):
import sunshine_conversations_client
from sunshine_conversations_client.models.participant_leave_body import ParticipantLeaveBody
from sunshine_conversations_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.smooch.io
# See configuration.py for a list of all supported configuration parameters.
configuration = sunshine_conversations_client.Configuration(
    host = "https://api.smooch.io"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure HTTP basic authorization: basicAuth
configuration = sunshine_conversations_client.Configuration(
    username = os.environ["USERNAME"],
    password = os.environ["PASSWORD"]
)

# Configure Bearer authorization (JWT): bearerAuth
configuration = sunshine_conversations_client.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with sunshine_conversations_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = sunshine_conversations_client.ParticipantsApi(api_client)
    app_id = '5d8cff3cd55b040010928b5b' # str | Identifies the app.
    conversation_id = '029c31f25a21b47effd7be90' # str | Identifies the conversation.
    participant_leave_body = {"userId":"67a11490f0305f4a391e9f8a"} # ParticipantLeaveBody | 

    try:
        # Leave Conversation
        api_response = api_instance.leave_conversation(app_id, conversation_id, participant_leave_body)
        print("The response of ParticipantsApi->leave_conversation:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling ParticipantsApi->leave_conversation: %s\n" % e)

Parameters

Name Type Description Notes
app_id str Identifies the app.
conversation_id str Identifies the conversation.
participant_leave_body ParticipantLeaveBody

Return type

object

Authorization

basicAuth, bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Ok -
404 Not found -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_participants

ParticipantListResponse list_participants(app_id, conversation_id, page=page)

List Participants

Lists all the participants of a particular conversation. This API is paginated through cursor pagination.

/v2/apps/:appId/conversations/:conversationId/participants?page[before]=26508c10541a4b0ff472e5e2

Example

  • Basic Authentication (basicAuth):
  • Bearer (JWT) Authentication (bearerAuth):
import sunshine_conversations_client
from sunshine_conversations_client.models.page import Page
from sunshine_conversations_client.models.participant_list_response import ParticipantListResponse
from sunshine_conversations_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.smooch.io
# See configuration.py for a list of all supported configuration parameters.
configuration = sunshine_conversations_client.Configuration(
    host = "https://api.smooch.io"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure HTTP basic authorization: basicAuth
configuration = sunshine_conversations_client.Configuration(
    username = os.environ["USERNAME"],
    password = os.environ["PASSWORD"]
)

# Configure Bearer authorization (JWT): bearerAuth
configuration = sunshine_conversations_client.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with sunshine_conversations_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = sunshine_conversations_client.ParticipantsApi(api_client)
    app_id = '5d8cff3cd55b040010928b5b' # str | Identifies the app.
    conversation_id = '029c31f25a21b47effd7be90' # str | Identifies the conversation.
    page = sunshine_conversations_client.Page() # Page | Contains parameters for applying cursor pagination. (optional)

    try:
        # List Participants
        api_response = api_instance.list_participants(app_id, conversation_id, page=page)
        print("The response of ParticipantsApi->list_participants:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling ParticipantsApi->list_participants: %s\n" % e)

Parameters

Name Type Description Notes
app_id str Identifies the app.
conversation_id str Identifies the conversation.
page Page Contains parameters for applying cursor pagination. [optional]

Return type

ParticipantListResponse

Authorization

basicAuth, bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Ok -
400 Bad request -
404 Not found -

[Back to top] [Back to API list] [Back to Model list] [Back to README]