WooCommerece Trigger to HTTP Request [POST]

I want to send WooCommerce customer details to my Email Service Provider via API (HTTP Request Node)

I’m using the WooCommerce Trigger node to get the order details.

But I want to send FirstName, LastName, and Email address via API.

The problem with my ESP is they keep Email as Primary value and First Name and Last Name to Custom Fields.

Here is the sample code.

"email":"[email protected]",
"customFields":{
    "firstname":"Max"
}

Ref: https://developers.automizy.com/automizyrestapi/#Creatinganewcontactonalist

@RicardoE105 I have tried the below code. But it’s sending whatever the data mentioned as Mock data.

Hey @mcnaveen!
I have created a sample workflow that might help you. One thing to note here is that I have set the JSON/RAW Parameter to true, which allows us write JSON in the Body Paramater.
You will have to replace the Set node with your Woocommerce node, and get the values from there.

{
  "name": "",
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "requestMethod": "POST",
        "url": "https://gateway.automizy.com/v2/smart-lists/1/contacts",
        "jsonParameters": true,
        "options": {
          "bodyContentType": "json"
        },
        "bodyParametersJson": "={\n    \"email\":\"{{$node[\"Set\"].json[\"email\"]}}\",\n    \"customFields\":{\n        \"firstname\":\"{{$node[\"Set\"].json[\"firstname\"]}}\",\n\"lastname\":\"{{$node[\"Set\"].json[\"lastname\"]}}\"\n    }\n}",
        "headerParametersJson": "{\"Authorization\":\"Bearer <YOUR-TOKEN>\"}"
      },
      "name": "HTTP Request1",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        650,
        300
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "email",
              "value": "[email protected]"
            },
            {
              "name": "firstname",
              "value": "Test4"
            },
            {
              "name": "lastname",
              "value": "User"
            }
          ]
        },
        "options": {}
      },
      "name": "Set",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    }
  ],
  "connections": {
    "HTTP Request1": {
      "main": [
        []
      ]
    },
    "Start": {
      "main": [
        [
          {
            "node": "Set",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set": {
      "main": [
        [
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {}
}

Hope this helps! :slightly_smiling_face:

2 Likes

Thanks @harshil1712 This is what I’m exactly looking for.

1 Like

Awesome! I am glad I could help. Have fun! :slightly_smiling_face:

1 Like