List WhatsApp number events
GET
/v1/whatsapp/numbers/{number_id}/events
for await (const event of bird.whatsapp.numbers.listEvents(
"wan_01krdgeqcxet5s7t44vh8rt9mg",
)) {
console.log(event.created_at, event.type, event.summary);
}for event in client.whatsapp.numbers.list_events("wan_01krdgeqcxet5s7t44vh8rt9mg"):
print(event.created_at, event.type, event.summary)for event, err := range client.Whatsapp.Numbers.ListEvents(context.Background(), "wan_01krdgeqcxet5s7t44vh8rt9mg", bird.WhatsappNumbersListEventsParams{}) {
if err != nil {
log.Fatal(err)
}
fmt.Println(event.CreatedAt, event.Type, event.Summary)
}foreach ($bird->whatsapp->numbers->listEvents('wan_01krdgeqcxet5s7t44vh8rt9mg') as $event) {
echo $event->getCreatedAt()?->format(DATE_ATOM), ' ', $event->getType(), "\n";
}bird whatsapp numbers list-events <number-id>curl -X GET "https://us1.platform.bird.com/v1/whatsapp/numbers/{number_id}/events" \
-H "Authorization: Bearer $TOKEN" \
--url-query "sort=created_at" \
--url-query "order=desc" \
--url-query "limit=25"Odpowiedź200
{
"data": [
{
"id": "wne_01krdgeqcxet5s7t44vh8rt9mg",
"type": "whatsapp_number.quality_rating_updated",
"summary": "Quality rating dropped to medium."
}
],
"next_cursor": "eyJ2IjoxLCJzIjoiXCIyMDI2LTA1LTI1VDE0OjAzOjEwWlwiIiwiaSI6IjAxOTJmM2IxLTRjN2UtN2EyYi05ZDYxLThmM2E1YzJlN2I0MCJ9",
"prev_cursor": null,
"refresh_cursor": "eyJ2IjoxLCJzIjoiXCIyMDI2LTA1LTI1VDE2OjQyOjAxWlwiIiwiaSI6IjAxOTJmM2IxLTllMDQtN2NkMy1iODE3LTJhNmY0ZDFjOGUwOSJ9"
}
Returns the number's activity history, newest first by default:
- The number being added, and every change of its status.
- A messaging-limit change reported by WhatsApp.
- A display-name review decision.
- A quality-rating change, observed when Bird next reads the number.
Use it to see when and why a number's status, limit, name, or quality changed,
rather than polling Get a WhatsApp number.
A number ID that does not belong to the workspace, or no longer exists,
returns 404.
Parametry
number_id
string
ID of the WhatsApp number whose events to list.
Parametry zapytania
sort
string
Field to sort by. Defaults to created_at.
Possible values: created_at
order
string
Sort direction. Defaults to desc, which sorts from newest to oldest or largest to smallest, depending on the selected sort field.
Possible values: asc, desc
limit
integer
Maximum number of items to return per page.
starting_after
string
Cursor from the next_cursor field of a previous list response. Returns items immediately after the cursor position in the current sort order.
ending_before
string
Cursor from the prev_cursor or refresh_cursor field of a previous list response. Returns items immediately before the cursor position in the current sort order. prev_cursor returns the preceding page. refresh_cursor anchors at the first row of that response, which on a newest-first sort is how to fetch the items that have appeared since.
Treść odpowiedzi
data
array of object
wymagane
Page of number events, newest first by default.
Pokaż atrybuty podrzędne
data.id
string
wymagane
Event ID.
data.type
string
wymagane
Type of number event. whatsapp_number.messaging_limit_updated and whatsapp_number.profile_name_update are reported by WhatsApp as they happen; whatsapp_number.quality_rating_updated is observed when Bird next reads the number, so it can lag the change by up to an hour. whatsapp_number.status_changed records every move of the status field on the number itself, whichever side caused it. Open enum: new event types may be added over time, so treat any unrecognized value as a future event rather than an error. The values below are the types known at this version.
Possible values (may grow over time): whatsapp_number.created, whatsapp_number.messaging_limit_updated, whatsapp_number.profile_name_update, whatsapp_number.quality_rating_updated, whatsapp_number.status_changed
data.summary
string
wymagane
Human-readable summary of what changed.
data.metadata
object
wymagane
Structured details for the event. from and to carry the values that changed, and from is absent when the number had no prior value to report. A status change into failed also carries the reason; a display-name decision carries new_display_name, decision, and, when WhatsApp named one for a rejection, rejection_reason. A messaging-limit change also carries the trigger WhatsApp named for it, such as onboarding or throughput_upgrade, when it named one. A whatsapp_number.created event carries the source the number came from, and its phone_number once one is known.
data.created_at
string
wymagane
When the event was recorded.
next_cursor
nullable string
wymagane
Cursor for the next page. Pass back as starting_after to advance forward. null when no next page exists.
prev_cursor
nullable string
wymagane
Cursor for the previous page. Pass back as ending_before to step backward. null when no previous page exists.
refresh_cursor
nullable string
wymagane
Refresh anchor, the first row of this response. Pass back as ending_before to fetch what precedes it in the current sort order. On a newest-first sort those are the items that have appeared since; on any other sort they are the items that sort earlier, so refreshing such a list means re-fetching it instead. Non-null whenever data is non-empty; null only on an empty page. Distinct from prev_cursor.
Powiązane zasoby
Kontynuuj z dokumentacją, przewodnikami i przykładami dotyczącymi tego tematu. Zasoby są w języku angielskim.
Zrozum koncepcjęShould I use a Bird SDK or call the API directly?Podążaj ścieżką naukiBuild your first integrationPrzewodnik wdrożeniowySend your first email
Uzyskaj brief wdrożeniowy