How to add custom link preview to mattermost - mattermost

I'am looking for a way to implement custom link preview for our task system (MantisBT). Essentially i would like to create some sort of plugin which would be able to capture links in specific format (https://tasks.com/b/1234). Get simple details of given task using REST api from internal task server and show them as message attachment (ex. task summary, assignee and status).
Unfortunatelly i cant find any info if it is even possible not speaking about some more detailed steps to do such think.
So to sum it up, someone sends a message:
Hello can you please look at https://tasks.com/b/1234
When this is send, i would like to see something like this:
Hello can you please look at https://tasks.com/b/1234
-----------------------------
| 1234: Bug in new system |
| assignee: John |
| status: new |
-----------------------------
Essentially creating own link visualizer.

You can use registerLinkTooltipComponent plugin hook to display a custom component on hovering on a link. You'll be able to filter for specific links and display your custom component for any link you want to support.
You can refer the GitHub plugin as an example - https://github.com/mattermost/mattermost-plugin-github/tree/master/webapp/src/components/link_tooltip

Related

How to delete Google Calendar Event from API (Using Bubble.io)

I am trying to use the Google Calendar API to enable users of my application to create events, retrieve events info, and finally delete events in their google calendar directly from my app, which is by the way built in bubble.io.
I have successfully setup the first 2 usecases, but I am having issues setting up the last one.
I have tried to follow the API documentation from google, but without any luck so far. See screenshot attached of how my call looks right now - I have tried various variations of this call, but always get an error with "code: 404, Message: not found".
I think you should add parameters like as follow :
enter image description here
You can find more info here : https://developers.google.com/calendar/v3/reference/events/delete
Let me know if it was of any help,
A proud member of Bubble community.

How can share product name and image on whatapps using html?

I'm trying to create script which can share product link and name. I searched about it and found an good answer.
Share via Whatsapp
Above link is just sending product URL to whatapps, but i want to send title as well. Is there possible that i can send product title as well.
I try to more searched about it and finally i got solution for this. I just add php syntax urlencode().
Share via Whatsapp

Is there anyway to get this table data into iOS app?

I work with a company who outsources their website. I'm trying to retrieve data from the site without having to contact those who run it directly. The table data I'm trying to retrieve can be found here:
http://pointstreak.com/prostats/scoringleaders.html?leagueid=49&seasonid=5967
My methodology thus far has been to use google chrome's Developer Tools to find the source page, but when I filter under the network tab for XHL, only the info of the current games can be found. Is there anyway to scrape this data (I have no idea how to do that; any resources or direction would be appreciated) or another way to get it? Am I missing it in the developer tools?
If I had to contact those who run the website, what exactly should I ask for? I'm trying to get JSON data that I can easily turn into my own UITableViewController.
Thank you.
Just load the page source and parse the html.
Depending on your usage there may well be a copyright issue, the page has an explicit copyright notice so you will need to obtain explicit permission for your use.

AtTask create/update a custom field through API on project creation created through AtTask's web app

I'm looking to use AtTask's API to update or create a custom field (ie. assign a custom ID apart from AtTask's auto-generated id) whenever a project is created through the web app. But I have not found anything about handling events in the API documentation.
I'm able to retrieve/edit project fields when issuing a request by ID or some other search parameter.
But I'm having trouble finding ways to edit project fields on some event like 'project created'.
One way I can think of is to have my script periodically search for new projects based on project metadata and edit projects that way, but there must be a better solution I probably missed.
Thanks in advance!
UPDATE:
It seems 'AtTask event subscriptions' was what I was looking for. At the time of the post below (12/2013), due to scalability issues, AtTask has turned this feature turned off with no ETA on resolving the issue. See here: Does AtTask event subscription work?
Any updates would be appreciated.
You are correct the AtTask API does not currently support events. The easiest thing to do is to just poll the system for updates using the search. You could also monitor an email address for emails that are sent upon project creation. The email will contain the project/task/issue ID that you can use to update events.

How do I halt item posting on data validation error in plugin

Let's say I have a plugin Foo in osclass. In that plugin we register a hook for when an item is posted. According to the osclass hooks documentation the only hook that is run when an item is posted is posted_item.
But as far as I can tell from looking at the code this is run after the initial item data has already been validated and stored in the database. What if a validation of some plugin specific code fails and I would like to show the user an error message and present him with the form again to give him/her the chance to alter this information? Much like if you try to submit a new item but don't fill in one of the base information like description for instance.
I can't seem to find a way to do this. Only workaround I find to avoid the item being posted despite containing invalid plugin specific data, without editing the main osclass code, is to delete the posted item again in the posted_item hook callback function of my plugin. This feels extremely cumbersome and also requires every other plugin to check that the item still exists to make sure they don't save data connected to an item that is now deleted.
What I would like, and wonder if I have missed, is a hook that is run when an item is posted but before it's written to the database and have the ability to generate "errors" that would cause the item to not be posted and the user redirected back to the form with the "error" displayed just like for the basic item information.
Anyone have a solution I have missed? This feels like a very important part of plugins and without it posted items could become very fragmented.
A user on the osclass forums (teseo) told me about the undocumented hook pre_item_add that can be used.
<?php
function cust_my_plugin($aItem) {
osc_add_flash_error_message('My plugin has a complaint.');
$pItem = new CWebItem();
$pItem->redirectTo( osc_item_post_url() );
}
osc_add_hook('pre_item_add', 'cust_my_plugin');
?>
He also sais
The only bad news is that you can't merge your plugin validation
process with that of the core script, so if the ad had an error
related to your plugin and other errors, it would be rejected twice,
one by your plugin, the second by the core script. I couldn't see any
workaround for this little issue.