Skip to content

Latest commit

 

History

History
373 lines (297 loc) · 14.7 KB

ParticipantsApi.md

File metadata and controls

373 lines (297 loc) · 14.7 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):

from __future__ import print_function
import time
import sunshine_conversations_client
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.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# Configure Bearer authorization (JWT): bearerAuth
# Uncomment this if you want to use JWTs
#configuration.access_token = 'YOUR_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 = sunshine_conversations_client.ParticipantJoinBody() # ParticipantJoinBody | 

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

Bearer (JWT) Authentication (bearerAuth):

from __future__ import print_function
import time
import sunshine_conversations_client
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.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# Configure Bearer authorization (JWT): bearerAuth
# Uncomment this if you want to use JWTs
#configuration.access_token = 'YOUR_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 = sunshine_conversations_client.ParticipantJoinBody() # ParticipantJoinBody | 

    try:
        # Join Conversation
        api_response = api_instance.join_conversation(app_id, conversation_id, participant_join_body)
        pprint(api_response)
    except ApiException 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 Too many participants -
404 Conversation 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):

from __future__ import print_function
import time
import sunshine_conversations_client
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.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# Configure Bearer authorization (JWT): bearerAuth
# Uncomment this if you want to use JWTs
#configuration.access_token = 'YOUR_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 = sunshine_conversations_client.ParticipantLeaveBody() # ParticipantLeaveBody | 

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

Bearer (JWT) Authentication (bearerAuth):

from __future__ import print_function
import time
import sunshine_conversations_client
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.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# Configure Bearer authorization (JWT): bearerAuth
# Uncomment this if you want to use JWTs
#configuration.access_token = 'YOUR_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 = sunshine_conversations_client.ParticipantLeaveBody() # ParticipantLeaveBody | 

    try:
        # Leave Conversation
        api_response = api_instance.leave_conversation(app_id, conversation_id, participant_leave_body)
        pprint(api_response)
    except ApiException 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 User is not a member of the conversation -

[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. shell /v2/apps/:appId/conversations/:conversationId/participants?page[before]=26508c10541a4b0ff472e5e2

Example

Basic Authentication (basicAuth):

from __future__ import print_function
import time
import sunshine_conversations_client
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.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# Configure Bearer authorization (JWT): bearerAuth
# Uncomment this if you want to use JWTs
#configuration.access_token = 'YOUR_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)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling ParticipantsApi->list_participants: %s\n" % e)

Bearer (JWT) Authentication (bearerAuth):

from __future__ import print_function
import time
import sunshine_conversations_client
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.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# Configure Bearer authorization (JWT): bearerAuth
# Uncomment this if you want to use JWTs
#configuration.access_token = 'YOUR_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)
        pprint(api_response)
    except ApiException 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 Invalid page query parameters -
404 Not found -

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