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

Failed to get one on one conversation #21

Closed
Verzu23 opened this issue Nov 17, 2021 · 6 comments
Closed

Failed to get one on one conversation #21

Verzu23 opened this issue Nov 17, 2021 · 6 comments

Comments

@Verzu23
Copy link

Verzu23 commented Nov 17, 2021

"message":"Failed to get one on one conversation","errors":[{"description":"Failed to get one on one conversation"}

markDownMessage := &webexteams.MessageCreateRequest{
		Markdown:      "MESSAGE",
		ToPersonEmail: "MY EMAIL",
	}
	_, rep, err := Client.Messages.CreateMessage(markDownMessage)
	if err != nil {
		fmt.Println(err.Error())
	}

Whats going on here ?
If i make manually the request it works...
Can you help me?

@jbogarin
Copy link
Owner

I've never seen that error. Can you send the API request you are doing in curl, postman or something like that?

@Verzu23
Copy link
Author

Verzu23 commented Nov 17, 2021

In Postman I set URL: https://webexapis.com/v1/messages
Set Header Authorization: Bearer TOKEN
Set body:

  • Markdown : MESSAGE
  • ToPersonEmail : EMAIL

And it works as expected

With the library seems execute the same header and body but probably there's something different...

@jbogarin
Copy link
Owner

I just tested this and it works:

package main
import (
        "fmt"
        "log"
        webexteams "github.com/jbogarin/go-cisco-webex-teams/sdk"
)
var Client *webexteams.Client

func main() {
        Client = webexteams.NewClient()
        markDownMessage := &webexteams.MessageCreateRequest{
                Markdown: "This is a markdown message. *Italic*, **bold** and ***italic/bold***.",
                ToPersonEmail: "[email protected]",
        }
        newMarkDownMessage, _, err := Client.Messages.CreateMessage(markDownMessage)
        if err != nil {
                log.Fatal(err)
        }
        fmt.Println("POST:", newMarkDownMessage.ID, newMarkDownMessage.Markdown, newMarkDownMessage.Created)
}

@Verzu23
Copy link
Author

Verzu23 commented Nov 17, 2021

The only difference between your code and mine is that I add

Client = webexteams.NewClient()
Client.SetAuthToken("<WEBEX TEAMS TOKEN>")
....

just before

@jbogarin
Copy link
Owner

That also worked for me.

@Verzu23
Copy link
Author

Verzu23 commented Nov 17, 2021

Okk I'll check it out tomorrow and let you know if I figure out something
Thanks

@jbogarin jbogarin closed this as completed Aug 1, 2022
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