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

Optional message #750

Open
johnkmoore opened this issue Feb 17, 2024 · 1 comment
Open

Optional message #750

johnkmoore opened this issue Feb 17, 2024 · 1 comment

Comments

@johnkmoore
Copy link

Describe the bug

  1. The Optional message option is a great option I'd like to use. I can kind of get it to work with the example API (https://api.chucknorris.io/jokes/random) but I'm a big Simpson's fan and would like some Simpson's quotes (https://thesimpsonsquoteapi.glitch.me/quotes) but it doesn't seem to parse correctly. I tried with dad jokes as well (https://icanhazdadjoke.com/slack)
  2. the refresInterval attribute doesn't seem to work either.

Expected behavior
Using the YAML configuration below I'd expect to see a Simpson quotes every 10 seconds

** Actual behavior**
Performs default behavior of displaying failover with specified title, icon and content

Logs & errors
No Docker errors or Browser console errors.
The difference I see in the APIs I'm trying to use is the both start and end with brackets []
Works:

{"categories":[],"created_at":"2020-01-05 13:42:22.089095","icon_url":"https://assets.chucknorris.host/img/avatar/chuck-norris.png","id":"yCqxDiEkRFaZuSibv79z_w","updated_at":"2020-01-05 13:42:22.089095","url":"https://api.chucknorris.io/jokes/yCqxDiEkRFaZuSibv79z_w","value":"Chuck Norris is the only person who can divide by 0."}

Doesn't work:

[{"quote":"Eat my shorts","character":"Bart Simpson","image":"https://cdn.glitch.com/3c3ffadc-3406-4440-bb95-d40ec8fcde72%2FBartSimpson.png?1497567511638","characterDirection":"Right"}]

{"attachments":[{"fallback":"Today, my son asked "Can I have a book mark?" and I burst into tears. 11 years old and he still doesn't know my name is Brian.","footer":"https://icanhazdadjoke.com/j/fii3Tv4hFd|permalink - https://icanhazdadjoke.com|icanhazdadjoke.com","text":"Today, my son asked "Can I have a book mark?" and I burst into tears. 11 years old and he still doesn't know my name is Brian."}],"response_type":"in_channel","username":"icanhazdadjoke"}

Configuration

message:
url: https://thesimpsonsquoteapi.glitch.me/quotes
mapping:
title: 'character'
content: 'quote'

@johncrocker
Copy link

Looking at the API responses.

Chuck Norris returns an object
Dad Jokes, Simpsons return an array.

I’m trying to use Zenquotes at https://zenquotes.io/api/random/

which also returns an array, I suspect that’s the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants