Question

MATTERMOST - Integration API Help (Sending files)

  • 2 November 2020
  • 5 replies
  • 174 views

Has anyone already integrated this Mattermost with Zapier ?

The automatic integration only allows you to send texxt messages but not files in a specific channel.

Can someone post an example of how to send a file (I’m retrieving a Gmail attachement) to a specific channel ID via Zapier Webhook / API to Mattermost via Eg. BOT?

Thank you, it would be a precious help.

Kind Regards


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

5 replies

Userlevel 7
Badge +11

Hi @swiss404!

While I’m not able to provide precise details about what would be required, here are some pointers:

API docs for uploading files to Mattermost channels: https://api.mattermost.com/#tag/files/paths/~1files/post

One of the ways to authenticate is to use a personal access token: https://docs.mattermost.com/developer/personal-access-tokens.html

Then you can read about how to use that token: https://api.mattermost.com/#personal-access-tokens

I can’t guarantee that it will be exactly this, but it should be something along the lines of:

To get your channel ID you could check the URL in your web browser’s address bar when you visit that channel, to see if there’s anything that resembles an ID. You may also be able to see it in one of the Mattermost actions in the Zapier integration (like the Post message action, for example).

Hope this helps!

Hi @nicksimard ! Thanks for your quick reply.

If file is attached as “File:” then I get this error
The app returned "Invalid or missing data in request body."

If I create a filed in data “Files” I get the following error and can figure out :-/

 

Userlevel 7
Badge +9

Hey! It looks like you have added the channel ID in the request, and the request is constructed correctly - The only question I have is - Have you checked whether the channel ID is definitely valid?

Hi Andy!

I copy/paste the ID from channel “View Info” so I think this is correct. I used same ID to send normal text messages and it works.

I can' t see a logs of how Zapier sends the request, maybe the underscore of “channel_id” cause a problem ? Who knows :P

Userlevel 7
Badge +12

Hi @swiss404! If you were able to get to the bottom of this, we’d love to know! 🙂