Skip to content

docs: FAQ for 400 error when resuming a flow via API#646

Open
SangeetaMishr wants to merge 1 commit into
mainfrom
docs/faq-flow-resume-400-error
Open

docs: FAQ for 400 error when resuming a flow via API#646
SangeetaMishr wants to merge 1 commit into
mainfrom
docs/faq-flow-resume-400-error

Conversation

@SangeetaMishr

@SangeetaMishr SangeetaMishr commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a FAQ entry explaining why calling resumeContactFlow (used to resume a flow paused at a "Wait for Results" node) can return an HTTP 400.
  • Root cause traced in the glific/glific backend: the result argument is typed Json, and Glific's custom Json scalar only parses a JSON-encoded string (see parse(&decode_json/1) in generic_types.ex, which only handles Input.String/Input.Null). Passing a raw JSON object fails GraphQL validation and Absinthe returns a 400, distinct from application-level errors which come back as 200 with an errors array.
  • Includes an incorrect vs. correct example (inline query and variables form) plus a checklist of other things to check for a genuine 400.

Closes #322

Test plan

  • Rendered the markdown locally to confirm formatting/code blocks are correct
  • Verified the file is picked up by the autogenerated FAQ sidebar (no manual sidebar entry needed)
  • Reviewer to confirm this matches the root cause reported in the linked Discord thread (not accessible to me)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Added guidance for resolving HTTP 400 errors when resuming a flow through the API.
    • Clarified the expected request format, including how to pass JSON data correctly.
    • Included examples of incorrect vs. correct GraphQL request usage and when to expect HTTP 400 vs. application-level errors.

Closes #322. Explains that resumeContactFlow's `result`
argument must be a JSON-encoded string (not a raw object) since
Glific's Json scalar only parses string/null literals, with a
working example and other things to check for a genuine 400.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This pull request adds a new FAQ documentation page explaining why the GraphQL resumeContactFlow mutation can return an HTTP 400 error when resuming flows that use the Wait for Results node. The page describes the root cause (the result argument requiring a JSON-encoded string rather than a raw object), provides example incorrect and correct mutation usage, and includes guidance on request formatting and distinguishing HTTP 400 errors from application-level errors.

Changes

File Change Summary
docs/8. FAQ/Resolving 400 Error When Resuming a Flow via API.md New FAQ page added explaining the 400 error cause, correct GraphQL mutation formatting, and troubleshooting guidance

Related Issues: None specified.

Related PRs: None specified.

Suggested labels: documentation

Suggested reviewers: None specified.


Poem:
A rabbit hopped through JSON's maze,
Found a string where objects laze,
"Wrap your result," it softly said,
"Or 400 errors fill your head!"
Now docs are clear, the fix is penned. 🐰📄

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR adds the requested FAQ entry for #322 and explains the 400 error when resuming a flow via API.
Out of Scope Changes check ✅ Passed The changes appear limited to the requested FAQ documentation and do not introduce unrelated scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly matches the change: adding a FAQ entry about a 400 error when resuming a flow via API.
Description check ✅ Passed The description accurately describes the FAQ addition, root cause, examples, and validation notes for the 400 error.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

@github-actions github-actions Bot temporarily deployed to pull request July 6, 2026 06:56 Inactive

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/8`. FAQ/Resolving 400 Error When Resuming a Flow via API.md:
- Line 1: The document title is using a level-2 heading instead of a top-level
heading, which triggers markdownlint MD041 and weakens the hierarchy. Update the
first heading in this FAQ page from the current title to an H1 so the document
starts with a single top-level heading and remains consistent with the rest of
the docs structure.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3e031cf2-7889-4df4-8e3d-595a366d7644

📥 Commits

Reviewing files that changed from the base of the PR and between af69d32 and 5e29e84.

📒 Files selected for processing (1)
  • docs/8. FAQ/Resolving 400 Error When Resuming a Flow via API.md

@@ -0,0 +1,63 @@
## Why do I get a 400 error when resuming a flow via API?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Promote the page title to an H1.

This file starts with ##, which trips markdownlint MD041 and weakens the document hierarchy. Use a top-level heading instead.

Suggested fix
-## Why do I get a 400 error when resuming a flow via API?
+# Why do I get a 400 error when resuming a flow via API?
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## Why do I get a 400 error when resuming a flow via API?
# Why do I get a 400 error when resuming a flow via API?
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 1-1: First line in a file should be a top-level heading

(MD041, first-line-heading, first-line-h1)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/8`. FAQ/Resolving 400 Error When Resuming a Flow via API.md at line 1,
The document title is using a level-2 heading instead of a top-level heading,
which triggers markdownlint MD041 and weakens the hierarchy. Update the first
heading in this FAQ page from the current title to an H1 so the document starts
with a single top-level heading and remains consistent with the rest of the docs
structure.

Source: Linters/SAST tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FAQ - Handling 400 Error When Resuming a Glific Flow via API

2 participants