Comments (5)
If it's a CONTACT conversation only need one participant, please try
participants := []bot.Participant{
{
{
UserId: keystore.RecipientId,
Role: "",
},
}
from bot-api-go-client.
https://developers.mixin.one/docs/api/conversations/create please reference the document for debug
from bot-api-go-client.
please use bot.UniqueConversationId generate the conversationId
from bot-api-go-client.
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.
thank, it works.
from bot-api-go-client.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bot-api-go-client.