Cannot achieve goal using web API

I’ve got a goal setup on the CRM and got the Integration and Call Name from it. Then, using the PHP SDK, I’ve created a contact (this worked fine) and then tried to achieve the goal using this code:

$client->funnels()->achieveGoal($goalIntegration, $callName, $contactId);

But that doesn’t work as I simply get this error:

array(1) {
  [0]=>
  array(6) {
    ["success"]=>
    bool(false)
    ["msg"]=>
    string(54) "No Goals were configured to be achieved by this event."
    ["funnelId"]=>
    int(0)
    ["goalId"]=>
    int(0)
    ["flowStart"]=>
    array(0) {
    }
    ["flowStop"]=>
    array(0) {
    }
  }
}

I’ve checked all the input variables and they all have the right values and they match what’s in the CRM.

Any idea what is causing this and how to get it to work?

This is not an error. This is a successful call response. The message in msg simply would indicate that nothing is tied to the goal that enters them into anything but the goal triggered successfully. Can you take a snapshot of the goal in the campaign and post it?

Thank you for your answer, this is good to know. This is the goal settings I’ve been given:

Does that seem correct?

Yeah, the goal looks good. The image I’m suggesting would be the campaign where the goal is placed. ie I’m looking to see what it’s “attached” to

A few things to check:

  • Is the Campaign Published?
  • Is your “achieveGoal” parameters matching the same as the API Goal?
  • Are you connected to the correct Infusionsoft Account (Just in case you deal with multiple ones)?
  • Is the Contact valid?

I’ve tried again using the API but unfortunately the goals are not being registered. As a screenshot the account owner sent me this:

Does that seem correct?

@Pav, yes the campaign is published and the InfusionSoft account is valid (I’m only dealing with one). For the API call I’m using:

$goal = $client->funnels()->achieveGoal('cohortglobal', 'su102', $contactId);

Which as you can see from the screenshot above matches the goal parameters. The contact ID is definitely valid (I’m creating it before making the call, and I’ve checked it’s non-null and that the ID matches an actual contact).

Please let me know if I’m missing anything.

Thank you.

Try the following to see if this works.

Move the API Goal out of that sequence, and connect it to test sequence. The Sequence can either be Tagging the Contact, or sending an Email, etc. Then run your API Script to see it works.

If it does work, then you know its okay, then the question is what is that Decision Diamond doing?

If it fails to work, then send a picture of what the API Configuration is in the Campaign.

Yeah, I think @Pav has the right direction here. The reason for your message (success but no “goal acheived”) is because you’re moving into a decision diamond. That isn’t achieving anything directly but rather in-directly. If you run the test that pav suggests that should confirm it. Then you can run the goal with confidence regardless of it leading to a decision diamond.