bsg / php-sdk
BSG One-API SDK for SMS, Viber, RCS, WhatsApp and messaging services
0.1.8
2026-03-20 01:17 UTC
Requires
- php: ^7.4 || ^8.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.3
- guzzlehttp/psr7: ^1.7 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.5
- phpunit/phpunit: ^8.0 || ^9.0
README
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
Installation
composer require bsgworld/php-sdk
Requirements
- PHP 7.4 or later
- Guzzle HTTP client (installed automatically)
Getting Started
Please follow the installation procedure and then run the following:
<?php require_once(__DIR__ . '/vendor/autoload.php'); $apiInstance = new BSG\Api\V2\Api\AuthApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); $login_request = new \BSG\Api\V2\Model\LoginRequest([ 'api_key' => 'live_XXXXXXXXXXXXXXXXXXXX', ]); try { $result = $apiInstance->login($login_request); print_r($result); } catch (Exception $e) { echo 'Exception when calling AuthApi->login: ', $e->getMessage(), PHP_EOL; } $token = $result->getBearer(); // Configure Bearer (JWT) authorization: ExternalAuth $config = BSG\Api\V2\Configuration::getDefaultConfiguration()->setAccessToken($token); $apiInstance = new BSG\Api\V2\Api\CampaignSMSApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $sms_send_request = new \BSG\Api\V2\Model\SmsSendRequest([ 'phones' => [ 0 => [ 'number' => 380661231231, ], ], 'sender' => 'Vet klinika', 'text' => 'test', ]); try { $result = $apiInstance->smsSend($sms_send_request); print_r($result); } catch (Exception $e) { echo 'Exception when calling CampaignSMSApi->smsSend: ', $e->getMessage(), PHP_EOL; }
Endpoints
All URIs are relative to https://one-api.bsg.world
| Class | Method | HTTP request | Description |
|---|---|---|---|
| AccountSettingsApi | getSettingsAddressBookFieldsById | GET /api/settings/address-book-fields/{id} | Get settings value |
| AuthApi | login | POST /api/auth/login | Receive JWT token |
| AuthApi | refreshToken | POST /api/auth/refresh | Refresh JWT token |
| BalanceApi | accountBalance | GET /api/accounts/balance | Get balance |
| BalanceApi | accountTariffs | GET /api/accounts/tariff | Get tariffs |
| CampaignApi | campaign | GET /api/campaigns/{id} | Get campaign info |
| CampaignApi | campaignDetails | GET /api/campaigns/{id}/detail | Get campaign details |
| CampaignApi | campaignPrice | POST /api/campaigns/price | Calculate campaign price |
| CampaignApi | campaignSend | POST /api/campaigns/send | Send campaign |
| CampaignApi | campaignStop | PATCH /api/campaigns/{id}/stop | Cancel campaign |
| CampaignApi | campaigns | GET /api/campaigns | List of campaigns |
| CampaignRCSApi | rcsSend | POST /api/campaigns/rcs/send | Send RCS message |
| CampaignRCSApi | rcsSendGroups | POST /api/campaigns/rcs/send-groups | Send RCS message to contact list |
| CampaignSMSApi | smsSend | POST /api/campaigns/sms/send | Send SMS campaign |
| CampaignSMSApi | smsSendGroups | POST /api/campaigns/sms/send-groups | Send SMS to contact list |
| CampaignSMSApi | smsSendIndividual | POST /api/campaigns/sms/send-individual | Send SMS with different text |
| CampaignViberApi | viberSend | POST /api/campaigns/viber/send | Send Viber campaign |
| CampaignWhatsAppApi | postCampaignsWhatsappSend | POST /api/campaigns/whatsapp/send | Send WhatsApp campaign |
| ContactApi | contact | GET /api/contacts/{id} | Get contact by ID |
| ContactApi | contactCreate | POST /api/contacts | Create a contact |
| ContactApi | contactDelete | DELETE /api/contacts/{id} | Delete contact |
| ContactApi | contactUpdate | PUT /api/contacts/{id} | Update contact |
| ContactApi | contacts | GET /api/contacts | List of contacts |
| ContactApi | contactsDelete | POST /api/contacts/delete | Delete multiple contacts |
| ContactApi | contactsSearch | GET /api/contacts/search | Search contacts |
| ContactFieldApi | contactFieldCreate | POST /api/contacts/fields | Create contact field |
| ContactFieldApi | contactFieldUpdate | PATCH /api/contacts/fields/{id} | Update contact field |
| ContactFieldApi | contactFields | GET /api/contacts/fields | List of contact fields |
| ContactFieldApi | postContactsFieldsDelete | POST /api/contacts/fields/delete | Delete contact fields by ids |
| ContactListApi | contactList | GET /api/groups/{id} | Get list by id |
| ContactListApi | contactListAttach | POST /api/groups/attach | Add contacts to the list |
| ContactListApi | contactListCreate | POST /api/groups | Create list |
| ContactListApi | contactListDelete | DELETE /api/groups/{id} | Delete list |
| ContactListApi | contactListDetach | POST /api/groups/detach | Remove contacts from the list |
| ContactListApi | contactListSearch | GET /api/groups/search | Search list |
| ContactListApi | contactListUpdate | PUT /api/groups/{id} | Update list |
| ContactListApi | contactLists | GET /api/groups | List of contact lists |
| EmailApi | emailSend | POST /api/email/send-emails | Send Email |
| EmailApi | emailTemplateSend | POST /api/email/send-template-emails | Send Email template |
| MessageRCSApi | rcsSingle | POST /api/messages/rcs/send | Send single RCS message |
| MessagesApi | sendMessage | POST /api/messages/send | Send single message |
| MessagesSMSApi | getMessages | GET /api/messages | Find messages |
| MessagesWhatsAppApi | whatsappSingle | POST /api/messages/whatsapp/send | Send single WhatsApp message |
| SendersApi | senderRequestLegal | POST /api/senders/requests/legal | Sender registration by a legal entity |
| SendersApi | senderRequestNatural | POST /api/senders/requests/natural | Sender registration by an individual |
| SendersApi | senderRequests | GET /api/senders/requests/sms | List of Sender Requests |
| SendersApi | senders | GET /api/senders | List of Senders |
| ShortDomainsApi | shortUrlsDomain | GET /api/short-url/domains/{uuid} | Get domain by uuid |
| ShortDomainsApi | shortUrlsDomainCreate | POST /api/short-url/domains | Add domain |
| ShortDomainsApi | shortUrlsDomainRemove | DELETE /api/short-url/domains/{uuid} | Remove domain |
| ShortDomainsApi | shortUrlsDomainUpdate | PUT /api/short-url/domains/{uuid} | Update domain |
| ShortDomainsApi | shortUrlsDomains | GET /api/short-url/domains | List of domains |
| ShortLinksApi | shortUrlsClicks | GET /api/short-url/clicks | List of clicks |
| ShortLinksApi | shortUrlsLink | GET /api/short-url/links/{uuid}/statistics | Get short link statistic |
| ShortLinksApi | shortUrlsLinkCreate | POST /api/short-url/links | Create short link |
| ShortLinksApi | shortUrlsLinkDelete | DELETE /api/short-url/links/{uuid} | Remove short link |
| ShortLinksApi | shortUrlsLinkUpdate | PUT /api/short-url/links/{uuid} | Update short link |
| ShortLinksApi | shortUrlsLinks | GET /api/short-url/links | List of short links |
| StatisticApi | statJobsCreate | POST /api/stat/jobs | Create new job |
| StatisticApi | statJobsDelete | DELETE /api/stat/jobs/{id} | Delete job result |
| StatisticApi | statJobsList | GET /api/stat/jobs | List statistic jobs |
| StatisticApi | statJobsShow | GET /api/stat/jobs/{id} | Load job result |
| StopListApi | stoplistAdd | POST /api/stoplist/attach | Add contacts to stop list |
| StopListApi | stoplistItems | GET /api/stoplist | List the contacts of stop lists |
| StopListApi | stoplistRemove | POST /api/stoplist/detach | Remove contacts from stop list |
| StopListApi | stoplistSearch | GET /api/stoplist/search | Search contacts in Stop lists |
| TwoFAOTPApi | cancelOtp | POST /api/2fa/authentications/{id}/cancel | Cancel the authentication session |
| TwoFAOTPApi | otpList | GET /api/2fa/authentications | List of authentication sessions |
| TwoFAOTPApi | resendOtp | POST /api/2fa/authentications/otp/{id}/resend | Resend the one-time code |
| TwoFAOTPApi | sendOtp | POST /api/2fa/authentications/otp | Send One-time password |
| TwoFAOTPApi | statusOtp | GET /api/2fa/authentications/{id} | Check authentication status |
| TwoFAOTPApi | verifyOtp | POST /api/2fa/authentications/otp/{id}/verify | Check one-time Code |
| TwoFATemplatesApi | otpTemplate | GET /api/2fa/authentications/templates/{templateId} | Get message template |
| TwoFATemplatesApi | otpTemplateCreate | POST /api/2fa/authentications/templates | Create a message template |
| TwoFATemplatesApi | otpTemplateDelete | DELETE /api/2fa/authentications/templates/{templateId} | Delete a message template |
| TwoFATemplatesApi | otpTemplateList | GET /api/2fa/authentications/templates | List of message templates |
Models
- AccountBalance200Response
- AccountTariffs200Response
- AlternativeChannel
- BalanceSchema
- Campaign
- CampaignDetails200Response
- CampaignPrice200Response
- CampaignPrice422Response
- CampaignPriceRequest
- CampaignPriceRequestMessagesItem
- CampaignResponse
- CampaignSchema
- CampaignStatus
- CampaignStop200Response
- CampaignStop422Response
- CancelOtp200Response
- CancelOtp404Response
- CancelOtp422Response
- Card
- Cards
- ClickResource
- Components
- Contact200Response
- Contact422Response
- ContactCreate201Response
- ContactCreate422Response
- ContactFieldCollectionSchema
- ContactFieldCreate201Response
- ContactFieldCreateRequest
- ContactFieldSchema
- ContactFieldType
- ContactFieldUpdate200Response
- ContactFieldUpdateRequest
- ContactFieldUpdateRequestOptionDescription
- ContactFieldUpdateRequestOptionIsVisible
- ContactFieldUpdateRequestOptionName
- ContactFieldValuePair
- ContactGroupSchema
- ContactGroupSearchField
- ContactGroupSearchSchema
- ContactList200Response
- ContactListAttachRequest
- ContactListCreate201Response
- ContactListCreate422Response
- ContactListCreateRequest
- ContactListDetachRequest
- ContactListSearch200Response
- ContactListSearchCriteria
- ContactListSearchMeta
- ContactListUpdate200Response
- ContactListUpdate422Response
- ContactListUpdateRequest
- ContactLists200Response
- ContactSchema
- ContactUpdate200Response
- ContactUpdate422Response
- ContactUpdateRequest
- Contacts200Response
- ContactsSearch200Response
- ContactsSearchCriteria
- ContactsSearchMeta
- CorePriceSchema
- CountryItem
- CreateJobMessage
- CreateJobParams
- CurrencyItem
- DetailCampaignSchema
- DetailCampaignSchemaAlternativeChannels
- DetailCampaignSchemaAlternativeChannelsSms
- DetailCampaignSchemaAlternativeChannelsStatistics
- DomainStoreRequest
- DomainUpdateRequest
- EmailResponse
- GetInternal2faAuthenticationsFullPrice200Response
- GetInternalCorePrices200Response
- GetInternalCorePricesByCountryCode200Response
- GetInternalCountries200Response
- GetInternalCurrencies200Response
- GetInternalWstPrices200Response
- GetInternalWstPricesByCountryCode200Response
- GetMessages200Response
- GroupsTrait
- IndividualMessageData
- Inline
- Language
- LinkStoreRequest
- LinkUpdateRequest
- LoginRequest
- Media
- MessageApiSchema
- MessageApiSchemaAlternativeChannels
- MessageApiSchemaAlternativeChannelsSms
- MessageApiSchemaAlternativeChannelsSmsDetails
- MessageApiSchemaAlternativeChannelsViber
- MessageApiSchemaAlternativeChannelsViberDetails
- MessageInfo
- MessagePriceObject
- MessageResponse
- MessageSource
- MessageStatus
- MessageType
- MessageUniversal
- Meta
- MetaPage
- OperatorSchema
- Options
- OtpChannel
- OtpList200Response
- OtpListResponseData
- OtpMessageStatus
- OtpStatus
- OtpTemplate200Response
- OtpTemplate404Response
- OtpTemplateCreate200Response
- OtpTemplateCreate422Response
- OtpTemplateCreateRequest
- OtpTemplateDelete200Response
- OtpTemplateDelete404Response
- OtpTemplateDelete422Response
- OtpTemplateDeleteResponseData
- OtpTemplateList200Response
- OtpTemplateListResponseData
- OtpTemplateStatus
- Parameter
- Phone
- PhonesTrait
- PostContactsFieldsDeleteRequest
- Rcs
- RcsClickCallback
- RcsMessage
- RcsSend200Response
- RcsSendGroups200Response
- RcsStatusCallback
- Recipients
- ResendOtp200Response
- ResendOtp404Response
- ResendOtp422Response
- SearchCampaignResource
- SearchOperator
- SendEmail
- SendOtp201Response
- SendOtp422Response
- SendOtpRequest
- SendRcsCampaign
- SendRcsCampaignGroups
- SendRcsCampaignGroupsAlternativeChannel
- SendTemplateEmail
- SendViberCampaign
- SendWhatsAppCampaign
- SendWhatsAppCampaignAlternativeChannel
- SenderRequestLegal201Response
- SenderRequestLegalRequest
- SenderRequestLegalSchema
- SenderRequestNatural201Response
- SenderRequestNaturalRequest
- SenderRequestNaturalSchema
- SenderRequestSchema
- SenderRequestStatus
- SenderRequestType
- SenderRequests200Response
- SenderSchema
- Senders200Response
- ShortDomainNotFound
- ShortDomainSlugType
- ShortLink
- ShortLinkStatus
- ShortUrlDomainListSchema
- ShortUrlDomainSchema
- ShortUrlLinkSchema
- ShortUrlsClicks200Response
- ShortUrlsDomain200Response
- ShortUrlsDomainCreate201Response
- ShortUrlsDomainCreate422Response
- ShortUrlsDomainUpdate200Response
- ShortUrlsDomains200Response
- ShortUrlsLink200Response
- ShortUrlsLink404Response
- ShortUrlsLinkCreate201Response
- ShortUrlsLinkDelete422Response
- ShortUrlsLinkStatisticData
- ShortUrlsLinkUpdate200Response
- ShortUrlsLinkUpdate422Response
- ShortUrlsLinks200Response
- Sms
- SmsAltChannel
- SmsCampaignResponse
- SmsSendGroupsRequest
- SmsSendIndividualRequest
- SmsSendRequest
- SmsSendRequestPhonesItem
- SortWay
- StatJobsCreate200Response
- StatJobsCreateRequest
- StatJobsDelete200Response
- StatisticsData
- StatisticsShort
- StatusOtp200Response
- StatusOtp404Response
- StopListCollection
- StopListPaginateSchema
- StoplistAdd200Response
- StoplistAddRequest
- StoplistItems200Response
- StoplistRemoveRequest
- StoplistSearch200Response
- StoplistSearchCriteria
- StoplistSearchField
- StoplistSearchMeta
- StoreContact
- Suggestion
- SuggestionCall
- SuggestionLink
- TariffSchema
- Telegram
- Template
- Text
- TokenSchema
- TooManyRequestsResponse
- TwoFaTemplateResource
- TwoFactorAuthenticationMessagesResource
- TwoFactorAuthenticationSchema
- TwoFactorMessageResource
- VerifyOtp200Response
- VerifyOtp404Response
- VerifyOtp422Response
- VerifyOtpRequest
- Viber
- ViberCampaignResponse
- Voice
- WhatsAppMessage
- WhatsAppMessageAlternativeChannel
- WhatsAppMessageTemplate
- WstPriceSchema
Authorization
Authentication schemes defined for the API:
ExternalAuth
- Type: Bearer authentication (JWT)
InternalAuth
- Type: Bearer authentication (JWT)
Tests
To run the tests, use:
composer install vendor/bin/phpunit
Author
About this package
This PHP package is automatically generated by the OpenAPI Generator project:
- API version:
2.0- Generator version:
7.12.0
- Generator version:
- Build package:
org.openapitools.codegen.languages.PhpClientCodegen