Unable to Send Tweet, 403 Forbidden

Describe the problem/error/question

My X account was migrated to the new Pay to Use tier and given the $10 credit, once that’s run out though it stopped posting. I added some more credit and that didn’t fix it either.

I’ve a new app in X Dev as suggested, made sure it has write access and given the new credentials to the X credentials in N8N.

I can auth the app, but whenever I try and send the tweet I get 403 forbidden errors.

Information on your n8n setup

  • n8n version: 2.18.7
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker, behind Traefik
  • Operating system: Ubuntu 24

@Stuart_Grimshaw Can you share the full 403 error or a screenshot of the 403 error, to see if it has any additional details we can use to help diagnose your case?

This is the error from the X api:

`
{ “detail”: “You are not permitted to perform this action.”, “type”: “about:blank”, “title”: “Forbidden”, “status”: 403 }`

and the full stack trace from the same error:

NodeApiError: Forbidden - perhaps check your credentials?
at ExecuteContext.twitterApiRequest (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@aws-sdk+credential-providers@3.808.0_asn1.js@5_8da18263ca0574b0db58d4fefd8173ce/node_modules/n8n-nodes-base/nodes/Twitter/V2/GenericFunctions.ts:56:9) at processTicksAndRejections (node:internal/process/task_queues:104:5) 
at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@aws-sdk+credential-providers@3.808.0_asn1.js@5_8da18263ca0574b0db58d4fefd8173ce/node_modules/n8n-nodes-base/nodes/Twitter/V2/TwitterV2.node.ts:237:22) at WorkflowExecute.executeNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+exporter-trace-otlp_d301200d8c5446bebb311523c3c1b485/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1048:9) at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+exporter-trace-otlp_d301200d8c5446bebb311523c3c1b485/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1239:11) 
at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+exporter-trace-otlp_d301200d8c5446bebb311523c3c1b485/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1687:27 
at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+exporter-trace-otlp_d301200d8c5446bebb311523c3c1b485/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:2339:11

welcome to the n8n community @Stuart_Grimshaw
I would recreate the n8n X OAuth2 credential after confirming the X app is set to Read and write and that the current X developer tier allows posting through the API, since n8n’s X node V2 uses OAuth2 and X enforces plan and endpoint limits outside n8n.

الخطأ 403 المحدد الذي تراه (“لا تملك صلاحية لتنفيذ هذا الإجراء”) بعد هجرة المستوى مباشرة هو في الغالب الأعم مشكلة في النطاق وليس في الفواتير، وله سبب خفي: تغيير صلاحيات التطبيق في بوابة المطورين لا يحدّث الرموز التي تم إصدارها بالفعل. إذا تمت المصادقة عبر OAuth قبل تبديل التطبيق إلى القراءة والكتابة، فإن رمز الوصول الذي يحتفظ به n8n لا يزال يحمل نطاقات للقراءة فقط، و X يُرجع بالضبط هذا الخطأ 403 على POST /2/tweets. إضافة رصيد لا تؤثر على ذلك، وهو ما يتطابق مع ما رأيته.

التسلسل الذي يصلحه:

  1. في بوابة X للمطورين، تأكد من أن التطبيق يقع داخل مشروع (التطبيقات المستقلة تحصل على 403s على نقاط نهاية v2 بغض النظر عن الصلاحيات)، وأن إعدادات مصادقة المستخدم تُظهر القراءة والكتابة مع نوع التطبيق Web App.
  2. بعد أي تغيير في الصلاحيات، انقر على Regenerate على المفاتيح والرموز. هذه هي الخطوة التي تُبطّل بالفعل النطاقات القديمة.
  3. في n8n، لا تعدّل بيانات الاعتماد القديمة. احذفها، أنشئ بيانات اعتماد X OAuth2 جديدة باستخدام معرف العميل والسر المعاد إنشاؤهما، وشغّل تدفق OAuth مرة أخرى.
  4. على شاشة الموافقة، اقرأ الصلاحيات المدرجة. إذا لم يكن “نشر وحذف المنشورات الخاصة بك” في القائمة، فإن نطاق الكتابة لا يزال لم يتم طلبه والإعداد في الخطوة 1 لم يتم حفظه.

غريبة أخرى تستحق المعرفة حول نموذج الدفع لكل استخدام: القراءات والكتابات يتم محاسبتها بشكل منفصل لكل طلب، لذا فإن عقدة القراءة التي تعمل تثبت أن الفواتير بخير لكنها لا تقول شيئاً عن تفويض الكتابة. فحص شاشة الموافقة في الخطوة 4 هو الدليل الموثوق.