/sendbee-php-api-client

PHP client SDK for Sendbee Public API

Primary LanguagePHPMIT LicenseMIT

Sendbee PHP API Client


                .' '.            __
       .        .   .           (__\_
        .         .         . -{{_(|8)
          ' .  . ' ' .  . '     (__/

Table of contents

Contacts

Contact Tags

Contact Fields

Messages

Automation

Mics

Installation

Usage

Initialization

Fetch contacts

Subscribe contact

Update contact

Fetch tags

Create tag

Update tag

Update tag

Fetch contact fields

Create contact field

Update contact field

Delete contact field

Fetch message templates

Send template message

Send message

You can send either text message or media message.
For media message, following formats are supported:
Audio: AAC, M4A, AMR, MP3, OGG OPUS
video: MP4, 3GPP
Image: JPG/JPEG, PNG
Documents: PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX

Toggle bot for conversation with contact on off

Every contact is linked with conversation with an agent.
Conversation could be handled by an agent or a bot (automation).
Every time a message has been sent to a contact by an agent or using the API, the bot is automatically turned off for that conversation.
But there is always a use case when you need to turn it on or off manually.

Exception handling

Every time something is not as it should be, like parameter is missing, parameter value is invalid, authentication fails, etc, API returns a http status code accordingly and an error message.
By using this client library, an error message is detected and taken, and an exception is raised, so you can handle it like this:

Authenticate webhook request

After activating your webhook URL in Sendbee Dashboard, we will start sending requests on that URL depending on which webhook type is linked with that webhook URL.
Every request that we make will have authorization token in header, like this:

{
    ...
    'X-Authorization': '__auth_token_here__',
    ...
}

To authenticate requests that we make to your webhook URL, take this token from request header and check it using Sendbee API Client:

Warnings

Sometimes APi returns a worning so you could be warned about something.
The waning is displayed in standard output:

Debugging

Debugging

This library has it's own internal debugging tool.
By default it is disabled, and to enable it, pass the debug parameter:

Once you enabled the internal debug tool, every request to API will output various request and response data in standard output:

Debugging