Skip to content

Commit eb3b480

Browse files
committed
Add send POST message
1 parent 37b6f9f commit eb3b480

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

blaze.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,20 @@ func (b *BlazeClient) SendPlainText(ctx context.Context, msg MessageView, conten
170170
return nil
171171
}
172172

173+
func (b *BlazeClient) SendPost(ctx context.Context, msg MessageView, content string) error {
174+
params := map[string]interface{}{
175+
"conversation_id": msg.ConversationId,
176+
"recipient_id": msg.UserId,
177+
"message_id": UuidNewV4().String(),
178+
"category": MessageCategoryPlainPost,
179+
"data": base64.StdEncoding.EncodeToString([]byte(content)),
180+
}
181+
if err := writeMessageAndWait(ctx, b.mc, createMessageAction, params); err != nil {
182+
return BlazeServerError(ctx, err)
183+
}
184+
return nil
185+
}
186+
173187
func (b *BlazeClient) SendContact(ctx context.Context, conversationId, recipientId, contactId string) error {
174188
contactMap := map[string]string{"user_id": contactId}
175189
contactData, _ := json.Marshal(contactMap)

0 commit comments

Comments
 (0)