The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

WebService::SendBird - unofficial support for the Sendbird API

SYNOPSIS

 use WebService::SendBird;

 my $api = WebService::SendBird->new(
     api_token => 'You_Api_Token_Here',
     app_id    => 'You_App_ID_Here',
 );

 my $user = $api->create_user(
     user_id     => 'my_chat_user_1',
     nickname    => 'pumpkin',
     profile_url => undef,
 );

 my $chat = $api->create_group_chat(
     user_ids => [ $user->user_id ],
 );

DESCRIPTION

Basic implementation for SendBird Platform API client, which helps to create users and group chats.

More information at Platform API Documentation

METHODS

new

Creates an instance of API client

  • api_token - Master or Secondary API Token.

  • app_id - Sendbird Application ID.

  • api_url - URL to API end point. By default it will be generated from app_id.

  • ua - Custom http client for API requests, should have the same interface like Mojo::UserAgent.

  • timeout - request timeout, default value 15 seconds

app_id

Returns Application ID.

api_token

Returns API Token

api_url

Returns API endpoint url

timeout

Return http request timeout value.

ua

Return User Agent for http request.

http_headers

Returns headers for API request.

request

Sends request to Sendbird API

create_user

Creates a user at SendBird

  • user_id - Unique User Identifier

  • nickname - User nickname

  • profile_url - user profile url. Could be undef or empty.

Information about extra parameters could be found at API Documentation

Method returns an instance of WebService::SendBird::User

view_user

Gets information about a user from SendBird

  • user_id - Unique User Identifier

Information about extra parameters could be found at API Documentation

Method returns an instance of WebService::SendBird::User

create_group_chat

Creates a group chat room

Information about parameters could be found at API Documentation

Method returns an instance of WebService::SendBird::GroupChat

view_group_chat

Gets information about a group chat from SendBird

  • channel_url - Unique Chat Identifier

Information about parameters could be found at API Documentation

Method returns an instance of WebService::SendBird::GroupChat