Integrations and APIs for Service

Get Involved. Join the Conversation.

Topic

    Julie F
    Triggering email campaign from PHP CurlAnswered
    Topic posted June 14, 2019 by Julie FGold Trophy: 10,000+ Points 
    35 Views, 2 Comments
    Title:
    Triggering email campaign from PHP Curl
    Summary:
    Do campaigns even need to be triggered or will they start when a field is changed?
    Content:

    Our PHP Curl API updates certain fields in custom objects which indicated that an external user has got to a certain stage in their training.

    We want that to kick off a campaign that sends an initial email and then another reminder email every week, say, to complete the next stage of their training. 

    Ideally, once they have completed their next stage of training it could update the campaign and re-run it with different dates or cancel the first campaign and start a new one. When training is completed it would stop any email campaigns.

    The 'event' that initiates the email campaign is the field being updated by the API. Does the campaign then need to be initiated with some code from within the API or do campaigns kick off automatically when a field is updated however that update comes about. Also is there a problem / any extra work required if the field is on a custom object? Thanks.

    Best Comment

    Gursimran Singh Saini

    Much easy. Doable through all APIs.

    Connect PHP API:
    Marketing::ExecuteMarketingFlow (Contact, Campaign, EntryPoint) - When called, will execute a campaign flow for the given contact starting at the entry point given. This function expects the following variables:
    Contact - A valid Contact object
    Campaign - A valid Campaign object or Flow - as a NamedID.
    EntryPoint - The entry point within the campaign flow where the contact will start.

    // using campaign
    $contact = RNCPHP\Contact::fetch(2);
    $campaign = RNCPHP\Campaign::fetch(6);
    RNCPHP\Marketing::ExecuteMarketingFlow($contact, $campaign, "start_here");
    

     

    Connect Web Services for SOAP:
    ExecuteMarketingFlowResponseMsg = Binding.ExecuteMarketingFlow(ID ContactID, ID CampaignID, String EntryPoint);
    ContactID - The ID of the contact record which will be sent through the campaign flow.
    CampaignID - The ID of the campaign flow that will be executed.
    EntryPoint - The entry point for the campaign flow.

     

    Connect REST API:
    https://mysite.example.com/services/rest/connect/v1.4/contacts/1/executeMarketingFlow
    {
    "campaign": {"id": 123},
    "entryPoint": "entry0"
    }

    Comment

     

    • Gursimran Singh Saini

      Much easy. Doable through all APIs.

      Connect PHP API:
      Marketing::ExecuteMarketingFlow (Contact, Campaign, EntryPoint) - When called, will execute a campaign flow for the given contact starting at the entry point given. This function expects the following variables:
      Contact - A valid Contact object
      Campaign - A valid Campaign object or Flow - as a NamedID.
      EntryPoint - The entry point within the campaign flow where the contact will start.

      // using campaign
      $contact = RNCPHP\Contact::fetch(2);
      $campaign = RNCPHP\Campaign::fetch(6);
      RNCPHP\Marketing::ExecuteMarketingFlow($contact, $campaign, "start_here");
      

       

      Connect Web Services for SOAP:
      ExecuteMarketingFlowResponseMsg = Binding.ExecuteMarketingFlow(ID ContactID, ID CampaignID, String EntryPoint);
      ContactID - The ID of the contact record which will be sent through the campaign flow.
      CampaignID - The ID of the campaign flow that will be executed.
      EntryPoint - The entry point for the campaign flow.

       

      Connect REST API:
      https://mysite.example.com/services/rest/connect/v1.4/contacts/1/executeMarketingFlow
      {
      "campaign": {"id": 123},
      "entryPoint": "entry0"
      }

    • Julie F

      Thanks Gursimran, we will give this a go.