How to personalise email on infobip - api

Please how can I add custom placeholder to the portal editor for infobip email service.
I have created a template with the portal design editor and I want to dynamically add placeholders like the recipients first name or the recipients and invoice ID or any other necessary data concerning the recipient, I'm trying to create an invoice email for my customers.
From the API documentation, I have seen the place to pass in the template ID but I'm not seeing any place where I can pass in my own custom variables for the custom recipient data. so please help if there is any and thanks.

Easiest way would be to define placeholders in the template you save. Like this: {{customer_name}} {{invoice_no}} and then when you use the template Id in API request you would have to send via API something like this:
curl --location --request POST 'https://api.infobip.com/email/2/send' \
--header 'Authorization: Basic Authorization==' \
--form 'templateID="Your_template_id"' \
--form 'to="{
\"to\": \"Customer1#customer1.com\",
\"placeholders\": {
\"customer_name\": \"Customer 1\",
\"invoice_no\": \"1\"
}
}
"' \
--form 'to="{
\"to\": \"customer2#gmail.com\",
\"placeholders\": {
\"customer_name\": \"*customer 2\",
\"invoice_no\": \"2\"
}
}"'

I have been using as EmailJs before. Their integration is extremely simple and straight forward.

Related

curl command for LIST string data type

I've a formal parameter as List example in webservice. How to pass curl command for the list of string to POST data.
Appreciate your help regarding this matter.
Thanks,
Blessy

Getting tweet replies to a particular tweet from the tweet author

I am trying to get tweet replies for a particular Tweet/TwitterThread that are just from the author of the Tweet only. So far, I am able to get all the replies for a particular Tweet by using the search endpoint like this:
curl --request GET --url 'https://api.twitter.com/2/tweets/search/recent?query=conversation_id:1373848915464785920&tweet.fields=in_reply_to_user_id,author_id,created_at,conversation_id' --header 'Authorization: Bearer $BEARER_TOKEN'
The code above gives me ALL the replies. What I want is only the replies from the original author.
For reference, this is the documentation link for the code above: https://developer.twitter.com/en/docs/twitter-api/conversation-id
You can specify the author in the query with "(from:mark)" assuming the username is mark. Say the following is the query: "apples -filter:replies"
Then, the following would be the query including the author of the tweet: "apples (from:mark) -filter:replies"

Non public shopify app that can populate checkout page with products and discounts?

I am trying an experiment and I think I am close to a complete solution. I would like to do the following.
I do not want to modify any of the liquid templates in my shopify site.
I want to put a button with the text "Click Me" in the header of my shopify site.
When the customer presses "Click Me", they will be taken to the shopify checkout page. The shopify checkout page must show a quantity of 2 for the product with variant_id 11111111111111 and the checkout page must show that a discount of $X will be applied to the checkout. The value of X must be a random number between 0 and 100. The value of X must not be associated with any existing discount codes in the shopify store.
This solution must be available to only my store and no other store.
I created a prototype, but the best I could do was satisfy objectives 1-3. I do not know how to satisfy all 4 objectives. Is it possible to satisfy all 4 objectives? If so, what do I need to do?
Details on my prototype:
For my prototype I created an unpublished sales channel app called the ProtoApp. My ProtoApp will use the script_tag.json API endpoint to load a custom javascript file from one of my linux servers. My custom javascript file will add a new element to the header of the webpage. The onclick event of the button will make an ajax call to my ProtoApp . My ProtoApp will make the following call via BASH on Linux
curl -i \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-H "X-Shopify-Access-Token: mytokenfromshopify" \
-X POST "https://mystore.myshopify.com/admin/api/2019-07/checkouts.json" \
-d #checkout.json
And my checkout.json looks like this
{
"checkout": {
"line_items": [
{
"variant_id": 11111111111111,
"quantity": 2
}
],
"applied_discount": {
"amount": ###autogen##,
"title": "XYZ Promotion",
"description": "Promotional item for blackfriday.",
"value": ###autogen###,
"value_type": "fixed_amount",
"non_applicable_reason": null,
"applicable": true
}
}
}
Shopify Checkout API will give me a success response. I will find a web_url with a value like https://mystore.myshopify.com/402423011/checkouts/2b3e24742ea6c087ec7c10e7c4117bba in the success response. I send this web_url back to my javascript file and do a location.href = web_url, which causes the customer to go to the checkout page. The customer sees the appropriate discount applied. The customer can continue with checkout process and payment. Everything is perfect.
To my current understanding, the problem with this approach is that in order to use it in a production store, I must publish my app to the market. This means other people other than me will be able to use it. Hence failure to meet the 4th requirement mentioned above.
Based on my research, a private app will not allow me the write_checkout scope, which to my understanding, is necessary for my solution.
Any suggestions on what I can do to satisfy all 4 objectives?

JIRA API GET all values for a custom field

I'm trying to get all possible values for a customfield on JIRA through the GET api.
Example:
I created the "Test API" custom field and gave it three values "API 1", "API 2" and "API 3". The id for this field is 18232.
I'm trying to do this with the following:
https://my-domain.atlassian.net/rest/api/2/customFieldOption/18232
I got this from here
The headers are one for basic authorization and one with Accept - application/json
No matter what I try to do I keep getting the error
{"errorMessages":["A custom field option with id '18232' does not exist"],"errors":{}}
Has anyone been sucessful with this?
I have followed the following and I was able to get what I was looking for, hope this helps!
Request:
curl -D- -u username:password -X GET -H "Content-Type: application/json" https://my-domain.atlassian.net/rest/api/2/customFieldOption/10150
Response:
{"self":"https://my-domain.atlassian.net/rest/api/2/customFieldOption/10150","value":"AUG-1999"}
Hope this helps!
That rest API call only give you a custom field OPTION value, if you want to list all options of customFileld i think you need a webserviceplugin.

How do I use negation (and lists) in JIRA REST API?

I need to recreate a JIRA search filter in JIRA REST API.
I understand how to query for particular field values with "jql for REST", e.g.
curl -D- -u fred:fred -X GET -H "Content-Type: application/json" http://kelpie9:8081/rest/api/2/search?jql=assignee=fred&startAt=2&maxResults=2
But how do I represent this piece of query:
... AND (labels not in (label1, label2) OR labels is EMPTY) AND ...
Or maybe there is a way to reuse an existing filter instead of constructing the JQL query?
Ok, I just realized that when I construct the JQL query in JIRA, I can see the modified "ulr-ready" version of the query in the browser address bar. Facepalm.