Shopify post request for loop - shopify-api

I am trying to configure an abandoned checkout marketing automation with shopify Flow,
that sends a POST request to an external email marketing platform (namely sendinblue):
I am able to pass basic parameters and shopify variables such as currency.
The issue I have is with looping through items in the shopping cart.
Does the body of the request accepts for/in loops or it does accept only JSON ?
Here is my code
{
"to": [
{
"email": "test#test.com",
"name": "John Doe"
}
],
"params": {
"currency": "eur",
"total": "",
"items":[{
"name":"{% for productsAddedToCart_item in abandonment.productsAddedToCart %}
{{productsAddedToCart_item.product.title}}
{% endfor %}"
}]
},
"templateId": 26
}
Thanks in advance for your hints!

Related

DocuSign: How do I send the values of the Document Custom Fields (aka tab definitions) while creating an envelope?

I need some help to identify how to send Document Custom Fields' values at the stage of creating an envelope. Below is the workflow:
Create the Document Custom Fields (account specific) with name, type and initial value through API (POST [BaseURI]/tab_definitions)
Create a template with document through API and place the required Document Custom Fields in the document through DocuSign UI
Create an envelope and send specific values for the Document Custom Fields through API (POST [BaseURI]/envelopes)
Creating an envelope is working fine referring (https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create). I have tried sending the values through:
document -> documentFields
customFields -> textCustomFields
{
"templateId": "51234567-1244-1234-1234-12345a857203",
"templateRoles": [
{
"roleName": "Role1",
"name": "Jane Doe",
"email": "jane#doe.com"
},
{
"roleName": "Role2",
"name": "John Doe",
"email": "john#doe.com"
}
],
"customFields": {
"textCustomFields": [
{
"name": "Account.Name",
"value": "account-name1234"
},
{
"name": "Candidate.FullName",
"value": "candidate-name1234"
},
{
"name": "Candidate.Mobile",
"value": "0412345678"
}
]
},
"status": "sent"
}
The CustomFields parameter is for Envelope Custom Fields. If you want to define tag values for a recipient, the tag parameters should be nested under the TemplateRole. You'll also want to use the tabLabel parameter to identify tabs instead of the name. Finally, make sure your Role Names and TabLabels match exactly between your template and your API call. Try this:
{
"templateId": "51234567-1244-1234-1234-12345a857203",
"templateRoles": [
{
"roleName": "Role1",
"name": "Jane Doe",
"email": "jane#doe.com"
"tabs": {
"TextTabs": [
{
"tabLabel": "Account.Number",
"value": "00000000"
},
{
"tabLabel": "Account.Name",
"value":"ExampleAccount"
}
],
},
{
"roleName": "Role2",
"name": "John Doe",
"email": "john#doe.com"
}
],
"status": "sent"
}
Finally, you may want to consider using a Composite Template instead of the basic Envelope Creation call. Details as to why are available here: https://www.docusign.com/blog/dsdev-why-use-composite-templates/

Get Post Analytics with Linkedin API v2

Recently, I am working on Linkedin API v2 and I have some problems with
Get posts of a certain company
Get analytics of a certain post
I was able to get company statistics by using https://api.linkedin.com/v2/organizationPageStatistics?q=organization&organization={organization URN}
But I can't find any API to get the above info.
Please help me to resolve above problem.
Thanks in advance for any advices.
You can use the Share API
you can retrieve the posts of a company with the Find Shares by Owner:
GET
https://api.linkedin.com/v2/shares?q=owners&owners={URN}&sharesPerOwner=100
{
"activity": "urn:li:activity:12345657",
"content": {
"contentEntities": [
{
"entity": "urn:li:article:0",
"entityLocation": "https://www.example.com/content.html",
"thumbnails": [
{
"imageSpecificContent": {},
"resolvedUrl": "https://www.example.com/image.jpg"
}
]
}
],
"description": "content description",
"title": "Test Share with Content"
},
"created": {
"actor": "urn:li:person:A8xe03Qt10",
"time": 1471967236000
},
"distribution": {
"linkedInDistributionTarget": {}
},
"id": "6173878065928642560",
"lastModified": {
"actor": "urn:li:person:A8xe03Qt10",
"time": 1471967237000
},
"owner": "urn:li:organization:1000",
"text": {
"text": "Test Share!"
} }
And about the analytics you can use the Retrieve a Summary of Social Actions API:
GET
https://api.linkedin.com/v2/socialActions/{shareUrn|ugcPostUrn|commentUrn}
{
"commentsSummary": {
"totalFirstLevelComments": 4,
"aggregatedTotalComments": 9
},
"$URN": "urn:li:activity:6296748651834277888",
"likesSummary": {
"likedByCurrentUser": false,
"totalLikes": 226
}
}
Hope this help
Actually linkedin doesn't provide such API like facebook or twitter.
They still lack the APIs for detailed situations. You need to scrape data from linkedin to get further information other than those of standard linkedin API.

DocuSign API creating an envelope in a specific folder

i am able to create an envelope with the DocuSign api. according to the documentation there is the attribute to specify the folderid in which you want to put the envelope. i have tried many things and the envelope never goes to the specified folder it only goes to the sent folder. how do we make sure the envelope is created in the specified folder id? there seems to be no sample code / syntax on how to do this via the documentation.
i've tried folder.folderId and folder[0].folderId and folders[0].folderId
[
{
"emailSubject": "This request is sent from a Template",
"emailBlurb": "Please sign...thanks!",
"templateId": "hidden",
"envelopeIdStamping": "false",
"templateRoles": [
{
"roleName": "Signer 1",
"name": "Matt",
"email": "email#email.com",
"recipientId": "1",
"tabs": {
"textTabs": [
{
"tabLabel": "dateField",
"value": "July 19, 2019"
}
]
}
}
],
"folders": [
{
"folderId": "folderIDhere"
}
],
"status": "sent"
}
]
no errors at all it just doesnt save in the folder
I'm not sure that you can create an envelope directly into a folder. I believe you'll need to take the Envelope ID you get in response to the Envelope Creation call, then plug it in to a Folders::MoveEnvelopes call like so:
PUT /v2.1/accounts/{accountId}/folders/{folderId}
{
"envelopeIds": [
"{envelope_id}"
],
}

Recipient view not merged

I am creating an envelope from a template and then getting the URL for the recipient view.
During my request DocuSign sends an email to the recipient and that is merged and ready to sign but the signing url goes to an unmerged version of the document that cannot be signed.
I dont really want the email sent, I just want to redirect the customer straight into the signing session.
What am I missing here?
ENVELOPE CREATION REQUEST:
{
"emailSubject": "Agreement",
"templateId": "xxx",
"templateRoles": [
{
"email": "johndoe#inter.net",
"name": "john doe",
"roleName": "Customer",
"tabs": {
"textTabs": [
{
"tabLabel": "Name",
"value": "john doe"
},
{
"tabLabel": "Date",
"value": "1/18/2019"
}
]
}
}
],
"status": "sent"
}
RESPONSE:
{
"envelopeId": "yyy",
"uri": "/envelopes/yyy",
"statusDateTime": "2019-01-18T19:45:04.2870000Z",
"status": "sent"
}
RECIPIENT VIEW REQUEST:
{
"userName": "john doe",
"email": "johndoe#inter.net",
"recipientId": "1",
"authenticationMethod": "email",
"returnUrl": "http://www.inter.net/docusign.asp?Status=complete"
}
RESPONSE:
{
"url": "https://demo.docusign.net/Signing/StartInSession.aspx?t=zzzz"
}
To indicate that you want to use an embedded signing ceremony for the template role, add the clientUserId attribute to the templateRole object.
Example of doing this: line 203 of the Number 17 example workflow (for PHP). This example workflow is also available for Node.js.
For a general example of using embedded signing, see example workflow 1 of the eg-03 series of example launchers--see the list of repositories at the bottom of the page.

How to get Image sent by user in facebook messenger through api.ai?

Anyone know how to retrieve an image sent by user, via api.ai? Do I just access the original body request? How do I do that when it does not seem to be sending to api.ai? Do I just use my server to respond?
API.AI includes information on the original request made to API.AI from the 1-click integrations in the originalRequest JSON attribute sent with every API.AI webhook request. The format for a Facebook Messenger Rich Messaging message sent with an images has the form:
{
"originalRequest": {
"source": "facebook",
"data": {
"sender": {
"id": "<PSID>"
},
"recipient": {
"id": "<PAGE_ID>"
},
"timestamp": 1458692752478,
"message": {
"mid": "mid.145869661...",
"attachments": [
{
"type": "image",
"payload": {
"url": "<IMAGE_URL>"
}
}
]
}
}
}
}
Gist of full code example here
You can use the originalRequest.data.message.attachments[0].payload.url attribute to get the URL of the image.

Resources