Inserting A Campaign Record to Salesforce via HTTP Request not working

Trying To Insert A campaign record to salesforce via HTTP, not getting an error but no record is created,

this is my setting:

Method
POST
URL
https://(HIDDEN ON PURPOSE..) .force.com/services/data/v58.0/sobjects/Campaign/
Authentication
Predefined Credential Type
Credential Type
Salesforce OAuth2 API
2 scopes available for Salesforce credentials
Salesforce OAuth2 API
Salesforce account
Send Query Parameters

Send Headers

Specify Headers
Using Fields Below
Header Parameters
Name
Content-Type
Value
application/json
Send Body

Body Content Type
Raw
Content Type
JSON
Body
{ “Name”: “Test Campaign Raw Body” }
Options

any ideas?

Hello @mvahav,
welcome to the community!

since you’re not getting an error but no record is createdhere are a few things to double-check:

  1. Check JSON body formatting
    Your body contains this:
{ “Name”: “Test Campaign Raw Body” }

This uses curly quotes ( and ) which are invalid in JSON. Replace them with straight quotes:

{ "Name": "Test Campaign Raw Body" }

Suggest to check the JSON with https://codebeautify.org/jsonviewer, it would be useful

  1. Ensure the Salesforce Object API name is correct, check and confirm your Salesforce org has access to that object and your user/credentials have the Create permission on Campaign

  2. Check OAuth2 credential scope and connection. Make sure your Salesforce OAuth2 credentials are correctly connected.

  3. You can have a check on the HTTP status code: create a Code Node after the HTTP REQUEST

return [
  {
    json: {
      body: $json,
      statusCode: $item().context.response?.statusCode || 'N/A',
      headers: $item().context.response?.headers || {}
    }
  }
];

This shows you bodies, statusCodes and headers in a single object, useful for understanding any silent problems.

thanks!

i tried " [ “Name”: “Test Campaign Raw Body” ]" , and my connection is stable since i tried a get and it worked, the HTTP status code just returns NA,

what can i do next?

Hello!

Try to use:

{ "Name": "Test Campaign Raw Body" }

With {} and not “[” “]”

Avoid smart quotes ( / ), they’ll silently break the request.

If n8n returns "statusCode": "N/A" in your debug node, it usually means:

  • The HTTP Request was never sent, likely due to malformed input (e.g. invalid JSON)
  • Or an exception occurred before a response could be parsed

In short: Salesforce didn’t reject the request, it probably never received it properly.

So let’s try:

  • double check your raw JSON body
  • enable debugging by adding a Code node after the request:
return [
  {
    json: {
      body: $json,
      statusCode: $item().context.response?.statusCode || 'N/A',
      headers: $item().context.response?.headers || {}
    }
  }
];


the code you gave me through an error and the ai in the platform offered this instead:

return $input.all().map(item => ({
json: {
body: item.json,
statusCode: item.context?.response?.statusCode ?? ‘N/A’,
headers: item.context?.response?.headers ?? {}
}
}));

what are your thoughts? still not inserting..

@Gallo_AIA any thoughts?