GithubHelp home page GithubHelp logo

Comments (8)

jasonblais avatar jasonblais commented on July 3, 2024 2

Certainly, does this document update capture it?

mattermost/docs#2592

from mattermost-developer-documentation.

hanzei avatar hanzei commented on July 3, 2024

Hey @JAGFin1,

Right now there is no way to directly send an ephemeral message within the dialog submit response. But you can use the REST API to do so. Or the plugins API if you are developing a plugin.

On the other hand I see the need of having the possibility build into the response.

@jasonblais Thoughts on adding something like EphemeralText to SubmitDialogResponse?

from mattermost-developer-documentation.

jasonblais avatar jasonblais commented on July 3, 2024

@hanzei 0/5, but I think @JAGFin1 is asking for a concrete example of how to respond to a Dialog submission. Is this something you'd be open to helping with, or should we queue this for engineers to help with?

from mattermost-developer-documentation.

hanzei avatar hanzei commented on July 3, 2024

A basic example would be:

response := &model.SubmitDialogResponse{
			Errors: map[string]string{
				someKey: "Some erro",
			},
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
_, _ = w.Write(response.ToJson())

inside your http server that handles the submit dialog request. This would show an error for the element with the key someKey.

@JAGFin1 Are you using a plugin or the REST API to open the dialog? If you want, I can share an example on how to send an ephemeral message.

from mattermost-developer-documentation.

JoshStark avatar JoshStark commented on July 3, 2024

Hi @hanzei,

I'm using the REST API to open the dialog. That's working as intended. The specific issue is when the user submits the dialog (and thus performs a request back to my service), I do not know what the HTTP response should contain in order for Mattermost to display a message as a "Your submission has been logged" type of message.

That being said, I believe I may have misunderstood the original documentation. Based on what you said, it looks like I need to send a separate request back to Mattermost once my service has received (and responded to) a submission request from a dialog. This differs from how errors are handled as they are returned directly in the response.

Is that correct? If so, I can manage that.

from mattermost-developer-documentation.

hanzei avatar hanzei commented on July 3, 2024

That is correct @JAGFin1.

@jasonblais what do you think about clarifying this in the docs?

from mattermost-developer-documentation.

JoshStark avatar JoshStark commented on July 3, 2024

Thanks for the clarification @hanzei and @jasonblais. The amendment to the documentation has made it clearer about what the integration needs to do. If possible, a JSON example for the HTTP API (and endpoint) or a reference to the /posts/ephemeral documentation would be perfect.

from mattermost-developer-documentation.

hanzei avatar hanzei commented on July 3, 2024

Thanks for your suggestion @JAGFin1. 👍 I opened a PR to add a code sample to the API documentation.

Closing this one.

from mattermost-developer-documentation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.