iqual / iq_contentbird_api
Provides integration with the contentbird Integration API for content management, publishing workflows, and webhook events.
Package info
github.com/iqual-ch/iq_contentbird_api
Type:drupal-module
pkg:composer/iqual/iq_contentbird_api
Requires
- php: >=8.3
- drupal/core: ^11
- guzzlehttp/guzzle: ^7.0
This package is auto-updated.
Last update: 2026-03-05 15:12:56 UTC
README
Drupal 11 module providing integration with the contentbird Integration API.
This module provides a configurable API client service and webhook endpoint to interface between Drupal and the contentbird content management platform.
Features
-
API Token Authentication: Secure communication via the
X-ContentbirdApiTokenheader. -
Admin Settings Form: Configure API token, base URL, and endpoints at
admin/config/services/iq_contentbird_api. -
API Client Service: Injectable service (
iq_contentbird_api.client) for communicating with contentbird:- Fetch content statuses, custom elements, and custom fields (Utils).
- Create, fetch, and update content items.
- Update content status (e.g., "CMS imported", "Published").
- Create social posts.
-
Webhook Endpoint: Receives push events from contentbird at
/iq_contentbird_api/webhook. -
Event System: Dispatches
ContentbirdWebhookEventso other modules can subscribe and react to webhook events.
Requirements
- Drupal 11
- PHP 8.3+
- Guzzle HTTP client (included with Drupal core)
Installation
- Install the module via Composer
composer require iqual/iq_contentbird_api - Enable the module:
drush en iq_contentbird_api - Navigate to Admin > Configuration > Web services > Contentbird API Settings.
- Enter your contentbird API token (generated under Setup > System > Integrations > Api authentication in contentbird).
- Verify the connection status shows as "Connected successfully".
Configuration
API Token
Generate an API token in contentbird under Setup > System > Integrations > Api authentication and paste it into the Drupal settings form.
Webhook Setup
- Note the webhook URL shown on the settings page (e.g.,
https://your-site.com/iq_contentbird_api/webhook). - Configure this URL in your contentbird webhook settings.
- Optionally set a webhook secret for payload signature verification.
Usage
Using the API Client Service
Inject the service iq_contentbird_api.client in your custom code:
// In a controller or service using dependency injection:
public function __construct(
private ContentbirdApiClientInterface $contentbirdClient,
) {}
// Fetch list ids.
$list_ids = $this->contentbirdClient->getListOfIds();
// Fetch a single content item.
$content = $this->contentbirdClient->getContent(12345);
// Update content status to a published status (status ID from getListOfIds()).
$this->contentbirdClient->updateStatusPublishedContent(
content_id: 12345,
status_id: 3,
published_url: 'https://your-site.com/node/42',
);
// Create a social post.
$this->contentbirdClient->createSocialPost([
'contentId' => 12345,
'text' => 'Check out our new article!',
]);
Subscribing to Webhook Events
Create an event subscriber in your module:
namespace Drupal\my_module\EventSubscriber;
use Drupal\iq_contentbird_api\Event\ContentbirdWebhookEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class ContentbirdWebhookSubscriber implements EventSubscriberInterface {
public static function getSubscribedEvents() {
return [
ContentbirdWebhookEvent::WEBHOOK_RECEIVED => 'onWebhookReceived',
];
}
public function onWebhookReceived(ContentbirdWebhookEvent $event) {
$data = $event->getData();
$eventType = $event->getEventType();
// Process the webhook data, e.g., create/update Drupal nodes.
}
}
Register the subscriber in your module's services YAML file:
services:
my_module.contentbird_webhook_subscriber:
class: Drupal\my_module\EventSubscriber\ContentbirdWebhookSubscriber
tags:
- { name: event_subscriber }
Typical Integration Workflow
- Content is created and approved in contentbird.
- Contentbird sends a webhook to your Drupal site (or you pull via API).
- Your custom subscriber creates a Drupal node draft with the contentbird content.
- The module updates the contentbird status to "CMS imported".
- When the Drupal node is published, update the contentbird status with the published URL.
API Reference
See the full contentbird Integration API documentation.
License
This project is licensed under the GPL-2.0-or-later license.