Publishing to real platforms
How publishing works, what Test Mode does, and how to go live.
Who publishes#
Three things can publish a post. They all end the same way: the post becomes Published or Failed.
| Publisher | When | Notes |
|---|---|---|
| The scheduled action | Every 15 minutes | Publishes every Scheduled post whose date has passed. |
| Publish Now | When someone presses it | For draft, scheduled or failed posts. |
| n8n | On its own timer | An alternative to the scheduled action. See Auto-publish workflow. |
What happens on publish#
For each post the module calls the account's _api_publish() method.
- Success: the post becomes Published, Published Date is set to now, and any earlier error is cleared.
- An exception: the post becomes Failed and the error text is stored in Error Message. The exception is logged with its traceback on the server. One failing post never stops the others.
- Already-published posts are skipped.
Test Mode: simulated publishing#
By default every account has Test Mode on. _api_publish() then does nothing except log that it simulated a publish, and returns success. No platform is contacted.
Going live#
The module ships no built-in platform API clients. Outside Test Mode, _api_publish() raises NotImplementedError as a placeholder. You have two ways to publish for real.
Option 1: n8n (recommended)#
Leave the accounts in Test Mode, deactivate the module's scheduled action, and let n8n publish. n8n calls each platform's API using its own credential store and reports the result back. Tokens stay in n8n rather than in Odoo. See n8n overview.
Option 2: implement _api_publish()#
Write a small extension module that overrides social.media.account._api_publish() for your platforms:
from odoo import models
class SocialMediaAccount(models.Model):
_inherit = 'social.media.account'
def _api_publish(self, post):
self.ensure_one()
if self.test_mode or self.platform != 'facebook':
return super()._api_publish(post)
# Call the Facebook API with self.access_token and post.message here.
# Raise an exception on failure: the post will be marked Failed.
return True
Then, for each account you want live: turn Test Mode off and enter the API Access Token.
Warning
Turning Test Mode off on an account with no live integration makes every publish on it fail. That is deliberate: a simulated success on a real account would tell your team a post went out when it did not.
The scheduled action#
Settings → Technical → Automation → Scheduled Actions → "Social Media Marketing: Publish Scheduled Posts" runs every 15 minutes and is active by default. It selects posts with state Scheduled and a scheduled date at or before now, and publishes them.
Important
If you use the n8n auto-publish workflow, deactivate this action. Otherwise both will race to publish the same due post.
Publish Now is not gated#
Note that Publish Now is available to every user of the module, not only Managers, and that it works on draft posts. See the caution in Compose and manage posts. For approval that is enforced before anything goes out, see the AI Workforce publishing gate.