wag/cloud/webhook

Types

pub type Change {
  IncomingMessages(
    metadata: Metadata,
    contacts: List(Contact),
    messages: List(Message),
  )
  StatusMessages(metadata: Metadata, statuses: List(Status))
}

Constructors

pub type Contact {
  Contact(profile: Profile, wa_id: String)
}

Constructors

  • Contact(profile: Profile, wa_id: String)
pub type Entry {
  Entry(id: String, changes: List(Change))
}

Constructors

  • Entry(id: String, changes: List(Change))
pub type Message {
  Message(
    from: String,
    id: String,
    timestamp: String,
    payload: MessagePayload,
  )
}

Constructors

  • Message(
      from: String,
      id: String,
      timestamp: String,
      payload: MessagePayload,
    )
pub type MessagePayload {
  Audio(
    mime_type: String,
    sha256: String,
    id: String,
    voice: Bool,
  )
  Button(payload: String, text: String)
  Contacts(List(contact_information.ContactInformation))
  Document(
    caption: option.Option(String),
    filename: String,
    mime_type: String,
    sha256: String,
    id: String,
  )
  Image(
    caption: option.Option(String),
    mime_type: String,
    sha256: String,
    id: String,
  )
  Location(
    address: option.Option(String),
    latitude: Float,
    longitude: Float,
    name: option.Option(String),
    url: option.Option(String),
  )
  Reaction(message_id: String, emoji: String)
  Sticker(
    mime_type: String,
    sha256: String,
    id: String,
    animated: Bool,
  )
  Text(text: String)
  Video(
    caption: option.Option(String),
    mime_type: String,
    sha256: String,
    id: String,
  )
}

Constructors

  • Audio(mime_type: String, sha256: String, id: String, voice: Bool)
  • Button(payload: String, text: String)
  • Document(
      caption: option.Option(String),
      filename: String,
      mime_type: String,
      sha256: String,
      id: String,
    )
  • Image(
      caption: option.Option(String),
      mime_type: String,
      sha256: String,
      id: String,
    )
  • Location(
      address: option.Option(String),
      latitude: Float,
      longitude: Float,
      name: option.Option(String),
      url: option.Option(String),
    )
  • Reaction(message_id: String, emoji: String)
  • Sticker(
      mime_type: String,
      sha256: String,
      id: String,
      animated: Bool,
    )
  • Text(text: String)
  • Video(
      caption: option.Option(String),
      mime_type: String,
      sha256: String,
      id: String,
    )
pub type Metadata {
  Metadata(display_phone_number: String, phone_number_id: String)
}

Constructors

  • Metadata(display_phone_number: String, phone_number_id: String)
pub type Profile {
  Profile(name: String)
}

Constructors

  • Profile(name: String)
pub type Status {
  Status(
    id: String,
    status: String,
    timestamp: String,
    recipient_id: String,
  )
}

Constructors

  • Status(
      id: String,
      status: String,
      timestamp: String,
      recipient_id: String,
    )
pub type Verified {
  Failed
  Success(challenge: String)
  Continue
}

Constructors

  • Failed
  • Success(challenge: String)
  • Continue

Values

pub fn decoder() -> decode.Decoder(List(Entry))
pub fn encode_message(message: Message) -> json.Json
pub fn encode_payload(
  payload: MessagePayload,
) -> #(String, json.Json)
pub fn message_decoder() -> decode.Decoder(Message)
pub fn verify(
  request: request.Request(a),
  config: String,
) -> Verified
Search Document