Coder Social home page Coder Social logo

Comments (5)

crossle avatar crossle commented on August 17, 2024 1

If it's a CONTACT conversation only need one participant, please try

participants := []bot.Participant{
{
{
UserId: keystore.RecipientId,
Role: "",
},
}

from bot-api-go-client.

jadeydi avatar jadeydi commented on August 17, 2024

https://developers.mixin.one/docs/api/conversations/create please reference the document for debug

from bot-api-go-client.

crossle avatar crossle commented on August 17, 2024

please use bot.UniqueConversationId generate the conversationId

from bot-api-go-client.

workingmin avatar workingmin commented on August 17, 2024

the complete code like that:

type Keystore struct {
Pin string json:"pin"
ClientId string json:"client_id"
SessionId string json:"session_id"
PinToken string json:"pin_token"
PrivateKey string json:"private_key"
RecipientId string json:"recipient_id"
}

func TestConversations(t *testing.T) {
ctx := context.Background()
f, err := os.Open("keystore.json")
if err != nil {
panic(err)
}
defer f.Close()
b, _ := io.ReadAll(f)
var keystore Keystore
json.Unmarshal(b, &keystore)
conversationId := bot.UniqueConversationId(keystore.ClientId, keystore.RecipientId)
participants := []bot.Participant{
{
UserId: keystore.ClientId,
Role: "OWNER",
},
{
UserId: keystore.RecipientId,
Role: "",
},
}
conversation, err := bot.CreateConversation(ctx, "CONTACT", conversationId, "", "", participants, keystore.ClientId, keystore.SessionId, keystore.PrivateKey)
if err != nil {
panic(err)
}
b, _ = json.Marshal(conversation)
t.Logf(string(b))
}

from bot-api-go-client.

workingmin avatar workingmin commented on August 17, 2024

thank, it works.

from bot-api-go-client.

Related Issues (7)

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.