PHPackages                             socheatsok78/manychat-block-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. socheatsok78/manychat-block-sdk

AbandonedArchivedLibrary[API Development](/categories/api)

socheatsok78/manychat-block-sdk
===============================

ManyChat Block SDK (Unofficial)

v1.0.9(6y ago)104.4k3[1 PRs](https://github.com/socheatsok78/manychat-block-sdk/pulls)MITPHP

Since Dec 22Pushed 2y agoCompare

[ Source](https://github.com/socheatsok78/manychat-block-sdk)[ Packagist](https://packagist.org/packages/socheatsok78/manychat-block-sdk)[ Docs](https://socheatsok78.github.io/manychat-block-sdk)[ RSS](/packages/socheatsok78-manychat-block-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (12)Used By (0)

[![Dynamic Content Block](resources/dynamic-content-block.png)](resources/dynamic-content-block.png)

ManyChat Block SDK (:warning: Unofficial)
=========================================

[](#manychat-block-sdk-warning-unofficial)

Send any message block, like text, gallery, list and others. Attach buttons with custom payloads to continue interaction.

Trigger actions in ManyChat, like tagging a user, setting a Custom Field or notifying an admin.

### ⚠️ This is an Unofficial SDK, Use at your own risk!

[](#warning-this-is-an-unofficial-sdk-use-at-your-own-risk)

[![packagist](https://camo.githubusercontent.com/66d189da3091e8ce18074307ffa914f76db2f00cd874436a9b27c5a8bc168dee/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736f6368656174736f6b37382f6d616e79636861742d626c6f636b2d73646b)](https://packagist.org/packages/socheatsok78/manychat-block-sdk)[![packagist](https://camo.githubusercontent.com/f435e4c0fd7bb9fdae614f5f6126afdbf29b281be5b7dd8ccb971f31ae8691c9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f736f6368656174736f6b37382f6d616e79636861742d626c6f636b2d73646b)](https://packagist.org/packages/socheatsok78/manychat-block-sdk)[![license](https://camo.githubusercontent.com/59849abef523dc687df5663a1045c4aef0007568fa965e933217fd7ce7ff5fa4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f736f6368656174736f6b37382f6d616e79636861742d626c6f636b2d73646b)](LICENSE)

#### Example code:

[](#example-code)

```
namespace App\Http\Controllers\Flow;

use ManyChat\Dynamic\Chat;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class WelcomeMessage extends Controller
{
    /**
     * Handle the incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function __invoke(Request $request)
    {
        $chat = new Chat();

        $text = new Text('Welcome to ManyChat Dynamic Response');
        $chat->reply($text);

        return $chat;
    }
}
```

#### Example response:

[](#example-response)

```
{
    "version": "v2",
    "content": {
        "messages": [
            {
                "type": "text",
                "text": "Welcome to ManyChat Dynamic Response"
            }
        ],
        "actions": [],
        "quick_replies": []
    }
}
```

Installation
============

[](#installation)

Require `socheatsok78/manychat-block-sdk` package to your project

```
composer require socheatsok78/manychat-block-sdk
```

or edit `composer.json`

```
{
    "require": {
        "socheatsok78/manychat-block-sdk": "^1.0"
    },
}
```

Check [latest release here](https://github.com/socheatsok78/manychat-block-sdk/releases/latest). See [CHANGELOG.md](CHANGELOG.md) for release notes.

Contents
========

[](#contents)

- [Messages](#Messages)
- [Attachments](#Attachments)
- [Buttons](#Buttons)
- [Actions](#Actions)
- [Quick Reply](#Quick-Reply)
- [Dynamic Block](#Dynamic-Block)
- [External Callback](#External-Callback)

### Additional Documents

[](#additional-documents)

- [docs](docs/README.md)
- [laravel](docs/Laravel.md)

### 🚨 Limitations

[](#rotating_light-limitations)

Dynamic block has a limit to have not more than 10 messages in messages block, 11 quick replies and 5 actions.

TypeLimitMessages10Actions5Quick Replies11Buttons3Messages
--------

[](#messages)

Create a message block like Text, List or Card.

> Note: A message can add up to 3 `Button` block, any thing more than that `ManyChat` will not show your response

### Text

[](#text)

Create a `Text` message block for sending text messages.

The `Url`, `Flow`, `Node` and `Call` buttons can be used with `Text` block.

```
use ManyChat\Dynamic\Messages\Text;

$text = new Text('Example text message');

# or

$text = Text::create('Example text message');
```

### List

[](#list)

Create a list message block, a set of items vertically. There are two types of list `CompactList` and `LargeList`.

- `CompactList` renders each item identically and is useful for presenting a list of items where no item is shown prominently.
- `LargeList` renders the first item with a cover image with text overlaid

The `Url`, `Flow`, `Node`, `Call` and `Buy` buttons can be used with `List` block.

> Note: We strongly suggest to use HTTPS protocol for your URLs

> Warning: ⚠️ Vertical List will be deprecated by Facebook and will be rendered as a `Card`

```
use ManyChat\Dynamic\Messages\Element;
use ManyChat\Dynamic\Messages\LargeList;
use ManyChat\Dynamic\Messages\CompactList;

# You need to create at lease 2 Element block
$element_1 = new Element([/* ... */]);
$element_2 = new Element([/* ... */]);

$compactList = new CompactList([$element_1, $element_2]);
$largeList = new LargeList([$element_1, $element_2]);
```

### Card

[](#card)

Create a horizontal scrollable gallery. There are two types of card `SquareCard` and `HorizontalCard`.

The `Url`, `Flow`, `Node`, `Call` and `Buy` buttons can be used with `Card` block.

> Note: We strongly suggest to use HTTPS protocol for your URLs

```
use ManyChat\Dynamic\Messages\Element;
use ManyChat\Dynamic\Messages\SquareCard;
use ManyChat\Dynamic\Messages\HorizontalCard;

# You need to create at lease 2 Element block
$element_1 = new Element([/* ... */]);
$element_2 = new Element([/* ... */]);

$horizontalCard = new HorizontalCard([$element_1, $element_2]);
$squareCard = new SquareCard([$element_1, $element_2]);
```

### Element

[](#element)

Create a element block. It can only be used on `List` or `Card` block.

The `Call`, `Url`, `Buy`, `Node` and `Flow` buttons can be used with `Element` block.

> Note: We strongly suggest to use HTTPS protocol for your URLs

```
use ManyChat\Dynamic\Messages\Element;

$element = new Element();
$element->title = 'Unsplash';
$element->subTitle = 'Photos for everyone';
$element->imageUrl = 'https://source.unsplash.com/random';
$element->actionUrl = 'https://unsplash.com';

# or

$element = new Element([
    'title' => 'Unsplash',
    'subTitle' => 'Photos for everyone',
    'imageUrl' => 'https://source.unsplash.com/random',
    'actionUrl' => 'https://unsplash.com',
]);
```

Attachments
-----------

[](#attachments)

Create a attachment block like File, Image, Audio and Video.

### File

[](#file)

Create a file block to send any other files, which are no larger than 25 MB.

> Note: We strongly suggest to use HTTPS protocol for your URLs

```
use ManyChat\Dynamic\Attachments\File;

$file = new File('/* URL to the file */');

# or

$file = File::url('/* URL to the file */');
```

### Image

[](#image)

Create an image block to send an image. `Image` supports JPG, PNG and GIF images.

The `Call`, `Url`, `Buy`, `Node` and `Flow` buttons can be used with `Element` block.

> Note: We strongly suggest to use HTTPS protocol for your URLs

```
use ManyChat\Dynamic\Attachments\Image;

$image = new Image('https://source.unsplash.com/random');

# or

$image = Image::url('https://source.unsplash.com/random');
```

### Audio

[](#audio)

Create an audio block send audio files, which are no larger than 25 MB.

The `Call`, `Url`, `Buy`, `Node` and `Flow` buttons can be used with `Element` block.

> Note: We strongly suggest to use HTTPS protocol for your URLs

```
use ManyChat\Dynamic\Attachments\Audio;

$audio = new Audio('/* URL to the audio file */');

# or

$audio = Audio::url('/* URL to the audio file */');
```

### Video

[](#video)

Create an video block send video files, which are no larger than 25 MB.

The `Call`, `Url`, `Buy`, `Node` and `Flow` buttons can be used with `Element` block.

> Note: We strongly suggest to use HTTPS protocol for your URLs

```
use ManyChat\Dynamic\Attachments\Video;

$video = new Video('/* URL to the video file */');

# or

$video = Video::url('/* URL to the video file */');
```

Buttons
-------

[](#buttons)

Create a button block like `Call`, `Url`, `Buy`, `Node` and `Flow`.

You can provide custom `Action` to be performed with the button. `Actions` can be attached to `Url`, `Flow` and `Node` button types.

### Call

[](#call)

Create a call button block.

```
use ManyChat\Dynamic\Buttons\Call;

$call = new Call('+123456789');

# or

$call = Call::phone('+123456789');
```

### Url

[](#url)

Create a url button block.

> Note: We strongly suggest to use HTTPS protocol for your URLs

```
use ManyChat\Dynamic\Buttons\Url;

$url = new Url('https://example.com');

# or

$url = Url::create('https://example.com');
```

`Url` has 3 style options:

```
use ManyChat\Dynamic\Buttons\Url;

$url = new Url('https://example.com');

$url->full()     # 100 %, Default
    ->medium()   # 75 %
    ->compact(); # 50 %
```

### Buy

[](#buy)

Create a buy button block.

```
use ManyChat\Dynamic\Buttons\Buy;

$buy = new Buy('T-Shirt', 2000);

# or

$buy = Buy::create('T-Shirt', 2000);
```

You can configure the `Buy` button payment option check the code below.

```
use ManyChat\Dynamic\Buttons\Buy;
use ManyChat\Dynamic\Foundation\Customer;
use ManyChat\Dynamic\Foundation\Product;

$buy = new Buy();

# Update Product name and price
$buy->withProduct(function (Product $product) {
    $product->name = 'T-Shirt';
    $product->price = 2000;
});

# Update Customer requirement
$buy->withCustomer(function (Customer $customer) {
    $customer->withContactName()    # Require contact name
        ->withContactPhone()        # Require contact phone
        ->withShippingAddress();    # Require shipping address

    # or

    $customer->withoutContactName()    # Not require contact name
        ->withoutContactPhone()        # Not require contact phone
        ->withoutShippingAddress();    # Not require shipping address
});
```

### Node

[](#node)

Create a node button block to link with existing flow.

Node name can be found in its header, you need to use unique name for node connected with link. If there are multiple nodes with similar names inside of the same flow, transition behaviour would not meet expectations.

```
use ManyChat\Dynamic\Buttons\Node;

$node = new Node('Welcome Message');

# or

$node = Node::create('Welcome Message');
```

### Flow

[](#flow)

Create a flow button block. `Flow` block are like `Node` block, but `Flow` uses `id` of a `Node` or `Flow`.

The `id` can be found in the address bar when you're editing the node/flow.

```
use ManyChat\Dynamic\Buttons\Flow;

$flow = new Flow('content20180221085508_278589');

# or

$flow = Flow::create('content20180221085508_278589');
```

Example node/flow url:

```
# URL: https://manychat.com/fb152631685162536/cms/files/content20191211074127_716888

The `content20191211074127_716888` is the `id` of the node/flow.

```

Actions
-------

[](#actions)

You can attach actions to `Chat`, `Message`, `Attachment` or `Button` object.

There are only 2 type of actions `Tag` and `Custom Field`.

> Note: The `$object` can be `Chat`, `Message`, `Attachment` or `Button` object.

### Add Tag

[](#add-tag)

Add a tag to a subscriber

```
$object->addTag('tag_name');

# or add multiple tags

$object->addTags(['tag_1', 'tag_2']);
```

### Remove Tag

[](#remove-tag)

Remove a tag from a subscriber

```
$object->removeTag('tag_name');

# or remove multiple tags

$object->removeTags(['tag_1', 'tag_2']);
```

### Add Custom Field

[](#add-custom-field)

Add a custom field to a subscriber

```
$object->addField('Example_Field_1', 'value');

# or add multiple custom fields

$object->addFields([
    'Example_Field_1' => 'value',
    'Example_Field_2' => 'value'
]);
```

### Remove Custom Field

[](#remove-custom-field)

Remove a custom field from a subscriber

```
$object->removeField('Example_Field_1');

# or add multiple custom fields

$object->removeFields(['Example_Field_1', 'Example_Field_2']);
```

Quick Reply
-----------

[](#quick-reply)

Create a quick reply block. Quick Reply can only be attached to `Chat` object.

The `Node`, `Flow` buttons and `DynamicBlock` callback can be used with Quick Reply block.

```
use ManyChat\Dynamic\Chat;
use ManyChat\Dynamic\Buttons\Node;
use ManyChat\Dynamic\Buttons\Flow;

$chat = new Chat();

$node = new Node('Welcome Message');
$flow = new Flow('content20180221085508_278589');
$dynamic = new DynamicBlock('https://example.com/api');

$chat->quickReply($node);
$chat->quickReply($flow);
$chat->quickReply($dynamic);
```

Dynamic Block
-------------

[](#dynamic-block)

Create a Dynamic Block callback.

> Note: We strongly suggest to use HTTPS protocol for your URLs

```
use ManyChat\Dynamic\Callback\DynamicBlock;

$dynamic = new DynamicBlock('https://example.com/api');

# Set Block caption
$dynamic->setCaption('Custom Caption');

# Add HTTP request header
$dynamic->setHeader('x-header', 'value');
$dynamic->setHeaders([
    'x-header-2' => 'value',
    'x-header-2' => 'value'
]);

# Add HTTP request payload
$dynamic->setPayload('key', 'value');
$dynamic->setPayloads([
    'key-1' => 'value',
    'key-2' => 'value'
]);
```

External Callback
-----------------

[](#external-callback)

You can ask ManyChat to handle the next subscriber’s message on your side by using the `ExternalCallback` block.

> Note: Only one callback can be attached to `Chat` object.

```
use ManyChat\Dynamic\Chat;
use ManyChat\Dynamic\Callback\ExternalCallback;

$chat = new Chat();

$external = new ExternalCallback('https://example.com/api/flow/2');

# Add HTTP request header
$external->setHeader('x-header', 'value');
$external->setHeaders([
    'x-header-2' => 'value',
    'x-header-2' => 'value'
]);

# Add HTTP request payload
$external->setPayload('key', 'value');
$external->setPayloads([
    'key-1' => 'value',
    'key-2' => 'value'
]);

$chat->callback($external);
```

Trademark
---------

[](#trademark)

Logos, service marks and trade names are trademark of [ManyChat, Inc](https://manychat.com/).

- [Term of Service](https://manychat.com/tos.html)
- [Privacy Policy](https://manychat.com/privacy.html)

### License

[](#license)

This package is an **Unofficial SDK** licensed under the [MIT](LICENSE)

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 99.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

10

Last Release

2329d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f6f294614f49c98b77a879110c64f4e72df9095dbf1549d0c7eae8b913aead33?d=identicon)[socheatsok78](/maintainers/socheatsok78)

---

Top Contributors

[![socheatsok78](https://avatars.githubusercontent.com/u/4363857?v=4)](https://github.com/socheatsok78 "socheatsok78 (170 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

dynamic-content-blockmanychatmanychat-sdklibrarymanychatmanychat-sdkdynamic-content-blockfacebook-messenger-platform

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/socheatsok78-manychat-block-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/socheatsok78-manychat-block-sdk/health.svg)](https://phpackages.com/packages/socheatsok78-manychat-block-sdk)
```

###  Alternatives

[nunomaduro/pokio

Pokio is a dead simple asynchronous API for PHP that just works

711867.2k4](/packages/nunomaduro-pokio)[temporal/sdk

Temporal SDK

4002.2M18](/packages/temporal-sdk)[alibabacloud/client

Alibaba Cloud Client for PHP - Use Alibaba Cloud in your PHP project

2223.5M367](/packages/alibabacloud-client)[gusapi/gusapi

Gus Api Library for PHP

1351.5M8](/packages/gusapi-gusapi)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

553.3M7](/packages/checkout-checkout-sdk-php)[chriskonnertz/deeply

DeepLy is a PHP client for the DeepL.com translation API

230116.2k8](/packages/chriskonnertz-deeply)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
