Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling respond() with a simple string does not work #222

Closed
3 tasks done
aoberoi opened this issue Jul 22, 2019 · 3 comments
Closed
3 tasks done

Calling respond() with a simple string does not work #222

aoberoi opened this issue Jul 22, 2019 · 3 comments
Labels
bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented

Comments

@aoberoi
Copy link
Contributor

aoberoi commented Jul 22, 2019

Description

Even through respond() is typed to accept a string argument, it will not post the body in the correct format for a simple message to be accepted by the platform. We may need to adjust the ExpressReceiver implementation to wrap the simple string in a JSON body with a text property.

As this is implemented, it might make sense to extract some sort of Receiver utilities file, which can assist with generating more Receiver implementations, which have more consistent behavior amongst them. This is an alternative to having a common base class which all implementations extend, and the base class provides this functionality.

Requirements (place an x in each of the [ ])

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

package version: all

node version: all

OS version(s): all

Steps to reproduce:

  1. Recieve a slash command
  2. Within the listener, try calling respond('test');
  3. Observe that the message is not sent in the channel, and an error is reported on the console.

Expected result:

Message posted in Slack

Actual result:

Nothing.

@aoberoi aoberoi added the bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented label Jul 22, 2019
@SpencerKaiser
Copy link

I have the exact same issue and it's a total blocker for me using Bolt because I need to post ephemeral messages.

@SpencerKaiser
Copy link

@aoberoi I found a workaround! The importance of token isn't really clear in the docs, but if you pass token into respond, it succeeds. Here's an example:

app.command('/wat', async ({ ack, context, respond }) => {
    ack();
    respond({
      token: context.token,
      text: 'wat'
    });
});

@seratch
Copy link
Member

seratch commented Feb 17, 2020

This issue has been fixed by #379

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented
Projects
None yet
Development

No branches or pull requests

3 participants