Examples webhook to automation studio

I am look for examples of what all of yall smart people have done to create a webhook to automation studio.

I have some methods but my fields do not show in the json payload of automation studio.

What i am trying to do is send some information from kinetic to hubspot when ever the sales order gets update and a data tag is not present. We have been seeing some inconsistanies with data updates due to licenses when we hit the maxium licenses when it has to come back and search for data tag data.

        using (HttpClient client = new HttpClient())
        {
            client.BaseAddress = new Uri("https://webhooks.workato.com/webhooks/rest/053c890d-da7d-47c9-ae83-f79336502a62/updatedealfromsalesorder");
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            // Example of a POST request
            var content = new StringContent("{\"SalesOrder\":\"johndoe\",\"email\":\"johndoe@example.com\",\"age\":30,\"isActive\":true,\"roles\":[\"admin\",\"user\"]}", Encoding.UTF8, "application/json");
            HttpResponseMessage response = client.PostAsync("https://webhooks.workato.com/webhooks/rest/053c890d-da7d-47c9-ae83-f79336502a62/updatedealfromsalesorder",content).Result;

        }

I don’t have one for Automation studio, but I do have a function that I used for MS Teams webhooks using RestSharp:

var webhook = (string)this.EfxLib.Utilities.GetWebhook("MSTEAM","DupeJobs");

string title = "Duplicate Job Alert";
string themeColor = "C51F30";
int responseStatusCodeTeams = 0;

var client = new RestClient(webhook);

var data = new {

  context = "https://schema.org/extensions",
  type = "MessageCard",
  summary = "Incoming Alert Message!",
  themeColor = themeColor,

  markdown = true,
  sections = new [] {
    new {
      
      activityTitle = title,
      activitySubtitle = "Recent scan indicates possible duplicate job in fabrication",
      activityImage = (string)this.EfxLib.Utilities.GetServerImage("LOGO");
      
      facts = new [] {
         new { name = "Job Number"   , value = jobNum                     }
        ,new { name = "Techinician"  , value = techName                   }
        ,new { name = "Operation"    , value = opDesc                     }
        ,new { name = "Prod Quantity", value = prodQty.ToString("#.00")   }
        ,new { name = "Total Scanned", value = scanQty.ToString("#.00")   }
        ,new { name = "Rebuilds"     , value = (rebuildlQty>0? "Yes": "No") }
      }
    }
  }
};
  
var content = JsonConvert.SerializeObject(data);
  

//_Begin Create REST Request

var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/json");
request.AddJsonBody(content);
 
var response = client.Execute(request);
responseStatusCodeTeams = (int)response.StatusCode;

//_End Execute REST Request
2 Likes

Why aren’t you invokingt he workato recipe directly fromthe Epicor Function / BPM?

3 Likes

I have not been able to get that working or i dont know how to do it that way. if someone has a document or can point me to one that would be magnicifient.

You can’t use this little fella?
undefined

2 Likes

That little fella is giving me some grief i may need some examples on how to setup an endpoint it is taking some time but i am figuring it out. Thanks for the suggestion.

Getting an error saying signature is not supported.

You have to make sure your workato is connected to your Epicor instance. In here, then it should be setup.

I have it setup there and have it working in a update BPM but getting an error message saying my signature is invalid.

image

2 Likes

I have been able to get past this last error but now i am receiving this error now. Can anyone shed some light on what i need to do in workato.

image

Everyone thanks for the help i have been able to get everything to work from a bpm with out issue. Took some trial and error.

2 Likes

Good job!

What was the error about? What did you do to fix it?

2 Likes

image

This error was related to how i was configuring the API in workato. I was able to do that by filling out the Request schema. Once that was done i was cooking with gas.

image

this error was related to
image

I needed to make sure the end point was under a working client.

If anyone has any questions on how i did i can walk them through the steps i did to test and troubleshoot.

2 Likes

Do It Conan Obrien GIF by Team Coco

For the next guy :yum:

4 Likes