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           [email protected]         Alpha
2           [email protected]          Beta

Favourtes       
Favourtesid         Transaction id  Item Name
1                       1           Apple
2                       1           Orange
3                       1           Grape
4                       2           Apple
5                       2           Grape
5
  • Please try to select tags related to the subject of your question, this will help attract people with the right knowledge to your question! :) Commented Feb 3, 2014 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. Commented Feb 3, 2014 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
    Commented Feb 3, 2014 at 15:20
  • How should I design this in terms of Data extension. and json payload.
    – Pravin
    Commented Feb 3, 2014 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. Commented Feb 4, 2014 at 12:39

2 Answers 2

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .