Mailjet Template API: Add attachments to template - api

I want to add inline images to my transactional email templates.
I can't find on the official API a way to push attachments for a template.
I've tested with the following parameters :
{
"ContentType": "image/png",
"Filename": "image.png",
"Base64Content": "base64code"
}
The API doesn't recognize the property : Properties not supported in JSON payload
I don't to attach my image each time I send the email using Send API.
Is there any way to attach files to a Mailjet Template.
Regards,
Clément

At the moment, it is not possible to insert an attachment in the template. Attachments should be provided in each transactional API call.

Related

How can we filter the options of an entity select component in the app config?

We have an app and we would like to configure it to send out emails. On app activation a mail template type and a default mail template are created. However in the configuration we would like to be able to select which mail template we should send out. Our config.xml looks contains the following:
<component name="sw-entity-single-select">
<name>customerMailTemplate</name>
<entity>mail_template</entity>
<label>Choose which mail template to be sent to customers on reservation</label>
<labelProperty>description</labelProperty>
<placeholder>Select mail template</placeholder>
</component>
Our question has 2 parts:
Given that not all mail templates have a description, is there a way how we can include Type + description as labels? similar to the mail templates overview in the admin settings.
We would like to filter this list to only show mail templates of a certain type. I see that this component takes a criteria object but we could only transfer strings from the xml file to the component. Would this be possible?
Having a plugin would allow us to create custom components and add them in the admin, but I don't see how we could do this from an app. If the above are not possible is there a way to create a custom vue component from an app?
Unfortunately neither of those things are possible with apps as of today.
The component has a slot to override the label but since you can't access the template directly with apps, you can only define a single property for the label.
While the component does take a criteria, the config.xml schema is not prepared to take and pass a criteria to the component.
If this is a must-have you could go the route of adding a custom module for you app. This is essentially just an iframe with a source to a page you're hosting. On that page you'd have to build a custom select dropdown. To feed the dropdown with data you request the admin api (with the credentials you received in the app registration process). That's also when you can make use of the criteria filters.
POST /api/search/mail-template
{
"associations": {
"mailTemplateType": []
},
"filters": [
{
"type": "equals",
"field": "mailTemplateType.technicalName",
"value": "order_confirmation_mail"
}
]
}
With the data you received from that endpoint you could then also freely set the labels as you like.
Once the user made a selection you can then either save the selection on your app server or send it back to the admin api, e.g. for storing it in the plugin config.
POST /api/_action/system-config
{
"MyApp.config.customerMailTemplate": "cc4996d68d22421081285fe957f85ec7"
}

How see analytics about branch links created using mobile SDK

I am creating dynamic branch links using Android SDK
https://github.com/BranchMetrics/android-branch-deep-linking#creating-a-deep-link
These are then shared to social media
How do I track things like click events, installs etc as I do not believe they show up in the dashboard quick links view? https://dashboard.branch.io/quick-links
Is there a HTTP API I can use to interrogate all links I may have dynamically created that are part of the same campaign?
Alex from Branch.io here:
You are correct that SDK-generated links do not show up in the Quick Links view on the dashboard. Most SDK-created links are 'disposable' (in that they get used once and then regenerated the next time), so showing every link there individually would quickly overwhelm the UI. It is possible to override this on a link-by-link basis with the type parameter, as detailed here.
However, you can access the numbers in aggregate, segmented by campaign value, which I believe is what you want anyway. This is not currently available through the API, but you can see these statistics through the Sources report on the dashboard: https://dashboard.branch.io/sources
you must include a "type": 2 in your branch params
https://help.branch.io/developers-hub/docs/deep-linking-api
const branchConfig = {
"branch_key": environment.branchio.key_live,
"type": 2,
"data": {
"$marketing_title": (params.job_name ? params.job_name : ""),
}
};

Pushwoosh, how do I send 'open app' push notifications with custom data via the API?

I having trouble send a Pushwoosh notification using the API that matches what I can do in the web interface.
In the web interface, I navigate to the Action tab and select 'Open App' and enter custom json in the data field. This sends a notification that when clicked, triggers an even in my app and passes in custom data.
I have tried to recreate this using the createmessage API by passing in custom data. Using the Ruby client API I run
Pushwoosh.notify_devices("test", device_ids, { data: { foo: 1 } }). This triggers a push but when the user taps on the push notification it opens the app but does not pass any data or call any of the callbacks in my app when the app opens.
Am I using the wrong API or missing parameters?
Do you use "data" parameter in createMessage?
It will be passed as "u" parameter in the push payload.
"data": {"key":"value"}, // JSON string or JSON object, will be passed as "u" parameter in the payload (converted to JSON string)
If you want to modify the payload at any level you can use "ios_root_params"/"android_root_params" which is a JSON object and will be merged at the root level of the push payload.

Customizing image uploading in TinyMCE

I have an ASP.NET Web API web service which I want to use for file uploading. The way I do this is that the client posts a JSON object to the service at http://myserver.com/api/images/upload .
The object would contain a base64 string representation of the image, plus some metadata, e.g:
{ companyId: 12345, image: "someBase64encodedStringRepresentingTheImage" }
I would like to use TinyMCE on the client side, but I can't figure out how to customize it such that images are uploaded to the server in that format. (Actually, it doesn't seem like TinyMCE comes with an image uploader at all)
TinyMCE 4.2+ actually has its own built in process for handling the upload of images that you place in the editor:
https://www.tinymce.com/docs/advanced/handle-async-image-uploads/
The basic process is that TinyMCE will create a separate HTTP POST for each image that you insert into the editor. It will send that image to a URL of your choosing (via HTTP POST) based on the setting of the images_upload_url option in your init.
The image handler at the URL referenced in the images_upload_url (which you have to create) has to do whatever needs to be done to "store" the image in your application. That could mean something like:
Store the item in a folder on your web server
Store the item in a database
Store the item in an asset management system
...regardless of where you choose to store the image your image handler needs to return a single line of JSON telling TinyMCE the new location of the image. As referenced in the TinyMCE documentation this might look like:
{ location : '/uploaded/image/path/image.png' }
TinyMCE will then update the image's src attribute to the value you return. If you use the images_upload_base_path setting in the init that will be prepended to the returned location.
The net here is that TinyMCE knows when an embedded image exists in your content but it can't possibly know what to do with that image in the context of your application so that job (the "image handler") is something you must create.
There is an option for you to write your own image handler if the default one is not sufficient:
https://www.tinymce.com/docs/configure/file-image-upload/#images_upload_handler
I would recommend trying to use the uploader that comes with TinyMCE so you don't have to write and maintain your own code going forward (always easier) but if the built in code is not appropriate you can indeed replace it with your own function.

Adding snippet and injecting it on product page in shopify

I'm developing a Shopify app.
On app installation, I want to create a snippet and upload some assets like images and JS.
That snippet should be injected in the product.liquid file.
You can use this for creating assets using API
https://docs.shopify.com/api/asset
While passing the key parameter you can pass whether it is going to be a snippet or asset.
{ "key" : "assets/bg-body-green.gif" }