1

I am trying to send email and populate data extension using Triggered send REST API of exact target in salesforce to populate values in Data Extension using REST API.

I was able to send an batch sent email in salesforce using REST API. I was able to populate attributes in data extension and printed in mail too.

But the challenge is Each subscriber will receive a mail with his favourites data.

For example "X" likes Apple,Grape,Banana. "y" likes Grape,Mango.

I have 2 data extensions Transaction Extension and Favourites Extension. currently with no relation

In My mails X should receive a mail with he likes 1.Apple 2. Grape 3. Banana

What i want to know is How should I send these values as a JSON Payload in MessageSend. How can we relate these two extensions. what should be the ampscript in the mail.

Please Help someone.

more info

Transactions
Tid     Subscriber Email    first name
1           alpha@gmail.com         Alpha
2           beta@yahoo.com          Beta

Favourtes       
Favourtesid         Transaction id  Item Name
1                       1           Apple
2                       1           Orange
3                       1           Grape
4                       2           Apple
5                       2           Grape
  • Please try to select tags related to the subject of your question, this will help attract people with the right knowledge to your question! :) – Samuel De Rycke Feb 3 '14 at 9:05
  • Your use case flow is not making any sense to me, and making it difficult to provide an answer. When does the data need to be entered? How are you populating any of the data currently? What is the purpose of the transaction ID, and how does it make it different. I don't understand how all of the pieces work together. Can you supply any more code of what you are currently trying? Not sure I'll be able to give a helpful answer otherwise. – Kelly J Andrews Feb 3 '14 at 15:06
  • In Our database we have Opportunity and Recommendations Object. Where Opportunity is Master and Recommendations is Child. ie Each Opportunity can have multiple Recommendations. The Scenario is My Agent Creates 3 Recommendations for an Opportunity today. By this a Trigger Send is invoked when all three are saved. Expected output is a mail with those three items. Next time Agent Creates 1 Recommendation for the same opportunity now the Mail should only get 1 new item. hope this give some information. Please let me know if i have to add more – Pravin Feb 3 '14 at 15:20
  • How should I design this in terms of Data extension. and json payload. – Pravin Feb 3 '14 at 15:21
  • Would you mind going here - chat.stackexchange.com/rooms/info/12838/… I would like to grant you access and we can continue this discussion. – Kelly J Andrews Feb 4 '14 at 12:39
1

You would want to use dataevents by addingg rowsets.

Here is a sample call -

POST https://www.exacttargetapis.com/hub/v1/dataevents/key:DataExtensionExternalKey/rowset

Add the header:

Authorization: Bearer gd2324hruukedkremtwqhae9

and the payload:

[
    {
        "keys":{
                "Email": "someone@exacttarget.com"
                },
        "values":{
                "LastLogin": "2013-05-23T14:32:00Z",
                "IsActive": true,
                "FirstName": "John",
                "FollowerCount": 2,
                "LastName": "Smith"
                }
    },
    {
        "keys": {
                "Email": "someone2@exacttarget.com"
                },
        "values":{
                "LastLogin": "2013-05-23T14:32:00Z",
                "IsActive": true,
                "FirstName": "Jane",
                "FollowerCount": 2,
                "LastName": "Smith"
                }
    }
]
  • Can we attach This along with the Email json payload. or this has to be a seperate call – Pravin Feb 3 '14 at 14:27
  • I would make sure that your data is updated prior to the email call. So yes, two calls. – Kelly J Andrews Feb 3 '14 at 14:36
  • My Transaction id is created only when my email is sent – Pravin Feb 3 '14 at 14:47
  • Thanks, Kelly J Andrews. But i dont have 20 Reputation to chat. – Pravin Feb 4 '14 at 15:26
  • I added you to the room. – Kelly J Andrews Feb 4 '14 at 15:41
1

You will have to use LookupRows function to get favorites data at "Favourtes" table.

The AMPScript will be something like below:

%%[ 
    VAR @Rows, @Tid, @currentrow, @row, @Item
    SET @Tid = Tid
    SET @Rows = LookupRows("Favourtes","Transaction id",@Tid)
]%%
%%[
    if ROWCOUNT(@Rows) > 0 then
]%%
    %%[
        for @currentrow = 1 to RowCount(@Rows) do
            SET @row = Row(@Rows, @currentrow)
            SET @Item Field(@row, "Item Name")
    ]%%
            <BR> %%=v(@item)=%%
    %%[
        next @currentrow
    ]%%
%%[ 
    else 
]%%
        <BR> No favourite data
%%[ 
    endif 
]%%

Take a look at the scenario presented at ExactTarget help:

http://help.exacttarget.com/en/documentation/exacttarget/content/ampscript/scenarios/

  • Thanks Lamotte, This should relly help us. also i wanted tje json structure for the payload in REST API if possible – Pravin Feb 3 '14 at 13:00
  • { "From": { "Address": "code@exacttarget.com", "Name": "Code@" }, "To": { "Address": "example@example.com", "SubscriberKey": "example@example.com", "ContactAttributes": { "SubscriberAttributes": { "Tid": "1" } } } } – Lamotte Feb 3 '14 at 13:32
  • Thanks, How can we add favouries for each transaction. One Transaction can have many favourites – Pravin Feb 3 '14 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.