{
  "schema_version": "1.0.0",
  "id": "wordpress-post-announce",
  "title": "Announce a new WordPress post on X and in Slack",
  "category": "social",
  "difficulty": "beginner",
  "featured": false,
  "description": "A newly published WordPress post is queued on X at the right length and announced to the team in Slack with the link.",
  "tags": [
    "social",
    "wordpress",
    "buffer",
    "slack",
    "content"
  ],
  "apps": [
    "WordPress",
    "Code by Zapier",
    "Buffer",
    "Slack"
  ],
  "plan": {
    "minimum": "Professional",
    "reasons": [
      "multi-step Zap: 3 steps after the trigger"
    ]
  },
  "tasks": {
    "typical": 3,
    "max": 3
  },
  "trigger": {
    "app": "WordPress",
    "event": "New Post",
    "kind": "polling",
    "title": "New published post",
    "why": "Fires when a post is published (not on drafts).",
    "config": {
      "Post Status": "publish",
      "Post Type": "post"
    },
    "outputs": [
      "post_id",
      "title",
      "excerpt",
      "link",
      "author",
      "categories",
      "date"
    ],
    "sample": "sample-trigger.json"
  },
  "steps": [
    {
      "key": "fit",
      "kind": "code",
      "app": "Code by Zapier",
      "event": "Run JavaScript",
      "title": "Fit the post for X",
      "why": "Uses the excerpt as the summary and the categories as hashtags, trimmed so the whole post fits 280 characters with the link.",
      "code": {
        "language": "javascript",
        "module": "fit-channels",
        "file": "code/fit-channels.js"
      },
      "input_data": {
        "title": "{{trigger.title}}",
        "summary": "{{trigger.excerpt}}",
        "link": "{{trigger.link}}",
        "hashtags": "{{trigger.categories}}"
      },
      "outputs": [
        "linkedin",
        "x",
        "facebook",
        "x_length"
      ]
    },
    {
      "key": "x_post",
      "kind": "action",
      "app": "Buffer",
      "event": "Add to Queue",
      "title": "Queue it on X",
      "why": "Queued, not posted, so the social lead can still adjust it.",
      "fields": {
        "Profile": "YOUR_X_PROFILE",
        "Text": "{{fit.x}}",
        "Shorten Links?": "No",
        "Post Now?": "No"
      },
      "outputs": [
        "id",
        "due_at"
      ]
    },
    {
      "key": "team",
      "kind": "action",
      "app": "Slack",
      "event": "Send Channel Message",
      "title": "Tell the team",
      "why": "Gives sales and support the link the day it is live.",
      "fields": {
        "Channel": "#marketing",
        "Message Text": ":newspaper: New on the blog: *{{trigger.title}}* by {{trigger.author}}\n{{trigger.link}}\nQueued on X ({{fit.x_length}} characters).",
        "Send as a bot?": "Yes",
        "Bot Name": "Zap alerts",
        "Include a link to this Zap?": "No"
      },
      "outputs": [
        "ts",
        "permalink"
      ]
    }
  ]
}
