Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions docs/whatsapp/flows/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,13 @@ The following components are supported:
* [Dropdown](#drop)
* [EmbeddedLink](#embed)
* [DatePicker](#dp)

* [CalendarPicker](#calendarpicker)

* [Image](#img)
* [If](#if)
* [Switch](#switch)
* [Media upload](#media_upload)

* [NavigationList](#navlist)

* [Chips Selector](#chips_selector)

* [Image Carousel](#image_carousel)

## Text Components
Expand Down
5 changes: 0 additions & 5 deletions src/SampleApp/Sample/FlowHandler.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System.Runtime.CompilerServices;
using System.Text.Json;
using Devlooped.WhatsApp.Flows;
using Microsoft.Azure.Amqp.Framing;
using Microsoft.Extensions.Options;

namespace Devlooped.WhatsApp;

Expand Down Expand Up @@ -77,9 +75,6 @@ message.Content is not TextContent text ||

Response MockList(FlowDataRequest flow) => flow.DataResponse("SELECT_LIST", new
{
agent = "list",
user = flow.UserNumber,
service = flow.ServiceId,
lists = new[]
{
new
Expand Down
66 changes: 30 additions & 36 deletions src/Tests/FlowTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,49 +96,43 @@ public async Task SendFlowNavigateData()

var message = ContentMessage.Create(configuration["SendFrom"]!, configuration["SendTo"]!, "Hello");

//message.CallToFlow()

await client.SendAsync(configuration["SendFrom"]!, new
// Showcases sending an invisible non-whitespace char (https://invisible-characters.com/115F-HANGUL-CHOSEONG-FILLER.html)
var response = message.CallToAction("ᅟ", "Show Flow", new FlowParameters("data")
{
messaging_product = "whatsapp",
recipient_type = "individual",
to = configuration["SendTo"]!,
type = "interactive",
interactive = new
Token = Ulid.NewUlid().ToString(),
Action = FlowAction.Navigate,
Mode = FlowMode.Draft,
Payload = JsonSerializer.SerializeToElement(new
{
type = "flow",
body = new
screen = "welcome_screen",
data = new
{
text = "Agent Data Demo"
agent = "list",
service = "5678",
user = "pga",
flow = "data",
},
action = new
{
name = "flow",
parameters = new
{
flow_message_version = "3",
flow_cta = "Show Data",
flow_name = "data",
mode = "draft",
flow_token = "agent:list;service:5678;user:pga;flow:data;token:asdf1234",
flow_action = "navigate",
flow_action_payload = new
{
screen = "welcome_screen",
data = new
{
agent = "list",
service = "5678",
user = "pga",
flow = "data",
},
}
}
}
}
})
});

var sent = await response.SendAsync(client);

Assert.NotEqual(response, sent);
}

[SecretsFact("Meta:PrivateKey", "SendFrom", "SendTo")]
public async Task SendBlankNavigate()
{
var (configuration, client) = Initialize();

var message = ContentMessage.Create(configuration["SendFrom"]!, configuration["SendTo"]!, "Hello");

// Showcases sending an invisible non-whitespace char (https://invisible-characters.com/115F-HANGUL-CHOSEONG-FILLER.html)
var response = message.CallToAction("ᅟ", "Ver/Editar", "simple");
var sent = await response.SendAsync(client);

Assert.NotEqual(response, sent);
}

[SecretsFact("Meta:PrivateKey")]
public async Task SendFlowWithData()
Expand Down
Loading