Skip to content

Latest commit

 

History

History
190 lines (123 loc) · 6.31 KB

ParticipantsApi.md

File metadata and controls

190 lines (123 loc) · 6.31 KB

SunshineConversationsClient.ParticipantsApi

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

Method HTTP request Description
joinConversation POST /v2/apps/{appId}/conversations/{conversationId}/join Join Conversation
leaveConversation POST /v2/apps/{appId}/conversations/{conversationId}/leave Leave Conversation
listParticipants GET /v2/apps/{appId}/conversations/{conversationId}/participants List Participants

joinConversation

ParticipantResponse joinConversation(appId, conversationId, participantJoinBody)

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

var SunshineConversationsClient = require('sunshine-conversations-client');
var defaultClient = SunshineConversationsClient.ApiClient.instance;

// Configure HTTP basic authorization: basicAuth
var basicAuth = defaultClient.authentications['basicAuth'];
basicAuth.username = 'YOUR_USERNAME';
basicAuth.password = 'YOUR_PASSWORD';

// Uncomment this section to use JWTs instead
// var bearerAuth = defaultClient.authentications['bearerAuth'];
// bearerAuth.accessToken = 'YOUR_ACCESS_TOKEN';

var apiInstance = new SunshineConversationsClient.ParticipantsApi();
var appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app.
var conversationId = "029c31f25a21b47effd7be90"; // String | Identifies the conversation.
var participantJoinBody = new SunshineConversationsClient.ParticipantJoinBody(); // ParticipantJoinBody | 
apiInstance.joinConversation(appId, conversationId, participantJoinBody).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
appId String Identifies the app.
conversationId String Identifies the conversation.
participantJoinBody ParticipantJoinBody

Return type

ParticipantResponse

Authorization

basicAuth, bearerAuth

HTTP request headers

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

leaveConversation

Object leaveConversation(appId, conversationId, participantLeaveBody)

Leave Conversation

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

Example

var SunshineConversationsClient = require('sunshine-conversations-client');
var defaultClient = SunshineConversationsClient.ApiClient.instance;

// Configure HTTP basic authorization: basicAuth
var basicAuth = defaultClient.authentications['basicAuth'];
basicAuth.username = 'YOUR_USERNAME';
basicAuth.password = 'YOUR_PASSWORD';

// Uncomment this section to use JWTs instead
// var bearerAuth = defaultClient.authentications['bearerAuth'];
// bearerAuth.accessToken = 'YOUR_ACCESS_TOKEN';

var apiInstance = new SunshineConversationsClient.ParticipantsApi();
var appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app.
var conversationId = "029c31f25a21b47effd7be90"; // String | Identifies the conversation.
var participantLeaveBody = new SunshineConversationsClient.ParticipantLeaveBody(); // ParticipantLeaveBody | 
apiInstance.leaveConversation(appId, conversationId, participantLeaveBody).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
appId String Identifies the app.
conversationId String Identifies the conversation.
participantLeaveBody ParticipantLeaveBody

Return type

Object

Authorization

basicAuth, bearerAuth

HTTP request headers

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

listParticipants

ParticipantListResponse listParticipants(appId, conversationId, opts)

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

var SunshineConversationsClient = require('sunshine-conversations-client');
var defaultClient = SunshineConversationsClient.ApiClient.instance;

// Configure HTTP basic authorization: basicAuth
var basicAuth = defaultClient.authentications['basicAuth'];
basicAuth.username = 'YOUR_USERNAME';
basicAuth.password = 'YOUR_PASSWORD';

// Uncomment this section to use JWTs instead
// var bearerAuth = defaultClient.authentications['bearerAuth'];
// bearerAuth.accessToken = 'YOUR_ACCESS_TOKEN';

var apiInstance = new SunshineConversationsClient.ParticipantsApi();
var appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app.
var conversationId = "029c31f25a21b47effd7be90"; // String | Identifies the conversation.
var opts = {
  'page': new SunshineConversationsClient.Page() // Page | Contains parameters for applying cursor pagination.
};
apiInstance.listParticipants(appId, conversationId, opts).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
appId String Identifies the app.
conversationId String 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